Electric vehicle charging equipment fault diagnosis method and system based on visual Transform
Through the visual Transformer method, a fault diagnosis model for charging equipment for electric vehicles is constructed, which solves the problems of low fault diagnosis efficiency and poor accuracy in the existing technology, realizes automatic fault feature extraction and diagnosis, and improves the fault of charging equipment for electric vehicles. Detection capability.
Patent Information
- Application Number
- CN202411083789.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-08
- Publication Date
- 2024-11-26
AI Technical Summary
The prior art cannot quickly and accurately diagnose the failure of electric vehicle charging equipment, resulting in low efficiency in operation and maintenance resource planning, increased safety risks and high maintenance costs.
Using a fault diagnosis method based on visual Transformer, we draw images by collecting voltage and current data from charging equipment, segmenting and position encoding, constructing data sets, and pre-training the feature extraction network and fault classification network using unsupervised and supervised data. and optimize, build a fault diagnosis model for real-time fault diagnosis.
Simplifies the fault diagnosis process, automatically extracts visual features from images, uses the Transformer network structure to capture fault features from labeled data, reduces manual participation, improves diagnosis accuracy and efficiency, and is suitable for adaptive use of new energy charging technology. Diagnosis and early warning.
Smart Images

Figure CN119027685A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of operation and maintenance of electric vehicle charging equipment, and in particular relates to a fault diagnosis method and system for electric vehicle charging equipment based on a visual Transformer. Background Art
[0002] The normal operation of electric vehicle charging stations is crucial to electric vehicle users and power suppliers. However, as the number of electric vehicle charging stations increases, the possibility of failure also increases accordingly. Therefore, fast and accurate fault diagnosis can help power companies plan operation and maintenance resources more effectively, improve the availability of charging equipment, and improve power supply reliability. In addition, fault diagnosis of charging equipment can also help avoid potential safety risks, detect and solve problems early, and avoid large-scale damage and expensive repair work. This can reduce the cost of maintenance and repair, and contribute to the economic operation of charging stations. Therefore, charging equipment fault diagnosis is one of the important research directions in the field of power and transportation. However, charging stations are usually equipped with a variety of sensors and monitoring devices for real-time monitoring of parameters during the charging process, such as current, voltage, temperature, etc. These devices generate a large amount of data for detecting abnormal conditions. Existing technologies cannot accurately capture the impact of these factors and establish accurate fault diagnosis models. Summary of the invention
[0003] In order to solve the deficiencies in the prior art, the present invention provides an electric vehicle charging equipment fault diagnosis method and system based on visual Transformer to solve the technical problem that it is difficult for charging equipment to quickly and accurately diagnose charging equipment faults.
[0004] To solve the above technical problems, the present invention utilizes the following technical solutions.
[0005] The present invention first discloses a fault diagnosis method for electric vehicle charging equipment based on a visual Transformer, the method comprising the following steps:
[0006] Collecting voltage and current sampling data of a preset charging cycle from an electric vehicle charging device, and drawing an image based on the sampling data;
[0007] Segmenting and position encoding the drawn image, slicing and splicing the image of the charging cycle to form a tile sequence and construct a data set, and constructing an initial fault diagnosis model based on a visual Transformer based on the data set, wherein the initial fault diagnosis model includes a feature extraction network and a fault classification network;
[0008] Pre-training the feature extraction network using an unsupervised data set in the data set, and optimizing the fault classification network using a supervised data set in the data set to obtain a charging equipment fault diagnosis model;
[0009] According to the voltage and current sampling data of the current charging cycle collected in real time, the charging device fault diagnosis model is used to perform fault diagnosis on the charging device.
[0010] The present invention further includes the following preferred embodiments:
[0011] The method further includes collecting voltage and current sampling data of a preset charging cycle from the electric vehicle charging device and drawing an image based on the sampling data:
[0012] The cycle starts when the electric vehicle starts charging and ends when the charging gun is pulled out. The entire charging cycle is counted as T.
[0013] The voltage and current data are sampled from the charging cycle T at a predefined frequency λ and normalized:
[0014]
[0015] Among them, V and I are voltage and current data respectively, V max and I max are the maximum values of voltage and current data, V norm and I norm They are the normalized voltage and current data respectively;
[0016] The voltage and current data sampled during the charging cycle are plotted into a waveform graph, and the voltage and current waveform curves are plotted in the same graph area, with the horizontal axis representing the sampling time point and the vertical axis representing the normalized voltage and current data respectively.
[0017] The segmentation and position encoding of the drawn image, slicing and splicing of the image of the charging cycle to form a sequence of tiles and construct a data set further includes:
[0018] Input image x∈R h×w×c , where h, w, c are the height, width and number of channels of the image respectively. The image of each charging cycle is segmented to obtain N p×p blocks, and the blocks are arranged from top to bottom and from left to right to obtain a block sequence.
[0019] Perform position encoding for each tile, and for each position pos in the input sequence, calculate its corresponding position encoding vector PE pos , calculate the position encoding vector PE pos The i-th element PE in (pos,i)Values:
[0020]
[0021] Among them, PE (pos,i) Represents the position encoding vector PE respectively pos The i-th element in , pos represents the position of the tile in the input sequence, and i represents the position encoding vector PE pos The position in d model Represents the dimension of the tile vector;
[0022] All elements of the position encoding vector PE (pos,i) Add them one by one to get the position encoding vector PE of the position pos , the position encoding vector PE pos and the tile vector x at the corresponding position N Add them together to get the input matrix X containing the position information:
[0023] X=[x 1 ,x 2 ,…,x N ]+P
[0024] P=[PE1,PE2,…,PE N ]
[0025] Among them, x N is the vector of the Nth tile, PE N is the Nth position encoding vector PE pos .
[0026] Data samples containing only input data are collected, and a tile sequence is taken as a data sample to obtain an unsupervised dataset containing voltage and current information but no fault feature labels. The unsupervised data is preprocessed, including data cleaning and normalization.
[0027] Collect data samples containing input data and corresponding fault feature labels, add correct labels to each data sample, ensure that the labels correspond to the corresponding input data, and obtain a supervised dataset G.
[0028] The initial fault diagnosis model based on visual Transformer is constructed, including:
[0029] Construct the overall structure of the fault diagnosis model based on visual Transformer, including input layer, feature extraction network, fault classification network and output layer;
[0030] Constructing the feature extraction network, using a pre-trained visual Transformer model to extract high-level features in the image, constructing multiple Transformer modules in the model, each module including multiple self-attention layers and feed-forward neural network layers, using the self-attention layers and feed-forward neural network layers to capture spatial relationships and contextual information in the image through multiple iterations, and generating feature representations of the image;
[0031] The fault classification network is constructed, the feature representation output by the feature extraction network is received as input, and fault classification is performed through a series of fully connected layers and activation functions.
[0032] The pre-training of the feature extraction network using the unsupervised data set in the data set further includes:
[0033] Using the MASK method to construct a pre-training task, draw images according to the unsupervised dataset, divide the images into tiles, encode the images, and add location information;
[0034] MAE is used to mask the segmented tile sequence according to the preset mask ratio, and a random sampling strategy that obeys a uniform distribution is used to sample part of the tile and mask the other part;
[0035] Construct an encoder network consisting of multiple linear transformation layers and nonlinear activation function layers, receiving the masked input matrix as input and outputting a low-dimensional feature representation;
[0036] Construct a decoder network that takes the low-dimensional representation of the encoder network output as input and reconstructs the original input data. The parameters of the decoder network are the transpose of the parameters of the encoder network. After decoding, the corresponding part of the masked tile sequence is taken out and sent to the fully connected layer to predict the image at the masked position. Finally, the predicted result is compared with the actual image to calculate the reconstruction error.
[0037] Minimizing the reconstruction error function is used as the objective function of pre-training, that is, the difference between the input data and the output of the decoder.
[0038] The objective function is:
[0039] L=reconstruction loss (e,decoder(encoder(e)))
[0040] =MSE(e,decoder(encoder(e)))
[0041] Among them, e is the input data, encoder is the encoder function, decoder is the decoder function, reconstruction loss is the reconstruction error function;
[0042] The reconstruction error metric is the mean square error MSE:
[0043]
[0044] Where n is the number of samples; y i is the predicted value; i is the measured value; is the mean of the measured values;
[0045] The goal of the pre-training task is to learn feature representation by minimizing L; after pre-training is completed, the pre-trained encoder is used as the feature extraction network.
[0046] The method further comprises: performing fault diagnosis on the charging device through the charging device fault diagnosis model according to the voltage and current sampling data of the current charging cycle collected in real time.
[0047] Preprocessing the voltage and current data of the charging device in a preset charging cycle, including removing noise and normalizing;
[0048] Plotting and segmenting the voltage and current data of the charging cycle;
[0049] Take the tiles at the same position and splice them to get a tile sequence;
[0050] Inputting the image block sequence into the charging equipment fault diagnosis model, and extracting fault features using the feature extraction network;
[0051] For the result output by the feature extraction network, the fault classification network is used to determine whether there is a fault in the electric vehicle charging equipment at the location, and a fault diagnosis result is obtained.
[0052] The present invention also discloses a visual Transformer-based electric vehicle charging equipment fault diagnosis system utilizing the aforementioned visual Transformer-based electric vehicle charging equipment fault diagnosis method, comprising a charging data acquisition and drawing module, an initial model building module, a model training and optimization module, and a charging equipment fault diagnosis module.
[0053] The charging data acquisition and drawing module is used to collect voltage and current sampling data of a preset charging cycle from the electric vehicle charging equipment, and draw an image based on the sampling data;
[0054] The initial model building module is used to segment and position encode the drawn image, slice and splice the image of the charging cycle to form a tile sequence and construct a data set, and construct an initial fault diagnosis model based on a visual Transformer based on the data set, wherein the initial fault diagnosis model includes a feature extraction network and a fault classification network;
[0055] The model training optimization module is used to pre-train the feature extraction network using the unsupervised data set in the data set, and optimize the fault classification network using the supervised data set in the data set to obtain a charging equipment fault diagnosis model;
[0056] The charging device fault diagnosis module is used to perform fault diagnosis on the charging device through the charging device fault diagnosis model according to the voltage and current sampling data of the current charging cycle collected in real time.
[0057] Correspondingly, the present invention also discloses a terminal, including a processor and a storage medium;
[0058] The storage medium is used to store instructions;
[0059] The processor is used to operate according to the instructions to execute the steps of the aforementioned electric vehicle charging equipment fault diagnosis method based on visual Transformer.
[0060] Correspondingly, the present invention also discloses a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the aforementioned electric vehicle charging equipment fault diagnosis method based on visual Transformer are implemented.
[0061] The beneficial effect of the present invention is that, compared with the prior art, the present invention provides an electric vehicle charging equipment fault diagnosis method and system based on visual Transformer, which simplifies the feature extraction step that requires a lot of manual participation in the charging equipment fault diagnosis method to automatically extracting visual features from images, and uses the Transformer network structure to capture effective representation of fault features from large-scale unlabeled data. At the same time, only a small amount of manually labeled data is used for parameter optimization, which has good engineering application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 It is a flow chart of the electric vehicle charging equipment fault diagnosis method based on visual Transformer in the present invention.
[0063] Figure 2 It is a line graph of voltage and current in the present invention.
[0064] Figure 3It is a schematic diagram of a picture sequence after the input is segmented in the present invention.
[0065] Figure 4 This is a structural diagram of the fault diagnosis model based on visual Transformer in the present invention.
[0066] Figure 5 It is a feature extraction network structure diagram in the present invention.
[0067] Figure 6 It is a mask schematic diagram of the MASK method in the present invention. DETAILED DESCRIPTION
[0068] In order to make the purpose, technical solution and advantages of the present invention more clear, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0069] The embodiments described in the present invention are only some embodiments of the present invention, not all embodiments. Based on the spirit of the present invention, other embodiments obtained by ordinary technicians in this field without creative work are all within the protection scope of the present invention.
[0070] In view of the shortcomings of the prior art, the present invention proposes a method and system for fault diagnosis of electric vehicle charging equipment based on visual Transformer. First, the voltage and current waveform data of the preset charging cycle are collected from the charging equipment, and the waveform data is plotted into an image to construct a charging process data set. Then, a fault diagnosis model based on visual Transformer is constructed, which includes a feature network and a classification network. Finally, the feature network part of the model is pre-trained using unsupervised data, and the classification network part of the model is optimized using a small amount of supervised data to obtain a fault diagnosis model for the charging equipment.
[0071] See also Figure 1 As shown, the electric vehicle charging equipment fault diagnosis method based on visual Transformer disclosed in the present invention includes the following steps:
[0072] Step 1: Collect voltage and current sampling data of a preset charging cycle from an electric vehicle charging device, and draw an image based on the sampling data.
[0073] In a preferred embodiment, step 1 further comprises:
[0074] Step 1.1: Select and determine the charging cycle, with the start of the cycle being when the electric vehicle starts charging and the end of the cycle being when the charging gun is pulled out after the charging behavior is completed. The entire charging cycle is counted as T;
[0075] Step 1.2: Sample the voltage and current data from the charging cycle T at a predefined frequency λ, and normalize the voltage and current data so that they are between 0 and 1. The normalization formula is expressed as:
[0076]
[0077] Among them, V and I are voltage and current data, V max and I max is the maximum value of voltage and current data, V norm and I norm are the normalized voltage and current data.
[0078] Step 1.3: Use a computer program to automatically call a drawing tool to draw the voltage and current data sampled during the charging cycle into a waveform graph. Draw the voltage and current waveform curves in the same graphic area, with the horizontal axis representing the sampling time point and the vertical axis representing the normalized voltage and current data respectively. When drawing, the length of the horizontal axis is not fixed, and the height of the vertical axis is fixed. The current and voltage line graph of a charging cycle of the embodiment of the present invention is as follows Figure 2 The data items include charging pile voltage and current data, and the sampling interval is 10 minutes.
[0079] Step 2: Segment and position encode the drawn image, slice and splice the image of the charging cycle to form a tile sequence and construct a data set, and construct an initial fault diagnosis model based on a visual Transformer based on the data set. The initial fault diagnosis model includes a feature extraction network and a fault classification network.
[0080] In a preferred embodiment, the segmentation and position encoding of the drawn image and the slicing and splicing of the image of the charging cycle to form a sequence of tiles further include:
[0081] Step 2.1: Input image x∈R h×w×c , where h, w, c are the height, width and number of channels of the image respectively. The image of each charging cycle is segmented to obtain N p×p patches, and the patches are arranged from top to bottom and from left to right to obtain the image patch sequence.
[0082] Step 2.2: Position encode each image patch. For each position pos in the input sequence, calculate its corresponding position encoding vector PE pos . Calculate the position encoding vector PE pos The i-th element PE in (pos,i) Values:
[0083]
[0084] Among them, PE (pos,i) Represents the position encoding vector PE respectively pos The i-th element in , pos represents the position of the tile in the input sequence, and i represents the position encoding vector PE pos The position in d model Indicates the dimension of the tile vector.
[0085] Step 2.3: Encode all elements in the position vector PE (pos,i) Add them one by one to get the position encoding vector PE of the position pos . The position encoding vector PE pos and the tile vector x at the corresponding position N Add them together to get the input matrix X containing position information.
[0086] X=[x 1 ,x 2 ,…,x N ]+P (3)
[0087] P=[PE1,PE2,…,PE N ] (4)
[0088] Among them, x N is the vector of the Nth tile, PE N is the Nth position encoding vector PE pos .
[0089] The stitched image sequence is as follows Figure 3 shown.
[0090] In a preferred embodiment, constructing the data set includes:
[0091] Step 2.4: Collect data samples containing only input data, taking a patch sequence as a data sample to obtain an unsupervised data set. These data contain voltage and current information but no fault feature labels. By constructing a pre-training task using a large amount of unsupervised data, the feature extraction network can be pre-trained. Preferably, the unsupervised data is pre-processed, including data cleaning and normalization.
[0092] Step 2.5: Collect data samples containing input data and corresponding fault feature labels, add correct labels to each data sample, ensure that the labels correspond to the corresponding input data, and obtain the supervised dataset G.
[0093] In a preferred embodiment, the construction of an initial fault diagnosis model based on a visual Transformer includes:
[0094] Step 2.6: Construct the overall structure of the fault diagnosis model based on Vision Transformer (ViT). The overall structure of this model includes: input layer, feature extraction network, fault classification network and output layer. The overall structure of the model is as follows: Figure 4 shown.
[0095] Step 2.7: Build a feature extraction network and use the pre-trained visual Transformer model to extract high-level features from the image. Build multiple Transformer modules in the model, each of which contains multiple self-attention layers and feed-forward neural network layers. These self-attention layers and feed-forward neural network layers capture the spatial relationships and contextual information in the image through multiple iterations to generate feature representations of the image;
[0096] Step 2.8: Construct a fault classification network, receive the feature representation output by the feature extraction network as input, and perform fault classification through a series of fully connected layers and activation functions.
[0097] In a further embodiment, the feature extraction network diagram is as follows: Figure 5 As shown in the figure, the structure includes input layer, position encoding layer, self-attention layer, feedforward neural network layer, and output layer. The feature extraction network construction process specifically includes:
[0098] Construct the input layer of the feature extraction network and input the image x∈R h×w×c Slice to generate an image patch sequence;
[0099] Construct a position encoding layer and add a position encoding PE to each image patch pos , in order to preserve the spatial relationship of the image, generate the input matrix X containing the position information of the self-attention layer;
[0100] Construct a self-attention layer and perform context-aware weighted aggregation on the tiles through the self-attention mechanism to capture the spatial relationship and context information in the image. Given an input matrix X, the self-attention mechanism calculates a new feature matrix Z:
[0101]
[0102] Among them, Attention(X) is the self-attention calculation. Through the conversion operation of different linear transformation matrices, each row of the input matrix X is mapped as a vector to the query vector Q, key vector K, and value vector V. d represents the dimension of the above vectors (query vector Q, key vector K, value vector V);
[0103] Calculate the residual and standardization. First, use the residual connection to connect the input and output of the self-attention layer. Through the residual connection, the deep network can be trained more effectively to avoid problems such as gradient disappearance and network degradation. Then use the standardization layer to standardize each sample in the feature dimension to reduce the dependency between different features, which can make the model training more stable, converge faster, and improve the generalization ability of the model. The residual and standardization are calculated as follows.
[0104] LayerNorm(X+Attention(X)) (6)
[0105] Among them, LayerNorm() represents the normalization layer, and X+Attention(X) performs a residual connection between the original result of the input matrix X and the result after self-attention processing.
[0106] Construct a feedforward neural network layer, introduce nonlinearity through multi-layer linear transformation and activation function, extract more advanced feature representation, and form a new feature matrix A:
[0107] A=FFN(Z)=ReLU(ZW1+b1)W2+b2 (7)
[0108] Among them, ReLU() is the rectified linear unit activation function, W1∈R dff×d , W2∈R d×dff , b1∈R dff , b2∈R d is a learnable parameter, and dff is the hidden layer dimension of the feedforward neural network layer.
[0109] Construct the output layer. The output of the encoding layer is an encoding matrix with the same dimension as the input matrix, in which a corresponding encoded vector is generated for each input symbol. Select the encoding vector corresponding to the position of [CLS] as the encoded vector, which contains the information of the picture. [CLS] is a special token used to represent the information of the entire image. It is artificially added during the modeling process. The content is an empty picture. In this model, it is used to capture the feature information of the entire picture. This token and other patch vectors form a matrix to participate in the calculation of attention weights and feature representations, and finally serve as the feature representation of the entire picture for classification.
[0110] In a further embodiment, the fault classification network further includes a linear transformation layer (LinearTransformation Layer), which is used to linearly transform the input data through matrix multiplication and addition of bias terms. In the classification prediction task, the linear transformation layer is used as the last layer to map the encoded feature vector to the prediction result of the category label. Specifically, the output of the linear transformation layer is calculated by the following steps:
[0111] Input the encoding vector corresponding to the position of [CLS];
[0112] Set the bias addition and define the weight matrix a∈R d×C , define the bias vector b∈R C Where C represents the number of classification labels. The specific formula for the output of the linear transformation layer is as follows:
[0113] Y=Aa+b (8)
[0114] Use the Softmax function to transform the vector output by the linear transformation to obtain the probability distribution of each category:
[0115] Y prob =softmax(Y) (9)
[0116] According to the probability distribution, the category with the highest probability is selected as the final prediction result. The output formula is as follows:
[0117] Y preb = argmax(Y prob ) (10)
[0118] Step 3: Pre-train the feature extraction network using the unsupervised data set in the data set, and optimize the fault classification network using the supervised data set in the data set to obtain a charging equipment fault diagnosis model.
[0119] The feature extraction network is pre-trained using the unsupervised data set in the data set, specifically, the pre-training task is constructed using the MASK method, and the feature extraction network of the model is pre-trained using the unsupervised data. The pre-training process is further described as follows:
[0120] Step 3.1: Draw according to the unsupervised dataset, divide the image into tiles, encode the image, and add location information;
[0121] Step 3.2: Use MAE (mask and predict) to mask the segmented image patch sequence according to the preset mask ratio. The mask ratio is set to 75%. Use a random sampling strategy that follows a uniform distribution to sample part of the patch and mask the other part. The mask diagram of the MASK method is as follows: Figure 6 ;
[0122] Step 3.3: Construct an encoder network consisting of multiple linear transformation layers and nonlinear activation function layers, receiving the masked input matrix as input and outputting a low-dimensional feature representation;
[0123] Step 3.4: Build a decoder network that takes the low-dimensional representation of the encoder network output as input and reconstructs the original input data. The parameters of the decoder network are the transpose of the parameters of the encoder network. After decoding, the corresponding part of the masked tile sequence is taken out and sent to the fully connected layer to predict the image at the masked position. Finally, the predicted result is compared with the actual image to calculate the reconstruction error;
[0124] Step 3.5: Minimize the reconstruction error function as the objective function of pre-training, that is, the difference between the input data and the output of the decoder. The optimization objective function is as follows:
[0125] L=reconstruction loss (e,decoder(encoder(e)))
[0126] =MSE(e,decoder(encoder(e))) (11)
[0127] Among them, e is the input data, encoder is the encoder function, decoder is the decoder function, reconstruction loss is the reconstruction error function.
[0128] The reconstruction error metric is the mean square error (MSE):
[0129]
[0130] Where n is the number of samples; y i is the predicted value; i is the measured value; is the mean of the measured values.
[0131] The goal of the pre-training task is to learn useful feature representations by minimizing L. After pre-training is completed, the pre-trained encoder can be used as a feature extraction network.
[0132] In a preferred embodiment, before optimizing the fault classification network using a supervised data set in the data set, the supervised training task is constructed as follows:
[0133] Input the constructed supervised dataset G, where each sample contains input features and corresponding fault category labels;
[0134] Pre-trained weight initialization, using the weights of the encoder part of the pre-trained feature extraction network as the initial weights a∈R d×C , to provide better initial parameters;
[0135] The prediction results are calculated through forward propagation and compared with the true labels. The optimization goal of the supervised training task is to minimize the difference between the prediction results and the true labels. The cross entropy function is used as the loss function, and the objective function L is expressed as:
[0136] L = crossentropy(y pred ,y true ) (13)
[0137] Among them, y pred is the prediction result of the network, y true is the true fault category label.
[0138] Step 4: According to the voltage and current sampling data of the current charging cycle collected in real time, the charging device fault diagnosis model is used to diagnose the charging device fault.
[0139] In a preferred embodiment, the specific process of step 4 further includes:
[0140] Step 4.1: Preprocessing the voltage and current data of the charging device in a preset charging cycle, including operations such as noise removal and normalization;
[0141] Step 4.2: Plotting and segmenting the voltage and current data of the charging cycle;
[0142] Step 4.3: Take the image patches at the same position and stitch them together to get a patch sequence;
[0143] Step 4.4: Input the patch sequence into the trained charging equipment fault diagnosis model and use the feature extraction network to extract fault features;
[0144] Step 4.5: For the result output by the feature extraction network, use the fault classification network to determine whether the electric vehicle charging equipment at that location is faulty and obtain the fault diagnosis result.
[0145] The beneficial effect of the present invention is that, compared with the prior art, the present invention provides an electric vehicle charging equipment fault diagnosis method and system based on visual Transformer, which simplifies the feature extraction process that requires a lot of manual participation in the electric vehicle charging equipment fault diagnosis to automatically extracting visual features from images, and analyzes the charging equipment voltage and current image data. The Transformer network structure is used to capture the effective representation of fault features from large-scale unlabeled data, and fault diagnosis and fault probability calculation are performed. At the same time, only a small amount of manually labeled data is used for parameter optimization, which makes up for the defect that it is difficult to accurately diagnose faults in new energy charging. It has good engineering application prospects and lays the foundation for future new energy charging technologies such as adaptive diagnosis and adaptive early warning.
[0146] The present invention may be a system, a method and / or a computer program product. The present invention also discloses a visual transformer-based electric vehicle charging equipment fault diagnosis system based on the aforementioned visual transformer-based electric vehicle charging equipment fault diagnosis method, including a charging data acquisition and drawing module, an initial model building module, a model training optimization module and a charging equipment fault diagnosis module.
[0147] The charging data acquisition and drawing module is used to collect voltage and current sampling data of a preset charging cycle from the electric vehicle charging equipment, and draw an image based on the sampling data;
[0148] The initial model building module is used to segment and position encode the drawn image, slice and splice the image of the charging cycle to form a tile sequence and construct a data set, and construct an initial fault diagnosis model based on a visual Transformer based on the data set, wherein the initial fault diagnosis model includes a feature extraction network and a fault classification network;
[0149] The model training optimization module is used to pre-train the feature extraction network using the unsupervised data set in the data set, and optimize the fault classification network using the supervised data set in the data set to obtain a charging equipment fault diagnosis model;
[0150] The charging device fault diagnosis module is used to perform fault diagnosis on the charging device through the charging device fault diagnosis model according to the voltage and current sampling data of the current charging cycle collected in real time.
[0151] Based on the spirit of the present invention, those skilled in the art can easily think that a computer program product can be obtained based on the aforementioned electric vehicle charging equipment fault diagnosis method based on visual Transformer. The computer program product may include a computer-readable storage medium, which carries computer-readable program instructions for enabling a processor to implement various aspects of the present invention. That is, the present invention also includes a terminal, including a processor and a storage medium; the storage medium is used to store instructions; the processor is used to operate according to the instructions to execute the steps of the aforementioned electric vehicle charging equipment fault diagnosis method based on visual Transformer.
[0152] Computer readable storage medium can be a tangible device that can keep and store the instructions used by the instruction execution device. Computer readable storage medium can be, for example, - but not limited to - electrical storage device, magnetic storage device, optical storage device, electromagnetic storage device, semiconductor storage device or any suitable combination of the above. More specific examples (non-exhaustive list) of computer readable storage medium include: portable computer disk, hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disk read-only memory (CD-ROM), digital versatile disk (DVD), memory stick, floppy disk, mechanical encoding device, for example, punch card or groove protrusion structure with instructions stored thereon and any suitable combination of the above. Computer readable storage medium used here is not interpreted as instantaneous signal itself, such as radio wave or other free propagating electromagnetic wave, electromagnetic wave propagated by waveguide or other transmission medium (for example, light pulse by optical fiber cable) or electrical signal transmitted by wire.
[0153] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0154] The computer program instructions for performing the operation of the present invention may be assembler instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present invention.
[0155] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents, and any modifications or equivalent replacements that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A fault diagnosis method for electric vehicle charging equipment based on visual Transformer, characterized in that: The following steps are involved: Collecting voltage and current sampling data of a preset charging cycle from an electric vehicle charging device, and drawing an image based on the sampling data; Segmenting and position encoding the drawn image, slicing and splicing the image of the charging cycle to form a tile sequence and construct a data set, and constructing an initial fault diagnosis model based on a visual Transformer based on the data set, wherein the initial fault diagnosis model includes a feature extraction network and a fault classification network; Pre-training the feature extraction network using an unsupervised data set in the data set, and optimizing the fault classification network using a supervised data set in the data set to obtain a charging equipment fault diagnosis model; According to the voltage and current sampling data of the current charging cycle collected in real time, the charging device fault diagnosis model is used to perform fault diagnosis on the charging device.
2. The electric vehicle charging equipment fault diagnosis method based on visual Transformer according to claim 1 is characterized in that: The method further includes collecting voltage and current sampling data of a preset charging cycle from the electric vehicle charging device and drawing an image based on the sampling data: The cycle starts when the electric vehicle starts charging and ends when the charging gun is pulled out. The entire charging cycle is counted as T. The voltage and current data are sampled from the charging cycle T at a predefined frequency λ, and the voltage and current data are normalized as follows: Among them, V and I are voltage and current data respectively, V max and I max are the maximum values of voltage and current data, V norm and I norm They are the normalized voltage and current data respectively; The voltage and current data sampled during the charging cycle are plotted into a waveform graph, and the voltage and current waveform curves are plotted in the same graph area, with the horizontal axis representing the sampling time point and the vertical axis representing the normalized voltage and current data respectively.
3. The electric vehicle charging equipment fault diagnosis method based on visual Transformer according to claim 2 is characterized in that: The segmentation and position encoding of the drawn image, slicing and splicing of the image of the charging cycle to form a sequence of tiles and construct a data set further includes: Input image x∈R h×w×c , where h, w, c are the height, width and number of channels of the image respectively. The image of each charging cycle is segmented to obtain N p×p blocks, and the blocks are arranged from top to bottom and from left to right to obtain a block sequence; Perform position encoding for each tile, and for each position pos in the input sequence, calculate its corresponding position encoding vector PE pos , calculate the position encoding vector PE pos The i-th element PE in (pos,i) Values: Among them, PE (pos,i) Represents the position encoding vector PE respectively pos The i-th element in , pos represents the position of the tile in the input sequence, and i represents the position encoding vector PE pos The position in d model Represents the dimension of the tile vector; All elements of the position encoding vector PE (pos,i) Add them one by one to get the position encoding vector PE of the position pos , the position encoding vector PE pos and the tile vector x at the corresponding position N Add them together to get the input matrix X containing the position information: Among them, x N is the vector of the Nth tile, PE N is the Nth position encoding vector PE pos ; Collecting data samples containing only input data but no fault feature labels, wherein the input data contains the voltage and current data, taking a block sequence as a data sample, obtaining an unsupervised data set, and preprocessing the unsupervised data, including data cleaning and normalization; Collect data samples containing input data and corresponding fault feature labels, add correct labels to each data sample, ensure that the labels correspond to the corresponding input data, and obtain a supervised dataset G.
4. The electric vehicle charging equipment fault diagnosis method based on visual Transformer according to claim 1 is characterized in that: The initial fault diagnosis model based on visual Transformer is constructed, including: Construct the overall structure of the fault diagnosis model based on visual Transformer, including input layer, feature extraction network, fault classification network and output layer; Constructing the feature extraction network, using a pre-trained visual Transformer model to extract high-level features in the image, constructing multiple Transformer modules in the model, each module including multiple self-attention layers and feed-forward neural network layers, using the self-attention layers and feed-forward neural network layers to capture spatial relationships and contextual information in the image through multiple iterations, and generating feature representations of the image; The fault classification network is constructed, the feature representation output by the feature extraction network is received as input, and fault classification is performed through a series of fully connected layers and activation functions.
5. The electric vehicle charging equipment fault diagnosis method based on visual Transformer according to claim 4 is characterized in that: The pre-training of the feature extraction network using the unsupervised data set in the data set further includes: Using the MASK method to construct a pre-training task, draw images according to the unsupervised dataset, divide the images into tiles, encode the images, and add location information; MAE is used to mask the segmented tile sequence according to the preset mask ratio, and a random sampling strategy that obeys a uniform distribution is used to sample part of the tile and mask the other part; Construct an encoder network consisting of multiple linear transformation layers and nonlinear activation function layers, receiving the masked input matrix as input and outputting a low-dimensional feature representation; Construct a decoder network that takes the low-dimensional representation of the encoder network output as input and reconstructs the original input data. The parameters of the decoder network are the transpose of the parameters of the encoder network. After decoding, the corresponding part of the masked tile sequence is taken out and sent to the fully connected layer to predict the image at the masked position. Finally, the predicted result is compared with the actual image to calculate the reconstruction error. The objective function of pre-training is to minimize the reconstruction error function, which is the difference between the input data and the output of the decoder.
6. The electric vehicle charging equipment fault diagnosis method based on visual Transformer according to claim 5 is characterized in that: The objective function is: L=reconstruction loss (e,decoder(encoder(e))) =MSE(e,decoder(encoder(e))) Among them, e is the input data, encoder is the encoder function, decoder is the decoder function, reconstruction loss is the reconstruction error function; The reconstruction error metric is the mean square error MSE: Where n is the number of samples; y i is the predicted value; i is the measured value; is the mean of the measured values; The goal of the pre-training task is to learn feature representation by minimizing L; after pre-training is completed, the pre-trained encoder is used as the feature extraction network.
7. The electric vehicle charging equipment fault diagnosis method based on visual Transformer according to claim 6 is characterized in that: The method further comprises: performing fault diagnosis on the charging device through the charging device fault diagnosis model according to the voltage and current sampling data of the current charging cycle collected in real time. Preprocessing the voltage and current data of the charging device in a preset charging cycle, including removing noise and normalizing; Plotting and segmenting the voltage and current data of the charging cycle; Take the tiles at the same position and splice them to get a tile sequence; Inputting the image block sequence into the charging equipment fault diagnosis model, and extracting fault features using the feature extraction network; For the result output by the feature extraction network, the fault classification network is used to determine whether there is a fault in the electric vehicle charging equipment at the location, and a fault diagnosis result is obtained.
8. A visual Transformer-based electric vehicle charging equipment fault diagnosis system using the visual Transformer-based electric vehicle charging equipment fault diagnosis method according to any one of claims 1 to 7, comprising a charging data acquisition and drawing module, an initial model building module, a model training and optimization module, and a charging equipment fault diagnosis module, characterized in that: The charging data acquisition and drawing module is used to collect voltage and current sampling data of a preset charging cycle from the electric vehicle charging equipment, and draw an image based on the sampling data; The initial model building module is used to segment and position encode the drawn image, slice and splice the image of the charging cycle to form a tile sequence and construct a data set, and construct an initial fault diagnosis model based on a visual Transformer based on the data set, wherein the initial fault diagnosis model includes a feature extraction network and a fault classification network; The model training optimization module is used to pre-train the feature extraction network using the unsupervised data set in the data set, and optimize the fault classification network using the supervised data set in the data set to obtain a charging equipment fault diagnosis model; The charging device fault diagnosis module is used to perform fault diagnosis on the charging device through the charging device fault diagnosis model according to the voltage and current sampling data of the current charging cycle collected in real time.
9. A terminal comprising a processor and a storage medium; characterized in that: The storage medium is used to store instructions; The processor is used to operate according to the instructions to execute the steps of the electric vehicle charging equipment fault diagnosis method based on visual Transformer according to any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the electric vehicle charging equipment fault diagnosis method based on visual Transformer described in any one of claims 1 to 7 are implemented.
