Charging equipment fault diagnosis method and system considering time sequence data representation and privacy protection
The charging equipment fault diagnosis system, which combines deep learning models with federated learning architecture, solves the problem of balancing data privacy protection and diagnostic accuracy in charging equipment fault diagnosis. It achieves efficient and safe fault identification and diagnosis, and improves the safety and reliability of the electric vehicle charging process.
Patent Information
- Application Number
- CN202511112488.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-08
- Publication Date
- 2025-11-21
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing fault diagnosis systems for charging equipment struggle to balance data privacy protection and diagnostic accuracy, leading to risks of information leakage and low diagnostic efficiency, which in turn affects the safety and reliability of electric vehicle charging.
We employ a deep learning model and federated learning architecture, combined with time series data representation and privacy protection techniques. We extract multi-level visual features through the ConvNeXt V2 model, optimize the model by combining lightweight and sparse token transformation modules, and use the federated learning framework for distributed training and encryption algorithms to protect data privacy.
This technology improves the accuracy and real-time performance of charging equipment fault diagnosis while protecting user privacy, reduces computational complexity, prevents information leakage, and enhances the safety and reliability of charging facilities.
Smart Images

Figure CN120995346A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of electric vehicle charging facility operation and maintenance technology, and more specifically, relates to a charging equipment fault diagnosis method and system that considers time series data representation and privacy protection. Background Technology
[0002] With the rapid development of the new energy vehicle industry, electric vehicles have achieved rapid market expansion globally due to their advantages such as being green, low-carbon, and efficient, and their ownership has shown a continuous upward trend. To meet the growing charging demand of electric vehicles, countries are vigorously promoting the construction of charging infrastructure, especially the number and types of charging piles are rapidly expanding, constantly iterating from traditional slow charging and fast charging to DC high-power charging equipment. However, while developing rapidly, the stability and reliability of charging equipment have become increasingly prominent issues, and frequent charging equipment failures have become one of the important bottlenecks restricting the large-scale popularization of electric vehicles.
[0003] Currently, charging equipment faces numerous challenges in actual operation, such as equipment aging, complex charging environments, unstable communication links, sensor errors, software system crashes, and hardware failures under extreme weather conditions. These problems not only affect charging efficiency and user experience but may also cause safety hazards such as battery damage, overcharging, and thermal runaway, and in severe cases, even lead to accidents like fires. Therefore, there is an urgent need to build an efficient, intelligent charging equipment fault diagnosis system with real-time response capabilities to achieve early fault detection, rapid location, and accurate classification, thereby ensuring the safe and stable operation of the charging system.
[0004] Meanwhile, with the rapid development of big data and IoT technologies, massive amounts of charging transaction data, communication messages, and vehicle status data are generated between charging piles and their back-end management systems. Due to the strong user relevance and sensitivity of this data, privacy protection has become a growing concern. Traditional data collection and fault diagnosis solutions often neglect user privacy protection, easily leading to information leakage risks, thus hindering the promotion and application of intelligent diagnostic technology in real-world charging scenarios. Therefore, how to improve diagnostic accuracy and efficiency while protecting the privacy of sensitive data has become a critical technical problem that urgently needs to be solved in the design of intelligent charging fault diagnosis systems.
[0005] To address the aforementioned issues, accurate and efficient fault diagnosis of charging equipment operation status, while protecting user privacy, has become a crucial aspect of ensuring safe charging of electric vehicles. The introduction of charging equipment fault diagnosis technology provides a new technological path for real-time monitoring of equipment operation status and rapid fault identification. By constructing an intelligent diagnostic system, the response speed and accuracy of fault detection can be effectively improved, significantly enhancing the operational reliability and service capabilities of charging infrastructure. Simultaneously, the integrated application of federated learning architecture and encryption algorithms enables model training and updates without exposing raw data, effectively ensuring the privacy and security of charging data during transmission and processing, and meeting the technological requirement for the coordinated development of data security and intelligent diagnosis. Summary of the Invention
[0006] To address the shortcomings or improvement needs of existing technologies, this invention provides a method and system for fault diagnosis of charging equipment that considers time series data representation and privacy protection. By combining deep learning models and federated learning architecture, it achieves accurate identification of faults in the operating status of charging equipment while effectively protecting the privacy of charging data.
[0007] To achieve the above objectives, the technical solution of the present invention is as follows: a method for fault diagnosis of charging equipment that considers time series data representation and privacy protection, the method comprising the following steps:
[0008] Collect charging order data and message data of charging equipment, and draw an image dataset for charging equipment fault diagnosis based on time.
[0009] Feature extraction is performed on the image dataset to obtain multi-level visual feature representations;
[0010] Training a fault diagnosis model for charging equipment based on time series data representation;
[0011] Inference optimization of the fault diagnosis model for charging equipment is performed by combining lightweight technology;
[0012] Privacy protection is implemented in the fault diagnosis model for charging equipment by incorporating a federated learning framework.
[0013] Based on the optimized and trained fault diagnosis model, fault diagnosis is performed on the time-series data of the current operating status of the charging equipment.
[0014] Preferably, the charging order data and message data collected from the charging equipment are used to create an image dataset for charging equipment fault diagnosis, with time as the scale. The specific steps are as follows:
[0015] Step 1: Obtain the corresponding charging serial number based on the charging order data of the charging device, and extract relevant timing data from the charging message data based on the serial number. The data includes output voltage and output current.
[0016] Step 2: Considering the differences in charging voltage and current requirements among different brands of electric vehicles, to enhance the comparability between feature sequences and improve the trend representation ability of voltage and current curves, the voltage and current sequences are normalized separately. The specific formulas are as follows:
[0017]
[0018] In the formula, X(t) represents the original voltage or current value at a certain time t; min(X) and max(X) represent the minimum and maximum values in the sequence, respectively; X norm (t) represents the normalized value;
[0019] Step 3: Plot the current and voltage curves of the normalized time-series data on a time scale to construct an image dataset;
[0020] Preferably, feature extraction is performed on the image dataset to obtain multi-level visual feature representations. The specific steps are as follows:
[0021] Step 1: Standardize the original image data I, including pixel normalization and resizing, to meet the input requirements of the ConvNeXt V2 network. The specific formula is as follows:
[0022]
[0023] In the formula, F0 represents the normalized initial data; u I σ represents the channel mean. I Indicates the standard deviation of the channel;
[0024] Step 2: Input the feature representation F0 into the ConvNeXt V2 backbone network. The network consists of several stacked ConvNeXt V2 Blocks, with downsampling convolution operations connected between each block to extract spatial-semantic features at different levels. The specific formula is shown below:
[0025] F i =B i (Down i (F i-1 ))
[0026] In the formula, B i (·) represents the operation of the i-th block layer; Down i (·) indicates the downsampling module; F i F represents the multi-scale feature output of the i-th layer; i-1 This represents the feature input of the i-th layer;
[0027] Step 3: Each downsampling module includes layer normalization and convolution operations, as shown in the following formulas:
[0028]
[0029] In the formula, LN(·) represents the layer normalization operation, and Conv(·) represents the convolution operation; k i Indicates the kernel size in the downsampling module; l i F′ represents the stride of the convolution operation in the downsampling module. i-1 This represents the input features after sampling;
[0030] Step 4: Within each block, depthwise separable convolutions are first used to spatially model the input features, as shown in the following formula:
[0031] F′=F*K DW
[0032] In the formula, F represents the input feature map; K DW This indicates an independent convolution kernel for each channel; * indicates a channel-wise convolution operation; F′ indicates the output feature of a depthwise separable convolution.
[0033] Step 5: Transform the channel dimensions of the data features using two layers of point convolution, and introduce an activation function for nonlinear modeling. The specific formula is shown below:
[0034]
[0035] In the formula, This represents a pointwise convolution operation; GELU(·) represents the non-linear activation function GELU; F″ represents the output feature;
[0036] Step 6: In the block, the Global Response Normalization (GRN) module is used to globally normalize the channel responses, enhancing the generality and expressive power of the features. First, the L2 norm of each channel is calculated along the spatial dimension for the input feature F″, as shown in the following formula:
[0037]
[0038] In the formula, G b,c This represents the response intensity of the b-th sample and the c-th channel; H and W represent the height and width dimensions of the image data, respectively.
[0039] To eliminate scale differences, the response intensity G b,c The mean-standard deviation normalization is performed using the following formula:
[0040]
[0041] In the formula, μ b σ represents the mean of the responses of all channels for the b-th sample; b represents the standard deviation of the response of all channels for the b-th sample; C represents the number of channels in the image data; ε represents a local constant to prevent division by zero. This represents the normalized channel response strength;
[0042] normalization results As a global enhancement factor, it is applied to feature F″ and residual connections are performed. The specific formula is as follows:
[0043]
[0044] In the formula, F GRN Indicates the output characteristics of the GRN module; for Matrix representation; γ b The learnable scaling factor representing the channel scale; β b Indicates the channel bias coefficient;
[0045] Step 7: Perform residual fusion between the output features of the GRN module and the original input features to form the final Block output. The specific formula is shown below:
[0046] F out =F ori +λ b ·F GRN
[0047] In the formula, F out This represents the output characteristics of the Block module; λ b F represents the learnable scaling factor; ori This indicates the initial input data for the Block module;
[0048] Finally, the multi-level features output by the ConvNeXt V2 model are used for subsequent fault diagnosis of charging equipment.
[0049] Preferably, the training of a charging equipment fault diagnosis model based on time series data representation involves the following steps:
[0050] Step 1: Design an optimization algorithm to optimize the hyperparameters of the ConvNeXt V2 model. The initial population of the optimization algorithm consists of N individuals, and the initialization formula is:
[0051]
[0052] In the formula, This represents the initial position of the i-th individual in the d-th dimension; Let r represent the lower and upper bounds of the d-th dimension, respectively; s ~U(0,1), representing a random variable that follows a uniform distribution; X i (0) represents the initial position of the i-th individual; D represents the dimension of the individual's position;
[0053] Step 2: The optimization algorithm employs a dual-population mechanism, dividing the population into two subpopulations. The first subpopulation simulates the evaporation of liquid water and the Brownian motion of water vapor to traverse the feasible region. When an individual exists in the form of water vapor, it traverses the solution space according to Brownian motion, and the Brownian motion position update formula is:
[0054] Elite(t)∈[P(t),X second (t),X third (t),X c (t)]
[0055]
[0056] In the formula, X i (t+1) represents the position of the i-th individual at time t+1; X i Elite(t) represents the position of the i-th individual at time t; Elite(t) represents a random variable, from P(t), X second (t), X third (t) and X c (t) is randomly selected from four variables; BM i X(t) represents the snow melt rate of the i-th individual at the optimal position; P(t) represents the optimal position of the individual at time t; second (t) represents the suboptimal position of an individual at time t; X third (t) represents the third-best position of an individual at time t; X c (t) represents the average position of an individual at time t; θ1 represents a random number within the range [0,1]; Z i (t) represents the i-th solution in the population; This represents the average value of the solutions within the population. This represents the product operation; N represents the number of individuals in the population.
[0057] Step 3: The second population simulates the snow melting process to explore the global optimum near the local optimum. When individuals exist in the form of snow, the snow melting process is simulated to convert snow into liquid water, as shown in the following formula:
[0058] M = DDF × (T - T1)
[0059] In the formula, M represents the snow ablation rate; DDF represents the snow ablation coefficient, which ranges from [0.35, 0.6]; T represents the daily average temperature; and T1 represents the base temperature.
[0060] The trend of DDF changing over time is as follows:
[0061]
[0062] In the formula, e represents the natural constant; t s Indicates the current time; t max Indicates the maximum time of day;
[0063] The location is updated by simulating the snow melting process, as shown in the following formula:
[0064]
[0065] In the formula, θ2 represents a random number in the range [-1, 1].
[0066] Step 4: Train and fit the extracted features using the improved Transformer model to construct a charging equipment fault diagnosis model. The improved Transformer model consists of four Stages, each containing several Block modules, forming a pyramid structure. Adjacent patches are merged between each Stage, as shown in the following formula:
[0067] X merged =Linear(Concat(X) 00 ,X 01 ,X 10 ,X 11 ))
[0068] In the formula, X merged Represents the data characteristics after downsampling; Linear(·) represents a linear operation; Concat(·) represents a concatenation operation; X 00 X 01 X 10 X 11 This indicates four adjacent patches;
[0069] Step 5: Each Block contains two sub-modules: window multi-head self-attention and sliding window multi-head self-attention. The specific formula is shown below:
[0070] Output1 = X t +W-MSA(LN(X t ))
[0071] Output2=Output1+MLP(LN(Output1))
[0072] Output3=Output2+SW-MSA(LN(Output2))
[0073] Output4=Output3+MLP(LN(Output3))
[0074] In the formula, X t Input features are represented by LN(·); layer normalization is represented by W-MSA(·); multi-head self-attention mechanism is represented by MLP(·); multilayer perceptron operation is represented by SW-MSA(·); Output features are represented by LN(·). i Indicates intermediate output features;
[0075] Step 6: Multi-head Self-Attention in Windows. The input is divided into windows of fixed size, and multi-head self-attention calculation is performed within each window. The specific formula is shown below:
[0076]
[0077] MultiHead(W Q W K W V )=Concat(head1,head2,...,head h W O
[0078] head i =Attention(W Q W i Q W K W i K W V W i V )
[0079] In the formula, W Q W K W V These represent the query, key, and value matrices, respectively; d m B represents the attention head dimension; B represents the relative position bias; Attention(·) represents the self-attention operation; MultiHead(·) represents the multi-head attention operation; head i W represents the output feature of the i-th head; O W represents the output projection matrix. i Q W i K W i VThis represents the linear projection of each head; Softmax(·) represents the Softmax activation function;
[0080] To enhance information interaction between windows, sliding window multi-head self-attention slides the attention window by half the window size to form an interlaced window layout, and the subsequent calculation operation is the same as that of window multi-head self-attention.
[0081] Step 7: Pass the output of the improved Transformer model through LayerNorm, average pooling, fully connected, and Softmax layers to obtain the fault diagnosis results of the charging device. The specific formula is shown below:
[0082] Y=Softmax(Linear(Pooling(LN(Z T ))))
[0083] In the formula, Y represents the tag corresponding to the fault of the charging device; Pooling(·) represents the average pooling layer operation; Z T This indicates the output features of the improved Transformer model.
[0084] Preferably, the fault diagnosis model for charging equipment is optimized through inference using lightweight technology. The specific steps are as follows:
[0085] Step 1: In the fourth stage of the improved Transformer model, a sparse token transformation module is introduced to reduce the interference of redundant features on fault detection. Furthermore, the Layer Normalization (LN) structure in the fourth stage of the model is replaced with a Batch Channel Normalization (BCN) structure, constructing a B-SparTa module with sparse representation and normalization enhancement capabilities. This improves the parameter lightweighting of the charging equipment fault diagnosis model and enhances the model's inference efficiency.
[0086] Step 2: The B-SparTa module first receives input features from the third stage and evaluates the importance of each token using a token scoring function, as shown in the following formula:
[0087] s = Tanh(X) token ·w s +b s )
[0088] In the formula, s represents the token score; Tanh(·) represents the Tanh activation function; X token This represents the input token sequence; w s b represents a learnable weight vector; sIndicates relative bias;
[0089] Step 3: Based on the scoring results, the module selects the top K highest-scoring modules. s A sequence of tokens constitutes a sparse token set X. s This preserves local features containing key fault information, as shown in the following formula:
[0090] X s =Top(X G ,K s )
[0091] In the formula, Top(·) represents the filtering operation; X G This represents the set of all token sequences.
[0092] The subsequent model only applies to sparse sets X s Self-attention computation is performed on the token sequence in the data;
[0093] Step 4: After the input data features pass through the sparse token transformation module, sparse features that retain important facial expression information are extracted, and then normalized using BCN. First, the mean μ1 and variance of the batch dimension are calculated. The calculation formula is as follows:
[0094]
[0095] In the formula, N b Indicates the number of batches of input data; z i This represents the input data of the BCN layer;
[0096] Then, the mean μ2 and variance of the input data are calculated along the channel dimension. The calculation formula is as follows:
[0097]
[0098] In the formula, C b Indicates the number of channels for the input data;
[0099] Using the calculated data and variance, the input data is normalized as shown in the following formula:
[0100]
[0101] In the formula, This represents the normalized data; ε represents a local constant to prevent division by zero.
[0102] Step 5: The BCN layer introduces an additional learnable parameter η. cTo adaptively balance the normalized output along the channel and batch dimensions, the calculation formula is as follows:
[0103]
[0104] In the formula, Represents the normalized characteristic after equilibrium; η c This represents a learnable parameter with a range of [-1, 1].
[0105] Introducing learnable transformation parameter β c γ c The normalized features are scaled and shifted to obtain the final output features of the BCN layer. The calculation formula is shown below:
[0106]
[0107] In the formula, y c This represents the output characteristics of the BCN layer.
[0108] Preferably, privacy protection is implemented for the charging equipment fault diagnosis model using a federated learning framework. The specific steps are as follows:
[0109] Step 1: Distributed training of the model based on a federated learning framework. During the model training phase, multiple charging devices act as independent clients within the federated learning framework, each using locally stored charging operation data to train the model locally and generate local model parameters. Let the k-th... c Each charging device has a local dataset D. k The global model parameter is o u Then its local training update process in the u-th round can be represented as:
[0110]
[0111] In the formula, o u Represents the global model parameters in the u-th round; Indicates client k c The local model parameters after the u-th round update; η u Indicates the local learning rate; The gradient of the loss function with respect to the model parameters is represented by N; Loss represents the function N. p Indicates the number of fault tags; Y represents the probability of outputting the i-th fault label; i ∈{0,1} indicates whether the charging device has a type i fault;
[0112] Step 2: After local training is complete, each client updates its local model parameters. The data is uploaded to the cloud server, which acts as a federated coordination node. The cloud server then weights and aggregates the model parameters based on the proportion of data volume from each client to obtain new global model parameters. The specific formula is shown below:
[0113]
[0114] In the formula, o u+1 K represents the aggregated global model parameters. c The total number of clients is represented by n; n represents the total number of samples from all clients. i This represents the number of local samples for client i.
[0115] Step 3: Aggregated global model parameters o u+1 It is distributed to each client for the next round of local training and iterative updates until the model converges.
[0116] Step 4: To prevent model parameters from being leaked during transmission, an encryption algorithm is used to encrypt the model parameters. All variables in the encryption algorithm are in the polynomial model ring R. q The definition in the standard is that all calculations are powers modulo q, and the definition of the modular ring is as follows:
[0117]
[0118] In the formula, J represents the polynomial degree of the ring, usually a power of 2; q represents a large modulus used for encryption operations. Represents the ring of integers modulo q; V represents the polynomial variable;
[0119] Step 5: The private key sk = (1, s) is a small polynomial randomly sampled from the polynomial ring, generally containing only coefficients {-1, 0, 1}, as shown below:
[0120]
[0121] In the formula, D key The expression represents a ternary distribution; s represents a small-coefficient polynomial with dimension J.
[0122] In R q Randomly select an element 'a' from the error distribution χ. e Randomly select e. Set the public key pk = (b, a), where b is calculated as follows:
[0123] b = -as + e
[0124] Step 6: Input plaintext as a complex vector v = (v1, v2, ..., v n ), and use an encoder to map it to a polynomial space:
[0125] m = Encode(v) ∈ R q
[0126] In the formula, m represents the encoded plaintext; Encode(·) represents the encoder.
[0127] To improve accuracy, a scaling factor ξ is used to scale it to an integer pt, ensuring that the encryption result retains sufficient precision even with errors. The specific formula is shown below:
[0128] pt=ξ·m
[0129] Step 7: For the model parameter plaintext pt∈R q From χ e Randomly select numbers e0 and e1 in R. q Select a random number r, and the ciphertext calculation formula is as follows:
[0130] ct=(ct0,ct1)=(b·r+e0+pt,a·r+e1)
[0131] In the formula, ct represents the ciphertext pair after the plaintext is encrypted;
[0132] Step 8: After receiving the ciphertext, the cloud server performs the addition operation directly in the ciphertext state. For two ciphertexts... The addition formula is as follows:
[0133]
[0134] In the formula, ct add The ciphertext representation of the result of adding two corresponding plaintexts;
[0135] The two ciphertext multiplication formulas are shown below:
[0136]
[0137] At this point, we have three ciphertext terms, which need to be relinearized to reduce them to two terms:
[0138] Relin(ct0′,ct1′,ct2′)=(ct0″,ct1″)
[0139] Step 9: Decrypt the ciphertext pair ct = (ct0, ct1) using the private key sk = (1, s), as shown in the following formula:
[0140]
[0141] In the formula, This represents the decrypted plaintext.
[0142] Because noise is introduced during the ciphertext calculation process, the resulting text is still an amplified approximation of the plaintext. The plaintext is then restored and decoded using the following formulas:
[0143]
[0144] In the formula, This represents the original complex vector after decoding; Decode(·) represents the decoder.
[0145] Preferably, fault diagnosis is performed on the time-series data of the current operating status of the charging equipment based on the optimized and trained fault diagnosis model. The specific steps are as follows:
[0146] Step 1: Preprocess the time-series data of the current operating status of the charging device to obtain image dataset E;
[0147] Step 2: Use the trained model to diagnose faults in the charging equipment. The specific formula is shown below:
[0148] Y = Diagnosis (E)
[0149] In the formula, Y represents the label corresponding to the fault of the charging device; Diagnosis(·) represents the fault diagnosis model.
[0150] A fault diagnosis system for charging equipment that considers time series data representation and privacy protection is implemented as follows:
[0151] The data acquisition and preprocessing module is used to acquire charging order data and message data of the charging equipment in the charging station, and to construct an image dataset based on the current and voltage time series data in the data;
[0152] The feature extraction module is used to extract features from the image dataset based on the ConvNeXt V2 model to obtain multi-level visual feature representations.
[0153] The parameter optimization module is used to optimize and adjust the parameters of the ConvNeXt V2 model based on the optimization algorithm.
[0154] The model training module is used to train the lightweight fault diagnosis model and continuously optimize the model parameters using extracted image features.
[0155] A privacy protection module is used to protect the privacy of the fault diagnosis model based on a federated learning framework and encryption algorithms.
[0156] The fault diagnosis module is used to diagnose faults in the current state of the charging equipment based on the fault diagnosis model.
[0157] A computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the described method for fault diagnosis of charging devices that takes into account time-series data representation and privacy protection.
[0158] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the charging device fault diagnosis method for time-series data representation and privacy protection.
[0159] In summary, compared with the prior art, the above-described technical solutions conceived by this invention can achieve the following beneficial effects:
[0160] Compared with existing technologies, the charging equipment fault diagnosis method and system of this invention, which considers time-series data representation and privacy protection, constructs an image dataset for charging equipment fault diagnosis by acquiring charging order data and message data. Based on the ConvNeXt V2 model, multi-level feature extraction is performed on the image dataset to obtain richer and more discriminative visual feature representations. Subsequently, based on an improved Transformer model, deep modeling and fault identification are performed on the extracted features to achieve accurate diagnosis of charging equipment malfunctions. This effectively improves the accuracy and real-time performance of fault detection, providing strong technical support for ensuring the safety of electric vehicle charging. It also provides reliable data support and decision-making basis for the intelligent operation and efficient maintenance of charging stations.
[0161] The beneficial effects of the present invention also include:
[0162] This invention designs and constructs a lightweight B-SparTa module, which effectively reduces the model's parameter size and computational complexity by introducing a sparse token transformation module. Simultaneously, this module retains the model's high sensitivity to key fault features, ensuring diagnostic accuracy while reducing computational burden. The invention improves the module using a BCN layer to dynamically balance features at different scales, effectively mitigating the feature imbalance problem that may occur during multi-scale information fusion. This allows the subsequent multi-head self-attention mechanism to more fully capture local details and global correlations in the fault curve, preventing high activation values in specific regions from causing gradient instability or information loss leading to misjudgments.
[0163] The beneficial effects of the present invention also include:
[0164] This invention employs a federated learning architecture. Without uploading raw data, it achieves privacy protection for charging data through local model training and global model aggregation, ensuring local data privacy and avoiding the information leakage risks associated with centralized data processing. Simultaneously, homomorphic encryption algorithms are used to encrypt model parameters transmitted during federated communication, further enhancing the system's security capabilities and effectively preventing malicious nodes from performing reverse engineering on the model or data. Attached Figure Description
[0165] Figure 1 This is a flowchart of a charging device fault diagnosis method that considers time series data representation and privacy protection, provided by an embodiment of the present invention.
[0166] Figure 2 This invention provides a charging equipment fault diagnosis system that considers time series data representation and privacy protection.
[0167] Figure 3 This is a flowchart of the B-SparTa module architecture provided in an embodiment of the present invention;
[0168] Figure 4 This is a fault example diagram of the charging device provided in an embodiment of the present invention. Detailed Implementation
[0169] 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.
[0170] Example 1: As Figure 1 The illustration shows a charging device fault diagnosis method that considers time series data representation and privacy protection, according to an example of the present invention. The method includes the following steps:
[0171] Step 1: Collect charging order data and message data of the charging equipment, and draw an image dataset for charging equipment fault diagnosis based on time.
[0172] Step 2: Extract features from the image dataset to obtain multi-level visual feature representations;
[0173] Step 3: Train a charging equipment fault diagnosis model based on time series data representation;
[0174] Step 4: Optimize the charging equipment fault diagnosis model using lightweight technology;
[0175] Step 5: Protect the privacy of the charging equipment fault diagnosis model by combining the federated learning framework;
[0176] Step 6: Based on the optimized and trained fault diagnosis model, perform fault diagnosis on the time-series data of the current operating status of the charging equipment.
[0177] Preferably, in step S1, the charging order data and message data of the collected charging equipment are used to create an image dataset for charging equipment fault diagnosis, with time as the scale. The process is as follows:
[0178] S1-1: Obtain the corresponding charging serial number based on the charging order data of the charging device, and extract relevant timing data from the charging message data based on the serial number. The data includes output voltage and output current.
[0179] S1-2: Considering the differences in charging voltage and current requirements among different brands of electric vehicles, to enhance the comparability between feature sequences and improve the trend expression ability of voltage and current curves, the voltage and current sequences are normalized separately, as shown in the following formulas:
[0180]
[0181] In the formula, X(t) represents the original voltage or current value at a certain time t; min(X) and max(X) represent the minimum and maximum values in the sequence, respectively; X norm (t) represents the normalized value;
[0182] S1-3: Plot the current and voltage curves of the normalized time-series data on a time scale to construct an image dataset;
[0183] Preferably, in step S2, feature extraction is performed on the image dataset to obtain multi-level visual feature representations. The specific steps are as follows:
[0184] S2-1: Standardize the original image data I, including pixel normalization and resizing, to meet the input requirements of the ConvNeXt V2 network. The specific formula is as follows:
[0185]
[0186] In the formula, F0 represents the normalized initial data; u I σ represents the channel mean. I Indicates the standard deviation of the channel;
[0187] S2-2: Input the feature representation F0 into the ConvNeXt V2 backbone network. The network consists of several stacked ConvNeXt V2 Blocks, with downsampling convolution operations connected between each block to extract spatial-semantic features at different levels. The specific formula is shown below:
[0188] F i =B i (Down i (F i-1 ))
[0189] In the formula, B i (·) represents the operation of the i-th block layer; Down i (·) indicates the downsampling module; F i F represents the multi-scale feature output of the i-th layer; i-1 This represents the feature input of the i-th layer;
[0190] S2-3: Each downsampling module includes layer normalization and convolution operations, as shown in the following formulas:
[0191]
[0192] In the formula, LN(·) represents the layer normalization operation, and Conv(·) represents the convolution operation; k i Indicates the kernel size in the downsampling module; l i F represents the stride of the convolution operation in the downsampling module. i ′ -1 This represents the input features after sampling;
[0193] S2-4: In each block, depthwise separable convolutions are first used to spatially model the input features, as shown in the following formula:
[0194] F′=F*K DW
[0195] In the formula, F represents the input feature map; K DW This indicates an independent convolution kernel for each channel; * indicates a channel-wise convolution operation; F′ indicates the output feature of a depthwise separable convolution.
[0196] S2-5: The data features are transformed through two layers of point convolution to achieve channel dimension transformation, and an activation function is introduced for nonlinear modeling. The specific formula is shown below:
[0197]
[0198] In the formula, This represents a pointwise convolution operation; GELU(·) represents the non-linear activation function GELU; F″ represents the output feature;
[0199] S2-6: The Global Response Normalization (GRN) module is used in the block to perform global normalization on the channel responses, enhancing the generality and expressive power of the features. First, the L2 norm of each channel is calculated along the spatial dimension for the input feature F″, as shown in the following formula:
[0200]
[0201] In the formula, G b,c This represents the response intensity of the b-th sample and the c-th channel; H and W represent the height and width dimensions of the image data, respectively.
[0202] To eliminate scale differences, the response intensity G b,c The mean-standard deviation normalization is performed using the following formula:
[0203]
[0204] In the formula, μ b σ represents the mean of the responses of all channels for the b-th sample; b represents the standard deviation of the response of all channels for the b-th sample; C represents the number of channels in the image data; ε represents a local constant to prevent division by zero. This represents the normalized channel response strength;
[0205] normalization results As a global enhancement factor, it is applied to feature F″ and residual connections are performed. The specific formula is as follows:
[0206]
[0207] In the formula, F GRN Indicates the output characteristics of the GRN module; for Matrix representation; γ b The learnable scaling factor representing the channel scale; β b Indicates the channel bias coefficient;
[0208] S2-7: Residual fusion is performed between the output features of the GRN module and the original input features to form the final Block output. The specific formula is shown below:
[0209] F out =F ori +λ b ·F GRN
[0210] In the formula, F out This represents the output characteristics of the Block module; λb F represents the learnable scaling factor; ori This indicates the initial input data for the Block module;
[0211] Finally, the multi-level features output by the ConvNeXt V2 model are used for subsequent fault diagnosis of charging equipment.
[0212] Preferably, in step S3, the fault diagnosis model for charging equipment based on time series data representation is trained, and the specific steps are as follows:
[0213] S3-1: Design an optimization algorithm to optimize the hyperparameters of the ConvNeXt V2 model. The initial population of the optimization algorithm consists of N individuals, and the initialization formula is:
[0214]
[0215] In the formula, This represents the initial position of the i-th individual in the d-th dimension; Let r represent the lower and upper bounds of the d-th dimension, respectively; s ~U(0,1), representing a random variable that follows a uniform distribution; X i (0) represents the initial position of the i-th individual; D represents the dimension of the individual's position;
[0216] S3-2: The optimization algorithm employs a dual-population mechanism, dividing the population into two subpopulations. The first subpopulation simulates the evaporation of liquid water and the Brownian motion of water vapor to traverse the feasible region. When an individual exists in the form of water vapor, it traverses the solution space according to Brownian motion, and the Brownian motion position update formula is:
[0217] Elite(t)∈[P(t),X second (t),X third (t),X c (t)]
[0218]
[0219] In the formula, X i (t+1) represents the position of the i-th individual at time t+1; X i Elite(t) represents the position of the i-th individual at time t; Elite(t) represents a random variable, from P(t), X second (t), X third (t) and X c (t) is randomly selected from four variables; BM iX(t) represents the snow melt rate of the i-th individual at the optimal position; P(t) represents the optimal position of the individual at time t; second (t) represents the suboptimal position of an individual at time t; X third (t) represents the third-best position of an individual at time t; X c (t) represents the average position of an individual at time t; θ1 represents a random number within the range [0,1]; Z i (t) represents the i-th solution in the population; This represents the average value of the solutions within the population. This represents the product operation; N represents the number of individuals in the population.
[0220] S3-3: The second population simulates the snow melting process to explore the global optimum near the local optimum. When individuals exist in the form of snow, the snow melting process is simulated to convert snow into liquid water, as shown in the following formula:
[0221] M = DDF × (T - T1)
[0222] In the formula, M represents the snow ablation rate; DDF represents the snow ablation coefficient, which ranges from [0.35, 0.6]; T represents the daily average temperature; and T1 represents the base temperature.
[0223] The trend of DDF changing over time is as follows:
[0224]
[0225] In the formula, e represents the natural constant; t s Indicates the current time; t max Indicates the maximum time of day;
[0226] The location is updated by simulating the snow melting process, as shown in the following formula:
[0227]
[0228] In the formula, θ2 represents a random number in the range [-1, 1].
[0229] S3-4: Train and fit the extracted features using the improved Transformer model to construct a fault diagnosis model for charging equipment. The improved Transformer model consists of four stages, each containing several block modules, forming a pyramid structure. Adjacent patches are merged between each stage, as shown in the following formula:
[0230] X merged =Linear(Concat(X) 00 ,X 01 ,X10 ,X 11 ))
[0231] In the formula, X merged Represents the data characteristics after downsampling; Linear(·) represents a linear operation; Concat(·) represents a concatenation operation; X 00 X 01 X 10 X 11 This indicates four adjacent patches;
[0232] S3-5: Each Block contains two sub-modules: window multi-head self-attention and sliding window multi-head self-attention. The specific formulas are shown below:
[0233] Output1 = X t +W-MSA(LN(X t ))
[0234] Output2=Output1+MLP(LN(Output1))
[0235] Output3=Output2+SW-MSA(LN(Output2))
[0236] Output4=Output3+MLP(LN(Output3))
[0237] In the formula, X t Input features are represented by LN(·); layer normalization is represented by W-MSA(·); multi-head self-attention mechanism is represented by MLP(·); multilayer perceptron operation is represented by SW-MSA(·); Output features are represented by LN(·). i Indicates intermediate output features;
[0238] S3-6: Windowed multi-head self-attention divides the input into fixed-size windows, and performs multi-head self-attention calculations within each window. The specific formula is shown below:
[0239]
[0240] MultiHead(W Q W K W V )=Concat(head1,head2,...,head h W O
[0241] head i =Attention(W Q W iQ W K W i K W V W i V )
[0242] In the formula, W Q W K W V These represent the query, key, and value matrices, respectively; d m B represents the attention head dimension; B represents the relative position bias; Attention(·) represents the self-attention operation; MultiHead(·) represents the multi-head attention operation; head i W represents the output feature of the i-th head; O W represents the output projection matrix. i Q W i K W i V This represents the linear projection of each head; Softmax(·) represents the Softmax activation function;
[0243] To enhance information interaction between windows, sliding window multi-head self-attention slides the attention window by half the window size to form an interlaced window layout, and the subsequent calculation operation is the same as that of window multi-head self-attention.
[0244] S3-7: The output of the improved Transformer model is passed through LayerNorm, average pooling, fully connected, and Softmax layers to obtain the fault diagnosis results of the charging device. The specific formula is shown below:
[0245] Y=Softmax(Linear(Pooling(LN(Z T ))))
[0246] In the formula, Y represents the tag corresponding to the fault of the charging device; Pooling(·) represents the average pooling layer operation; Z T This indicates the output features of the improved Transformer model.
[0247] Preferably, in step S4, the charging equipment fault diagnosis model is optimized using lightweight technology. The specific steps are as follows:
[0248] S4-1: A sparse token transformation module is introduced in the fourth stage of the improved Transformer model to reduce the interference of redundant features on fault detection. Furthermore, the Layer Normalization (LN) structure in the fourth stage is replaced with a Batch Channel Normalization (BCN) structure, constructing a B-SparTa module with sparse representation and normalization enhancement capabilities. This improves the parameter lightweighting of the charging equipment fault diagnosis model and enhances its inference efficiency.
[0249] S4-2: The B-SparTa module first receives input features from the third stage, and evaluates the importance of each token using a token scoring function, as shown in the following formula:
[0250] s = Tanh(X) token ·w s +b s )
[0251] In the formula, s represents the token score; Tanh(·) represents the Tanh activation function; X token This represents the input token sequence; w s b represents a learnable weight vector; s Indicates relative bias;
[0252] S4-3: Based on the scoring results, the module selects the top K highest-scoring modules. s A sequence of tokens constitutes a sparse token set X. s This preserves local features containing key fault information, as shown in the following formula:
[0253] X s =Top(X G ,K s )
[0254] In the formula, Top(·) represents the filtering operation; X G This represents the set of all token sequences.
[0255] The subsequent model only applies to sparse sets X s Self-attention computation is performed on the token sequence in the data;
[0256] S4-4: After the input data features pass through the sparse token transformation module, sparse features retaining important facial expression information are extracted, and then normalized using BCN. First, the mean μ1 and variance of the batch dimension are calculated. The calculation formula is as follows:
[0257]
[0258]
[0259] In the formula, N b Indicates the number of batches of input data; z i This represents the input data of the BCN layer;
[0260] Then, the mean μ2 and variance of the input data are calculated along the channel dimension. The calculation formula is as follows:
[0261]
[0262] In the formula, C b Indicates the number of channels for the input data;
[0263] Using the calculated data and variance, the input data is normalized as shown in the following formula:
[0264]
[0265] In the formula, This represents the normalized data; ε represents a local constant to prevent division by zero.
[0266] S4-5: The BCN layer introduces an additional learnable parameter η c To adaptively balance the normalized output along the channel and batch dimensions, the calculation formula is as follows:
[0267]
[0268] In the formula, Represents the normalized characteristic after equilibrium; η c This represents a learnable parameter with a range of [-1, 1].
[0269] Introducing learnable transformation parameter β c γ c The normalized features are scaled and shifted to obtain the final output features of the BCN layer. The calculation formula is shown below:
[0270]
[0271] In the formula, y c This represents the output characteristics of the BCN layer.
[0272] Preferably, in step S5, privacy protection is implemented for the charging device fault diagnosis model using a federated learning framework. The specific steps are as follows:
[0273] S5-1: Distributed training of the model is performed based on a federated learning framework. During the model training phase, multiple charging devices act as independent clients under the federated learning framework, each using locally stored charging operation data to train the model locally and generate local model parameters. Let the k-th... c Each charging device has a local dataset D. k The global model parameter is o u Then its local training update process in the u-th round can be represented as:
[0274]
[0275] In the formula, o u Represents the global model parameters in the u-th round; Indicates client k c The local model parameters after the u-th round update; η u Indicates the local learning rate; The gradient of the loss function with respect to the model parameters is represented by N; Loss represents the function N. p Indicates the number of fault tags; Y represents the probability of outputting the i-th fault label; i ∈{0,1} indicates whether the charging device has a type i fault;
[0276] S5-2: After local training is complete, each client updates its local model parameters. The data is uploaded to the cloud server, which acts as a federated coordination node. The cloud server then weights and aggregates the model parameters based on the proportion of data volume from each client to obtain new global model parameters. The specific formula is shown below:
[0277]
[0278] In the formula, o u+1 K represents the aggregated global model parameters. c The total number of clients is represented by n; n represents the total number of samples from all clients. i This represents the number of local samples for client i.
[0279] S5-3: Aggregated global model parameters o u+1 It is distributed to each client for the next round of local training and iterative updates until the model converges.
[0280] S5-4: To prevent model parameter leakage during transmission, an encryption algorithm is used to encrypt the model parameters. All variables in the encryption algorithm are in the polynomial model ring R. q The definition in the standard is that all calculations are powers modulo q, and the definition of the modular ring is as follows:
[0281]
[0282] In the formula, J represents the polynomial degree of the ring, usually a power of 2; q represents a large modulus used for encryption operations. Represents the ring of integers modulo q; V represents the polynomial variable;
[0283] S5-5: The private key sk = (1, s) is a small polynomial randomly sampled from the polynomial ring, generally containing only coefficients {-1, 0, 1}, as shown below:
[0284]
[0285] In the formula, D key The expression represents a ternary distribution; s represents a small-coefficient polynomial with dimension J.
[0286] In R q Randomly select an element 'a' from the error distribution χ. e Randomly select e. Set the public key pk = (b, a), where b is calculated as follows:
[0287] b = -as + e
[0288] S5-6: Input plaintext is a complex vector v = (v1, v2, ..., v...). n ), and use an encoder to map it to a polynomial space:
[0289] m = Encode(v) ∈ R q
[0290] In the formula, m represents the encoded plaintext; Encode(·) represents the encoder.
[0291] To improve accuracy, a scaling factor ξ is used to scale it to an integer pt, ensuring that the encryption result retains sufficient precision even with errors. The specific formula is shown below:
[0292] pt=ξ·m
[0293] S5-7: For model parameters plaintext pt∈R q From χ e Randomly select numbers e0 and e1 in R. q Select a random number r, and the ciphertext calculation formula is as follows:
[0294] ct=(ct0,ct1)=(b·r+e0+pt,a·r+e1)
[0295] In the formula, ct represents the ciphertext pair after the plaintext is encrypted;
[0296] S5-8: After receiving the ciphertext, the cloud server performs addition operations directly in the ciphertext state. For two ciphertexts... The addition formula is as follows:
[0297]
[0298] In the formula, ct add The ciphertext representation of the result of adding two corresponding plaintexts;
[0299] The two ciphertext multiplication formulas are shown below:
[0300]
[0301] At this point, we have three ciphertext terms, which need to be relinearized to reduce them to two terms:
[0302] Relin(ct0′,ct1′,ct2′)=(ct0″,ct1″)S5-9: Decrypt the ciphertext pair ct=(ct0,ct1) using the private key sk=(1,s), as shown in the following formula:
[0303]
[0304] In the formula, This represents the decrypted plaintext.
[0305] Because noise is introduced during the ciphertext calculation process, the resulting text is still an amplified approximation of the plaintext. The plaintext is then restored and decoded using the following formulas:
[0306]
[0307] In the formula, This represents the original complex vector after decoding; Decode(·) represents the decoder.
[0308] Preferably, in step S6, fault diagnosis is performed on the time-series data of the current operating status of the charging equipment based on the optimized and trained fault diagnosis model. The specific steps are as follows:
[0309] S6-1: Preprocess the time-series data of the current operating status of the charging equipment to obtain the image dataset E;
[0310] S6-2: The trained model is used to diagnose faults in charging equipment. The specific formula is shown below:
[0311] Y = Diagnosis (E)
[0312] In the formula, Y represents the label corresponding to the fault of the charging device; Diagnosis(·) represents the fault diagnosis model.
[0313] Example 2: Figure 2 As shown in the figure, an embodiment of the present invention provides a charging equipment fault diagnosis system that considers time series data representation and privacy protection. The system includes the following modules:
[0314] The data acquisition and preprocessing module is used to acquire charging order data and message data of the charging equipment in the charging station, and to construct an image dataset based on the current and voltage time series data in the data;
[0315] The feature extraction module is used to extract features from the image dataset based on the ConvNeXt V2 model to obtain multi-level visual feature representations.
[0316] The parameter optimization module is used to optimize and adjust the parameters of the ConvNeXt V2 model based on the optimization algorithm.
[0317] The model training module is used to train the lightweight fault diagnosis model and continuously optimize the model parameters using extracted image features.
[0318] A privacy protection module is used to protect the privacy of the fault diagnosis model based on a federated learning framework and encryption algorithms.
[0319] The fault diagnosis module is used to diagnose faults in the current state of the charging equipment based on the fault diagnosis model.
[0320] The specific implementation methods of each module can be referred to the description of the above method embodiments, and the embodiments of the present invention will not be repeated.
[0321] Example 3: A computer-readable storage medium storing computer instructions that, when executed by a processor, implement the steps of the described method for fault diagnosis of charging devices based on consideration of time-series data representation and privacy protection.
[0322] Example 4: A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the charging device fault diagnosis method for time-series data representation and privacy protection.
[0323] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for fault diagnosis of charging equipment that considers time series data representation and privacy protection, characterized in that: The method includes the following steps: S1. Collect charging order data and message data of charging equipment, and draw an image dataset for charging equipment fault diagnosis based on time. S2. Perform feature extraction on the image dataset to obtain multi-level visual feature representation; S3. Train a charging equipment fault diagnosis model based on time series data representation; S4. Optimize the fault diagnosis model for charging equipment by combining lightweight technology; S5. Privacy protection is implemented for the fault diagnosis model of charging equipment by combining the federated learning framework. S6. Based on the optimized fault diagnosis model, perform fault diagnosis on the time-series data of the current operating status of the charging equipment.
2. The charging device fault diagnosis method considering time series data representation and privacy protection according to claim 1, step S1 includes: Step 1: Obtain the corresponding charging sequence number from the charging order data of the charging device, and extract relevant timing data from the charging message data based on this sequence number. The data includes output voltage and output current. Step 2: Considering the differences in charging voltage and current requirements among different brands of electric vehicles, to enhance the comparability between feature sequences and improve the trend representation ability of voltage and current curves, the voltage and current sequences are normalized separately. The specific formulas are as follows: In the formula, X(t) represents the original voltage or current value at a certain time t; min(X) and max(X) represent the minimum and maximum values in the sequence, respectively; X norm (t) represents the normalized value; Step 3: Plot the current and voltage curves of the normalized time series data on a time scale to construct an image dataset.
3. The charging device fault diagnosis method considering time series data representation and privacy protection according to claim 1, step S2 includes: Step 1: Standardize the original image data I, including pixel normalization and resizing, to meet the input requirements of the ConvNeXt V2 network. The specific formula is as follows: In the formula, F0 represents the normalized initial data; u I σ represents the channel mean. I Indicates the channel standard deviation; Step 2: Input the feature representation F0 into the ConvNeXt V2 backbone network. The network consists of several stacked ConvNeXt V2 Blocks, with downsampling convolution operations connected between each block to extract spatial-semantic features at different levels. The specific formula is shown below: F i =B i (Down i (F i-1 )) In the formula, B i (·) represents the operation of the i-th block layer; Down i (·) indicates the downsampling module; F i This represents the multi-scale feature output of the i-th layer; F i-1 This represents the feature input of the i-th layer; Step 3: Each downsampling module includes layer normalization and convolution operations, as shown in the following formulas: In the formula, LN(·) represents the layer normalization operation, and Conv(·) represents the convolution operation; k i Indicates the kernel size in the downsampling module; l i F′ represents the stride of the convolution operation in the downsampling module. i-1 This represents the input features after sampling; Step 4: Within each block, depthwise separable convolutions are first used to spatially model the input features, as shown in the following formula: F′=F*K DW In the formula, F represents the input feature map; K DW This indicates an independent convolution kernel for each channel; * indicates a channel-wise convolution operation; F′ indicates the output feature of a depthwise separable convolution. Step 5: Transform the channel dimensions of the data features using two layers of point convolution, and introduce an activation function for nonlinear modeling. The specific formula is shown below: In the formula, This represents a pointwise convolution operation; GELU(·) represents the non-linear activation function GELU; F″ represents the output feature; Step 6: In the block, the Global Response Normalization (GRN) module is used to perform global normalization on the channel responses, enhancing the generality and expressive power of the features. First, the L2 norm of each channel is calculated along the spatial dimension for the input feature F″, as shown in the following formula: In the formula, G b,c This represents the response intensity of the b-th sample and the c-th channel; H and W represent the height and width dimensions of the image data, respectively. To eliminate scale differences, the response intensity G b,c The mean-standard deviation normalization is performed using the following formula: In the formula, μ b σ represents the mean of the responses of all channels for the b-th sample; b represents the standard deviation of the response of all channels for the b-th sample; C represents the number of channels in the image data; ε represents a local constant to prevent division by zero. This represents the normalized channel response strength; normalization results As a global enhancement factor, it is applied to feature F″ and residual connections are performed. The specific formula is as follows: In the formula, F GRN Indicates the output characteristics of the GRN module; for Matrix representation; γ b The learnable scaling factor representing the channel scale; β b Indicates the channel bias coefficient; Step 7: Perform residual fusion between the output features of the GRN module and the original input features to form the final Block output. The specific formula is shown below: F out =F ori +λ b ·F GRN In the formula, F out This indicates the output characteristics of the Block module; λ b Indicates the learnable scaling factor; F ori This indicates the initial input data for the Block module; Finally, the multi-level features output by the ConvNeXt V2 model are used for subsequent fault diagnosis of charging equipment.
4. The charging device fault diagnosis method considering time series data representation and privacy protection according to claim 1, step S3 includes: Step 1: Design an optimization algorithm to optimize the hyperparameters of the ConvNeXt V2 model. The initial population of the optimization algorithm consists of N individuals, and the initialization formula is: In the formula, This represents the initial position of the i-th individual in the d-th dimension; Let r represent the lower and upper bounds of the d-th dimension, respectively; s ~U(0,1), representing a random variable that follows a uniform distribution; X i (0) represents the initial position of the i-th individual; D represents the dimension of the individual's position; Step 2: The optimization algorithm employs a dual-population mechanism, dividing the population into two subpopulations. The first subpopulation simulates the evaporation of liquid water and the Brownian motion of water vapor to traverse the feasible region. When an individual exists in the form of water vapor, it traverses the solution space according to Brownian motion. The Brownian motion position update formula is: Elite(t)∈[P(t),X second (t),X third (t),X c (t)] In the formula, X i (t+1) represents the position of the i-th individual at time t+1; X i Elite(t) represents the position of the i-th individual at time t; Elite(t) represents a random variable, from P(t), X second (t), X third (t) and X c (t) is randomly selected from four variables; BM i X(t) represents the snow melt rate of the i-th individual at the optimal position; P(t) represents the optimal position of the individual at time t; second (t) represents the suboptimal position of an individual at time t; X third (t) represents the third-best position of an individual at time t; X c (t) represents the average position of an individual at time t; θ1 represents a random number within the range [0,1]; Z i (t) represents the i-th solution in the population; This represents the average value of the solutions within the population. This represents the product operation; N represents the number of individuals in the population. Step 3: The second population simulates the snow melting process to explore the global optimum near the local optimum. When individuals exist in the form of snow, the snow melting process is used to simulate the conversion of snow into liquid water, as shown in the following formula: M = DDF × (T - T1) In the formula, M represents the snow ablation rate; DDF represents the snow ablation coefficient, which ranges from [0.35, 0.6]; T represents the daily average temperature; and T1 represents the base temperature. The trend of DDF changing over time is as follows: In the formula, e represents the natural constant; t s Indicates the current time; t max Indicates the maximum time of day; The location is updated by simulating the snow melting process, as shown in the following formula: In the formula, θ2 represents a random number in the range [-1, 1]. Step 4: Train and fit the extracted features using the improved Transformer model to construct a charging equipment fault diagnosis model. The improved Transformer model consists of four stages, each containing several block modules, forming a pyramid structure. Adjacent patches are merged between each stage, as shown in the following formula: X merged =Linear(Concat(X 00 ,X 01 ,X 10 ,X 11 )) In the formula, X merged Represents the data characteristics after downsampling; Linear(·) represents a linear operation; Concat(·) represents a concatenation operation; X 00 X 01 X 10 X 11 This indicates four adjacent patches; Step 5: Each Block contains two sub-modules: window multi-head self-attention and sliding window multi-head self-attention. The specific formula is shown below: Output1=X t +W-MSA(LN(X t )) Output2=Output1+MLP(LN(Output1)) Output3=Output2+SW-MSA(LN(Output2)) Output4=Output3+MLP(LN(Output3)) In the formula, X t LN(·) represents the input features; LN(·) represents the layer normalization operation; W-MSA(·) represents the multi-head self-attention mechanism of the window; MLP(·) represents the multilayer perceptron operation; SW-MSA(·) represents the dynamic window multi-head self-attention mechanism; Output i Indicates intermediate output features; Step 6: Multi-head Self-Attention in Windows. The input is divided into windows of fixed size, and multi-head self-attention calculation is performed within each window. The specific formula is shown below: MultiHead(W Q ,W K ,W V )=Concat(head1,head2,...,head h )W O head i =Attention(W Q W i Q ,W K W i K ,W V W i V ) In the formula, W Q W K W V These represent the query, key, and value matrices, respectively; d m B represents the attention head dimension; B represents the relative position bias; Attention(·) represents the self-attention operation; MultiHead(·) represents the multi-head attention operation; head i W represents the output feature of the i-th head; O W represents the output projection matrix. i Q W i K W i V This represents the linear projection of each head; Softmax(·) represents the Softmax activation function; To enhance information interaction between windows, sliding window multi-head self-attention slides the attention window by half the window size to form an interlaced window layout, and the subsequent calculation operation is the same as that of window multi-head self-attention. Step 7: Pass the output of the improved Transformer model through LayerNorm, average pooling, fully connected, and Softmax layers to obtain the fault diagnosis results of the charging device. The specific formula is shown below: Y=Softmax(Linear(Pooling(LN(Z T )))) In the formula, Y represents the tag corresponding to the fault of the charging device; Pooling(·) represents the average pooling layer operation; Z T This indicates the output features of the improved Transformer model.
5. The charging device fault diagnosis method considering time series data representation and privacy protection according to claim 1, step S4 includes: Step 1: In the fourth stage of the improved Transformer model, a sparse token transformation module is introduced to reduce the interference of redundant features on fault identification. The layer normalization (LN) structure in the fourth stage of the model is replaced with a batch channel normalization (BCN) structure. A B-SparTa module with sparse representation and normalization enhancement capabilities is constructed to improve the parameters of the charging equipment fault diagnosis model and improve the model inference efficiency. Step 2: The B-SparTa module first receives input features from the third stage and evaluates the importance of each token using a token scoring function, as shown in the following formula: s=Tanh(X token ·w s +b s ) In the formula, s represents the token score; Tanh(·) represents the Tanh activation function; X token This represents the input token sequence; w s b represents a learnable weight vector; s Indicates relative bias; Step 3: Based on the scoring results, the module selects the top K highest-scoring modules. s A sequence of tokens constitutes a sparse token set X. s This preserves local features containing key fault information, as shown in the following formula: X s =Top(X G ,K s ) In the formula, Top(·) represents the filtering operation; X G Represents the set of all token sequences; The subsequent model only applies to sparse sets X s Self-attention computation is performed on the token sequence in the data; Step 4: After the input data features pass through the sparse token transformation module, sparse features that retain important facial expression information are extracted. Then, after BCN normalization processing, the mean μ1 and variance of the batch dimension are calculated first. The calculation formula is as follows: In the formula, N b Indicates the number of batches of input data; z i This represents the input data of the BCN layer; Then, the mean μ2 and variance of the input data are calculated along the channel dimension. The calculation formula is as follows: In the formula, C b Indicates the number of channels for the input data; The input data is normalized using the calculated data and variance, as shown in the following formula: In the formula, This represents the normalized data; ε represents a very small constant to prevent division by zero; Step 5: The BCN layer introduces an additional learnable parameter η. c To adaptively balance the normalized output along the channel and batch dimensions, the calculation formula is as follows: In the formula, This represents the normalized characteristic after equilibrium is reached; η c This represents a learnable parameter with a range of [-1, 1]. Introducing learnable transformation parameter β c γ c The normalized features are scaled and shifted to obtain the final output features of the BCN layer. The calculation formula is shown below: In the formula, y c This represents the output characteristics of the BCN layer.
6. The charging device fault diagnosis method considering time series data representation and privacy protection according to claim 1, step S5 includes: Step 1: Perform distributed training of the model based on the federated learning framework. During the model training phase, multiple charging devices act as independent clients under the federated learning framework, each using locally stored charging operation data to train the model locally and generate local model parameters. Let the k-th... c Each charging device has a local dataset D. k The global model parameter is o u Then its local training update process in the u-th round is represented as: In the formula, o u Represents the global model parameters in the u-th round; Indicates client k c The local model parameters after the u-th round update; η u Indicates the local learning rate; The gradient of the loss function with respect to the model parameters is represented by N; Loss represents the function N. p Indicates the number of fault tags; Y represents the probability of outputting the i-th fault label; i ∈{0,1} indicates whether the charging device has a type i fault; Step 2: After local training is complete, each client updates its local model parameters. The data is uploaded to the cloud server, which acts as a federated coordination node. The cloud server then weights and aggregates the model parameters based on the proportion of data volume from each client to obtain new global model parameters. The specific formula is shown below: In the formula, o u+1 K represents the aggregated global model parameters. c The total number of clients is represented by n; n represents the total number of samples from all clients. i This represents the number of local samples for client i. Step 3: Aggregated global model parameters o u+1 It is distributed to each client for the next round of local training and iterative updates until the model converges; Step 4: To prevent model parameter leakage during transmission, an encryption algorithm is used to encrypt the model parameters. All variables of the encryption algorithm are in the polynomial model ring R. q The definition in the standard is that all calculations are powers modulo q, and the definition of the modular ring is as follows: In the formula, J represents the polynomial degree of the ring, which is a power of 2; q represents a large modulus used for encryption operations; Represents the ring of integers modulo q; V represents the polynomial variable; Step 5: The private key sk = (1, s) is a small polynomial randomly sampled from the polynomial ring, containing only coefficients {-1, 0, 1}, as shown below: In the formula, D key The ternary distribution is represented by s; s represents a small-coefficient polynomial with dimension J. In R q Randomly select an element 'a' from the error distribution χ. e Let e be randomly selected, and let pk = (b, a). The formula for calculating b is as follows: b = -as + e Step 6: Input plaintext as a complex vector v = (v1, v2, ..., v n ), and use an encoder to map it to a polynomial space: m=Encode(v)∈R q In the formula, m represents the encoded plaintext; Encode(·) represents the encoder; To improve accuracy, a scaling factor ξ is used to scale it to an integer pt, ensuring that the encryption result retains sufficient precision even with errors. The specific formula is shown below: pt=ξ·m Step 7: For the model parameter plaintext pt∈R q From χ e Randomly select numbers e0 and e1 in R. q Select a random number r, and the ciphertext calculation formula is as follows: ct=(ct0,ct1)=(b·r+e0+pt,a·r+e1) In the formula, ct represents the ciphertext pair after the plaintext is encrypted; Step 8: After receiving the ciphertext, the cloud server performs addition directly in the ciphertext state. For two ciphertexts... The addition formula is as follows: In the formula, ct add The ciphertext representation of the result of adding two corresponding plaintexts; The two ciphertext multiplication formulas are shown below: At this point, we have three ciphertext terms, which need to be relinearized to reduce them to two terms: Relin(ct0′,ct1′,ct2′)=(ct0″,ct1″) Step 9: Decrypt the ciphertext pair ct = (ct0, ct1) using the private key sk = (1, s), as shown in the following formula: In the formula, This represents the decrypted plaintext. The plaintext is reconstructed and decoded using the following formulas: In the formula, This represents the original complex vector after decoding; Decode(·) represents the decoder.
7. The charging device fault diagnosis method considering time series data representation and privacy protection according to claim 1, step S6 includes: Step 1: Preprocess the time-series data of the current operating status of the charging device to obtain image dataset E; Step 2: Use the trained model to diagnose faults in the charging equipment. The specific formula is shown below: Y = Diagnosis (E) In the formula, Y represents the label corresponding to the fault of the charging device; Diagnosis(·) represents the fault diagnosis model.
8. A fault diagnosis system for charging equipment that considers time-series data representation and privacy protection, characterized in that, The system includes: The data acquisition and preprocessing module is used to acquire charging order data and message data of the charging equipment in the charging station, and to construct an image dataset based on the current and voltage time series data in the data; The feature extraction module is used to extract features from the image dataset based on the ConvNeXt V2 model to obtain multi-level visual feature representations. The parameter optimization module is used to optimize and adjust the parameters of the ConvNeXt V2 model based on the optimization algorithm. The model training module is used to train the lightweight fault diagnosis model and continuously optimize the model parameters using extracted image features. A privacy protection module is used to protect the privacy of the fault diagnosis model based on a federated learning framework and encryption algorithms. The fault diagnosis module is used to diagnose faults in the current state of the charging equipment based on the fault diagnosis model.
9. A computer-readable storage medium storing computer instructions thereon, characterized in that: When executed by the processor, the computer instructions implement the steps of a charging device fault diagnosis method that considers time-series data representation and privacy protection as described in any one of claims 1-7.
10. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, it implements a charging device fault diagnosis method that considers time series data representation and privacy protection as described in any one of claims 1 to 7.