An electric vehicle charging anomaly detection method, device and charging pile
By fusing time-frequency features and processing dynamic environmental factors into charging voltage and current data, the problem of high false detection rate and poor robustness in anomaly identification during electric vehicle charging is solved, enabling accurate identification and timely warning of potential dangerous anomalies.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGDONG TUOJIE MECHANICAL & ELECTRICAL TECHNOLOGY CO LTD
- Filing Date
- 2025-08-06
- Publication Date
- 2026-05-05
AI Technical Summary
Existing technologies cannot effectively distinguish between normal protective anomalies and potential dangerous anomalies during electric vehicle charging, resulting in a high false detection rate and poor robustness, especially in the inability to identify and warn of minor or progressive anomalies in a timely manner.
By extracting time-domain and frequency-domain features from charging voltage and current data, and combining dynamic environmental factors and attention mechanisms for feature fusion, charging features are extracted using a bidirectional cross-attention mechanism and depthwise separable convolution to generate a fused charging feature vector. An adaptive anomaly warning threshold is introduced to achieve dynamic adjustment of feature representation under different environmental conditions.
It significantly improves the accuracy and robustness of identifying potential dangerous anomalies, reduces the false detection rate, and enhances the system's environmental adaptability and safety.
Smart Images

Figure CN120886687B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electric vehicle charging safety protection, and in particular to a method, device and charging pile for detecting charging anomalies in electric vehicles. Background Technology
[0002] With the increasing popularity of electric vehicles, the frequency of use of charging stations is gradually increasing. Safety issues during electric vehicle charging, especially spontaneous combustion incidents, have become a focus of public concern. Particularly when an electric vehicle is charging or sitting idle after being fully charged, the battery pack may spontaneously combust due to overcharging, overheating, or malfunctions in the Battery Management System (BMS). Spontaneous combustion not only damages the vehicle but also easily harms the surrounding environment, especially in poorly ventilated areas such as underground parking lots. Once an electric vehicle spontaneously combusts, ordinary fire extinguishers are often insufficient to extinguish it, and the harmful gases and heat released during battery combustion can spread rapidly in low-ventilation environments, posing a threat to surrounding batteries, charging stations, and other electric vehicles.
[0003] Therefore, traditional technologies generally rely on overvoltage protection, overcurrent protection, leakage protection, and insulation resistance detection. They monitor real-time data such as voltage, current, and insulation resistance to identify abnormal states in the charging process and trigger protection mechanisms based on these abnormalities to prevent more serious issues. For example, abnormal fluctuations in current or voltage during charging will trigger overcurrent or overvoltage protection mechanisms, automatically disconnecting the charging connection or reducing charging power to prevent damage to the battery or charging station.
[0004] However, traditional technologies rely on identifying anomalies based on real-time data and then issuing warnings and triggering protection mechanisms. While this approach provides timely responses, it cannot provide early warnings for minor or progressive anomalies. For example, the system may fail to detect minor overheating, overcharging, or small current fluctuations in the battery pack or charging station of an electric vehicle in a timely manner. Furthermore, its response is often too slow in the event of a major malfunction. In addition, non-immediate faults such as battery aging and charging station hardware failures often cannot be detected promptly.
[0005] Based on this, existing technologies typically employ neural networks to analyze and predict charging power data to identify abnormal states during the charging process. Neural networks can capture subtle fluctuations in charging power data and model these fluctuations, thereby providing early warnings of abnormalities in the charging process and aiming to detect potential problems before a fault occurs. However, in actual charging, the built-in protection mechanisms in charging stations, such as overvoltage protection, overcurrent protection, and temperature monitoring, usually execute corresponding protection mechanisms based on predetermined thresholds or rules. For example, if the temperature reaches a certain set threshold after prolonged operation, the charging power will automatically decrease; or when the battery pack voltage reaches a set upper limit, the charging station will stop charging to avoid overcharging and other safety issues.
[0006] In response to this, existing neural networks cannot flexibly adjust their feature representations according to environmental changes in anomaly detection. Therefore, they cannot effectively distinguish between normal protective anomalies and potential dangerous anomalies. They usually rely on a large amount of training data or construct multiple labels to identify different types of anomalies, but this method still has certain limitations. Because the feature representations of normal protective anomalies (such as overheating, overcharging, etc.) and potential dangerous anomalies (such as battery overheating, system failure, etc.) are similar, they are easily confused. This leads to gradient interference during the training process of neural networks using a large amount of training data, resulting in low training efficiency and making it difficult for the model to effectively distinguish between normal protective anomalies and potential dangerous anomalies in practical applications, thus resulting in low warning accuracy.
[0007] Therefore, existing technologies have certain false detection rates and robustness issues in the detection of charging pile anomalies. Summary of the Invention
[0008] Therefore, the purpose of this invention is to provide a method for detecting charging anomalies in electric vehicles.
[0009] A method for detecting charging anomalies in electric vehicles includes the following steps:
[0010] S1: Preprocess the charging voltage data and charging current data to generate charging time domain information and charging frequency domain information;
[0011] S2A: Extracts time-domain features from charging time-domain information to form a charging time-domain feature vector;
[0012] S2B: Extract spectral features from charging frequency domain information to form a charging spectral feature vector;
[0013] S3: Concatenate the charging time-domain feature vector and the charging spectrum feature vector to obtain the concatenated charging feature vector;
[0014] S4: Based on dynamic environmental factors, perform attention feature fusion on the spliced charging feature vector to generate a fused charging feature vector.
[0015] S5: Perform anomaly identification on the fused charging feature vector and generate anomaly detection results corresponding to the current charging period.
[0016] The electric vehicle charging anomaly detection method of the present invention, compared with the prior art, introduces dynamic environmental factors during the fusion of time-domain and frequency-domain features of charging data, and combines an attention mechanism to weight the spliced feature vector. This enables the model to dynamically adjust the focus of feature attention according to different environmental conditions, enhance the contextual relevance and differential expression ability of feature representation, and thus enable the model to accurately distinguish between normal protective anomalies and potential dangerous anomalies, effectively reduce the false detection rate, and improve the robustness and generalization ability of anomaly recognition under various environmental conditions.
[0017] Further, step S2A includes the following sub-steps:
[0018] One-dimensional convolution operation is performed on the voltage time-domain information in the charging time-domain information to form a local feature sequence of voltage;
[0019] The local feature sequence of voltage is vector-encoded to form a fixed-dimensional embedding vector sequence, thereby obtaining the embedding vector of voltage.
[0020] One-dimensional convolution operation is performed on the current time-domain information in the charging time-domain information to form a local feature sequence of the current;
[0021] Vector encoding is performed on the local feature sequence of the current to obtain the embedding vector of the current;
[0022] The voltage embedding vector is used as the query vector and the current embedding vector is used as the key vector to generate weights. The weights are then multiplied and fused with the current embedding vector to obtain the enhanced current embedding vector.
[0023] Meanwhile, the current embedding vector is used as the query vector and the voltage embedding vector is used as the key vector to generate weights, and the weights are multiplied and fused with the voltage embedding vector to obtain the enhanced voltage embedding vector.
[0024] The enhanced voltage embedding vector and the enhanced current embedding vector are sequentially concatenated and fully connected to obtain the charging time-domain feature vector after preliminary fusion.
[0025] Bidirectional time-series feature extraction is performed on the initially fused charging time-domain feature vector to extract the contextual feature representation reflected in the joint evolution of voltage and current, forming the final charging time-domain feature vector.
[0026] Accordingly, this invention independently models the time-domain information of charging voltage and current, extracting their respective local feature representations to preserve their individual dynamic characteristics. Simultaneously, a bidirectional cross-attention mechanism is employed to fuse and enhance the embedding vectors of voltage and current, enabling the model to fully capture the temporal correlation and cooperative fluctuation characteristics between the two, thereby improving the response sensitivity to abnormal cooperative signals during charging.
[0027] Based on this, by introducing bidirectional time-series modeling (such as BiLSTM) into the enhanced feature vector, the long-term evolution trend and contextual dependence of voltage and current during the charging process are further captured, thereby improving the ability to identify progressive abnormal signals. Thus, this invention significantly enhances the expressive power of voltage and current time-domain features, and improves the detection accuracy and recognition depth of complex abnormal states.
[0028] Further, step S2B includes the following sub-steps:
[0029] The voltage spectrum information and current spectrum information in the charging frequency domain information are concatenated in the channel dimension to form a two-dimensional spectrum tensor.
[0030] A two-dimensional spectral feature vector is obtained by performing depthwise separable convolutional feature extraction on the two-dimensional spectral tensor.
[0031] Perform pointwise convolution on the two-dimensional spectral feature vector to obtain the compressed two-dimensional spectral features;
[0032] The compressed spectral features are subjected to feature mapping and nonlinear transformation to generate a fixed-dimensional spectral embedding vector, thus obtaining the charging spectral feature vector.
[0033] Accordingly, this invention achieves spectral feature extraction and compression through depthwise separable convolution and pointwise compression, enhances the model's ability to express local fluctuations in the frequency dimension, and constructs a unified spectral embedding vector, thereby improving the accuracy and stability of frequency domain feature and time domain feature fusion.
[0034] Furthermore, the dynamic environmental factors are generated through a lightweight neural network, the specific structure of which is as follows:
[0035] α = reshape(MLP(Input))
[0036] In the formula, α represents the dynamic environmental factor; Input represents the input of environmental data; MLP represents a multilayer perceptron, which consists of several fully connected layers and nonlinear activation functions, used to extract the nonlinear features hidden in the charging feature vector of the input pair of environmental data; reshape is a matrix transformation operation;
[0037] In step S4, attention feature fusion is used to calculate attention weights by using the dynamic environmental factors as query vectors and the concatenated charging feature vectors as key vectors, and then multiplying the weights by the concatenated charging feature vectors to generate a fused charging feature vector.
[0038] Accordingly, this invention introduces external environmental data as a dynamic adjustment factor, inputs the environmental data into a lightweight neural network, generates a perturbation factor (i.e., a dynamic environmental factor) with the same dimension as the charging feature vector, and uses it as a query vector. This query vector is then used as a key vector along with the concatenated charging feature vector (containing time and frequency domain information) for attention calculation. This enables differentiated weighting of charging features based on changes in the external environment, thereby allowing the model's feature representation to be dynamically adjusted under different environmental conditions.
[0039] Ultimately, this invention effectively enhances the model's sensitivity to potential dangerous anomalies and reduces misjudgments caused by environmental disturbances by enabling the model to adaptively adjust its focus on different dimensions of information during the charging process. This solves the problem that existing technologies cannot combine external conditions to achieve differentiated feature expression, and effectively improves the accuracy, stability, and environmental adaptability of anomaly detection.
[0040] Furthermore, after obtaining the anomaly detection result corresponding to the current charging period, the following steps are also included:
[0041] Determine whether the abnormal detection result corresponding to the current charging period triggers an abnormal warning threshold: if not, continue to call the charging data preprocessing unit 1; if yes, pause the current charging process of the electric vehicle and prompt for manual intervention.
[0042] The triggering determination of the constant early warning threshold is expressed as follows:
[0043]
[0044] In the formula, result (T) The anomaly detection result corresponding to the current charging period T; K is used for the length of the historical window for smoothing reference; th low Indicates the minimum risk tolerance threshold; th middle This indicates the threshold for moderate risk.
[0045] Accordingly, after obtaining the anomaly detection results of the current charging period, the present invention introduces an adaptive anomaly warning threshold judgment mechanism. By combining the single-period risk score with the average risk assessment index of the historical sliding window, it realizes a multi-dimensional judgment of the potential risk level, effectively avoids the false stop phenomenon caused by occasional false alarms of the model, and ensures timely response when obvious abnormal trends appear, thereby enhancing the overall safety and control reliability of the system.
[0046] A charging anomaly detection device for electric vehicles includes a charging data preprocessing unit, a time-domain feature extraction unit, a spectrum feature extraction unit, a time-frequency feature splicing unit, a time-frequency feature dynamic fusion unit, and an anomaly identification unit.
[0047] The charging data preprocessing unit is used to preprocess the charging voltage data and charging current data to generate charging time domain information and charging frequency domain information.
[0048] The time-domain feature extraction unit is used to extract time-domain features from charging time-domain information to form a charging time-domain feature vector;
[0049] The spectrum feature extraction unit is used to extract spectrum features from the charging frequency domain information to form a charging spectrum feature vector;
[0050] The time-frequency feature splicing unit is used to splice the charging time-domain feature vector and the charging spectrum feature vector to obtain the spliced charging feature vector.
[0051] The time-frequency feature dynamic fusion unit is used to perform attention feature fusion on the spliced charging feature vector according to dynamic environmental factors to generate a fused charging feature vector.
[0052] The anomaly identification unit is used to identify anomalies in the fused charging feature vector and generate anomaly detection results corresponding to the current charging period.
[0053] A charging pile includes an electrical parameter acquisition module, an environmental data acquisition sensor, and a charging anomaly detection device for electric vehicles.
[0054] The electrical parameter acquisition module includes a voltage sensor and a current sensor installed in the charging path, which are used to collect the output voltage data and output current data of the charging gun in real time during the charging process, digitize them to form charging voltage data and charging current data, and transmit them to the charging abnormality detection device of the electric vehicle.
[0055] The environmental data acquisition sensors are installed inside the charging pile housing and the charging gun, respectively, to collect the temperature data of the charging pile and the temperature data of the charging gun, and then digitize them and transmit them to the charging anomaly detection device of the electric vehicle.
[0056] The electric vehicle charging anomaly detection device is the electric vehicle charging anomaly detection device described above.
[0057] To better understand and implement this invention, the following detailed description is provided in conjunction with the accompanying drawings. Attached Figure Description
[0058] Figure 1This is a simplified structural diagram and data flow example of the charging pile described in this invention;
[0059] Figure 2 This is a simplified structural diagram of the electric vehicle charging anomaly detection device according to the present invention;
[0060] Figure 3 This is a simplified flowchart illustrating the charging anomaly detection method for electric vehicles according to the present invention.
[0061] Figure 4 This is a schematic diagram of a model structure for the electric vehicle charging anomaly detection device described in this invention. Detailed Implementation
[0062] To address the issues of false detection rate and robustness in existing technologies for charging pile anomaly detection, this invention preprocesses charging voltage and current data to generate charging time-domain and charging frequency-domain information. Next, it extracts time-domain features from the charging time-domain information and spectral features from the charging frequency-domain information to obtain charging time-domain and charging frequency-domain feature vectors, which are then concatenated to form a concatenated charging feature vector. Finally, based on dynamic environmental factors, it performs attention feature fusion on the concatenated feature vector to generate a fused charging feature vector, which is then used for anomaly detection to obtain the anomaly detection result corresponding to the current charging period.
[0063] Accordingly, this invention introduces dynamic environmental factors driven by environmental data and combines them with an attention mechanism to weight time-frequency features, enabling the model to adaptively adjust its feature focus range under different environmental conditions. This significantly enhances the ability to identify progressive and complex anomalies, thereby effectively reducing the false detection rate, improving environmental adaptability, and enhancing system robustness.
[0064] Based on the above design, this invention proposes a method for detecting charging anomalies in electric vehicles, and based on this method, proposes a device for detecting charging anomalies in electric vehicles.
[0065] Please see Figure 1 , Figure 1 This is a simplified structural diagram of the charging pile described in this invention, illustrating data flow.
[0066] A charging pile includes an electrical parameter acquisition module, an environmental data acquisition sensor, and a charging anomaly detection device for electric vehicles.
[0067] The electrical parameter acquisition module includes a voltage sensor and a current sensor installed in the charging path, which are used to collect the output voltage data and output current data of the charging gun in real time during the charging process, digitize them to form charging voltage data and charging current data, and transmit them to the charging anomaly detection device of the electric vehicle.
[0068] The environmental data acquisition sensors are installed inside the charging pile housing and the charging gun, respectively, to collect temperature data of the charging pile and the charging gun, and then digitize and transmit the data to the charging anomaly detection device of the electric vehicle.
[0069] The environmental data acquisition sensor may be a temperature sensor composed of an NTC thermistor, but this invention does not specifically limit it.
[0070] Please also refer to Figure 2 , Figure 3 and Figure 4 , Figure 2 This is a simplified structural diagram of the electric vehicle charging anomaly detection device according to the present invention. Figure 3 This is a schematic diagram of a model structure for the electric vehicle charging anomaly detection device described in this invention. Figure 4 This is a simplified flowchart illustrating the charging anomaly detection method for electric vehicles described in this invention.
[0071] The electric vehicle charging anomaly detection device includes a charging data preprocessing unit 1, a time-domain feature extraction unit 2A, a spectrum feature extraction unit 2B, a time-frequency feature splicing unit 3, a time-frequency feature dynamic fusion unit 4, and an anomaly identification unit 5.
[0072] The charging data preprocessing unit 1 is used to perform step S1: preprocess the charging voltage data and charging current data to generate charging time domain information and charging frequency domain information.
[0073] Specifically, the preprocessing includes the following sub-steps:
[0074] The charging voltage and charging current data are timestamped and synchronously sampled according to a preset sampling frequency to generate continuous voltage and current sequences with uniform time resolution.
[0075] The timestamp alignment is used to match the voltage sampling points and current sampling points in the current sampling period one by one on the time axis, ensuring that the two physical quantities remain consistent in the time dimension during subsequent analysis, and avoiding data distortion caused by sampling delay or time sequence misalignment. The preset sampling frequency represents the number of data points collected per unit time and is used to control the accuracy and resolution of the time series. Its default value is 100Hz, and its specific value can be adjusted according to the device capability and target detection sensitivity. This invention does not impose specific limitations on this.
[0076] The continuous voltage sequence and the continuous current sequence are respectively subjected to time-domain feature normalization processing to obtain voltage time-domain information and current time-domain information, which are then used to construct charging time-domain information.
[0077] The time-domain feature standardization process is used to convert the original fluctuation information in continuous voltage and current sequences into neural network-acceptable tensors with uniform dimensions and numerical ranges, and effectively preserve their fluctuation trends and abrupt change characteristics. Specifically, it can be Z-score standardization, Min-Max normalization, or other statistical standardization methods, etc. This invention does not specifically limit the choice of standardization.
[0078] A fixed-length sliding window and a step size are used to divide the continuous voltage sequence and the continuous current sequence into several voltage data segments and current data segments of uniform length.
[0079] The sliding window is used to overlap and segment the original continuous voltage sequence and continuous current sequence, so that the segment in each window retains certain contextual information, which helps the neural network to extract local fluctuation features and enhance robustness. The step size is used to determine the distance the window moves each time. The smaller the step size, the greater the overlap of segments and the more continuous the subsequent feature extraction, but it is easy to cause abnormal features to be covered. The default window length is 512 and the step size is 64. The present invention does not impose specific limitations on them.
[0080] Simultaneously, Fourier fast transform is performed on several voltage and current data segments to obtain voltage frequency domain information and current frequency domain information, which together form charging frequency domain information.
[0081] The Fast Fourier Transform is used to transform voltage and current fluctuation information in the time domain into amplitude spectra in the frequency domain, thereby reflecting the potential periodic components, harmonic disturbances, or high-frequency anomalies in the current and voltage signals.
[0082] The time-domain feature extraction unit 2A is used to perform step S2A: extracting time-domain features from the charging time-domain information to form a charging time-domain feature vector.
[0083] Specifically, the temporal feature extraction unit 2A includes a voltage convolutional layer, a voltage embedding layer, a current convolutional layer, a current embedding layer, a bidirectional cross-attention layer, a temporal feature fusion layer, and a bidirectional long short-term memory neural network layer.
[0084] The voltage convolutional layer is used to perform one-dimensional convolution operations on the voltage time-domain information to extract local fluctuation patterns of the voltage time-domain information and form a local feature sequence of voltage.
[0085] In the one-dimensional convolution operation, the kernel size is 3×3 by default, the stride is 1 by default, and after the convolution operation, batch normalization and ReLU activation function processing are also included to improve feature stability and enhance nonlinear expression ability.
[0086] The voltage embedding layer is used to vector encode the local feature sequence of voltage to form a fixed-dimensional embedding vector sequence, thereby obtaining the voltage embedding vector.
[0087] The vector encoding can be achieved by combining one or more fully connected neural networks with nonlinear activation functions, thereby unifying the embedding representation of local feature sequence encoding layers.
[0088] The current convolutional layer is used to perform one-dimensional convolution operations on the current time-domain information to form a local feature sequence of the current.
[0089] The current embedding layer is used to perform vector encoding on the local feature sequence of the current, thereby obtaining the current embedding vector.
[0090] The dual cross-attention layer includes the following steps:
[0091] The voltage embedding vector is used as the query vector and the current embedding vector is used as the key-value vector to generate weights. The weights are then multiplied and fused with the current embedding vector to obtain an enhanced current embedding vector. This is to capture the dynamic correlation between the voltage embedding vector and the current embedding vector in the time evolution, thereby realizing the modal interaction between voltage and current.
[0092] Simultaneously, the current embedding vector is used as the query vector, and the voltage embedding vector is used as the key vector to generate weights. The weights are then multiplied and fused with the voltage embedding vector to obtain the enhanced voltage embedding vector.
[0093] The time-domain feature fusion layer is used to concatenate and fully connect the enhanced voltage embedding vector and the enhanced current embedding vector sequentially to obtain the initially fused charging time-domain feature vector.
[0094] The fully connected mapping includes one or more fully connected layers and nonlinear activation functions (such as ReLU) to compress the feature dimensions after splicing and improve the nonlinear expression capability, thereby further enhancing the collaborative modeling capability and feature expression capability between voltage and current modes.
[0095] The bidirectional long short-term memory (BiLSTM) neural network layer is used to extract bidirectional time-series features from the initially fused charging time-domain feature vector, so as to extract the contextual feature representation reflected in the joint evolution of voltage and current, and form the final charging time-domain feature vector.
[0096] It should be noted that the bidirectional long short-term memory neural network is typically used for bidirectional contextual feature extraction of time series data. Specifically, it processes the input sequence through forward and backward LSTM sub-networks to obtain information about the correlation between each time step, thereby improving the model's ability to model the global dependencies of the sequence. Since this structure is a conventional time series modeling technique in the field, this invention will not elaborate on it.
[0097] In addition, users can choose other alternative network structures with bidirectional temporal modeling capabilities according to actual application needs, such as bidirectional gated recurrent unit (BiGRU) networks, Transformer encoder structures, or lightweight bidirectional convolutional temporal networks, etc., and balance the computational complexity and real-time requirements according to the actual situation. This invention does not specifically limit the choice of network structure with bidirectional temporal modeling capabilities.
[0098] The spectrum feature extraction unit 2B is used to perform step S2B: extracting spectrum features from the charging frequency domain information to form a charging spectrum feature vector.
[0099] Specifically, the spectral feature extraction unit 2B includes a spectral input reconstruction module, a depthwise separable convolution module, a channel compression module, and a spectral embedding layer.
[0100] The spectrum input reconstruction module is used to concatenate voltage spectrum information and current spectrum information in the channel dimension to form a two-dimensional spectrum tensor.
[0101] The depthwise separable convolution module includes a multi-layer depthwise separable convolution network. Each layer consists of depthwise convolution, pointwise convolution, batch normalization, and ReLU activation functions. These functions are used to extract depthwise separable convolution features from the two-dimensional spectral tensor to obtain a two-dimensional spectral feature vector, thereby extracting local energy fluctuations, harmonic disturbances, and anomalous peak features in the frequency domain.
[0102] Among them, depthwise convolution is used to extract local frequency spatial features independently on each channel, and pointwise convolution is used to aggregate feature information across channels, thereby effectively modeling the structural perturbation patterns and intermodal coupling characteristics of the spectrum.
[0103] The channel compression module is used to perform pointwise convolution on the two-dimensional spectral feature vector to obtain compressed two-dimensional spectral features, thereby compressing the extracted multi-channel spectral features into a unified dimension.
[0104] The spectrum embedding layer includes a fully connected neural network and a nonlinear activation function, which are used to perform feature mapping and nonlinear transformation on the compressed spectrum features to generate a fixed-dimensional spectrum embedding vector and obtain a charging spectrum feature vector.
[0105] The time-frequency feature splicing unit 3 is used to perform step S3: splicing the charging time-domain feature vector and the charging spectrum feature vector to obtain the spliced charging feature vector.
[0106] It should be noted that, because the splicing operation does not cause any disturbance to the internal feature distribution of the original mode in terms of structure, it combines the charging time-domain feature vector with complete voltage and current time-series evolution context information, as well as the charging spectrum feature vector that can express the frequency domain disturbance features and energy distribution during the charging process, in parallel according to the original dimensional structure, so as to retain their independent expressive capabilities and achieve information complementarity.
[0107] The time-frequency feature dynamic fusion unit 4 is used to perform step S4: according to the dynamic environmental factors, perform attention feature fusion on the spliced charging feature vector to generate a fused charging feature vector.
[0108] Specifically, the dynamic environmental factors are generated through a lightweight neural network, the specific structure of which is as follows:
[0109] α = reshape(MLP(Input))
[0110] In the formula, α represents the dynamic environmental factor, whose size is consistent with the spliced charging feature vector, and is used to characterize the dynamic adjustment factor of the weight of environmental changes on the charging process features; Input represents the input of environmental data, which by default includes charging pile temperature data and charging gun temperature data under a unified timestamp. It should be noted that the input form of the environmental data can be the original temperature value, temperature change rate, temperature rise rate, or any combination of the above forms. This invention does not make specific limitations on this; MLP represents Multi-Layer Perceptron, which consists of several fully connected layers and nonlinear activation functions, and is used to extract the nonlinear features implied in the charging feature vector from the charging pile temperature data and the charging gun temperature data; reshape is a matrix transformation operation, used to map the features extracted by the multi-layer perceptron to the same dimension as the spliced charging feature vector, so that it forms the dynamic environmental factor.
[0111] The attention feature fusion is used to calculate the attention weights by taking the dynamic environmental factors as the query vector and the concatenated charging feature vector as the key vector, and then multiplying the weights by the concatenated charging feature vector to generate a fused charging feature vector.
[0112] Accordingly, this invention utilizes dynamic environmental factors to enable the model to dynamically adjust its feature representation based on external environmental conditions, thereby achieving the model's dynamic perception capability. It should be further noted that although the dynamic environmental factors used in this invention default to temperature data as the input source, in practical applications, various available environmental parameters such as humidity, power grid fluctuations, battery SOC, and electric vehicle usage status can also be combined and processed with a unified timestamp before being used as input for modeling (independent modeling or multimodal fusion modeling, etc.) to further improve the robustness and adaptability of the dynamic feature fusion mechanism of this invention. This invention does not impose specific limitations on these parameters.
[0113] The anomaly identification unit 5 is used to perform step S5: perform anomaly identification on the fused charging feature vector and generate anomaly detection results corresponding to the current charging period.
[0114] Specifically, the anomaly identification unit 5 includes a fully connected layer and a Sigmoid activation function, which are used to perform nonlinear mapping on the fused charging feature vector and output an anomaly risk score value to obtain the anomaly detection result corresponding to the current charging period.
[0115] The abnormal risk score is a continuous real number ranging from 0 to 1, used to represent the degree of potential abnormality in the charging process during the current period. The higher the score, the more significant the potential.
[0116] Furthermore, after obtaining the anomaly detection result corresponding to the current charging period, the following steps are also included:
[0117] Determine whether the abnormal detection result corresponding to the current charging period triggers an abnormal warning threshold: if not, continue to call the charging data preprocessing unit 1; if yes, pause the current electric vehicle charging process and prompt for manual intervention.
[0118] The triggering determination of the constant early warning threshold is expressed as follows:
[0119]
[0120] In the formula, result (T) The anomaly detection result corresponding to the current charging period T; K is used for the length of the historical window for smoothing reference, with a default value of 5; th low This represents the minimum risk tolerance threshold, with a default value of 0.3; middle This represents the moderate risk threshold, with a default value of 0.6.
[0121] Accordingly, the risk threshold introduced in this invention is based on a dual judgment strategy of real-time risk score and historical moving average score to improve robustness to progressive anomalies and intermittent noise, thereby preventing delay processing problems in scenarios such as potential high temperature, overcharging, and battery runaway.
[0122] In another embodiment, the triggering judgment of the abnormal warning threshold can also introduce the rate of change of the abnormal risk score as an additional judgment basis, so as to improve the system's response capability to sudden anomalies (such as high-frequency interference, internal short circuit of battery, etc.), thereby achieving more granular risk control.
[0123] To improve the accuracy of the anomaly detection results, the present invention further trains the charging anomaly detection device, which specifically includes the following steps:
[0124] TS1: Collect raw datasets during the electric vehicle charging process.
[0125] The original dataset includes charging data and abnormal status data. The charging data includes charging voltage data, charging current data, charging pile temperature data, and charging gun temperature data.
[0126] The abnormal status is a risk score value, which represents the label of the degree of abnormal risk corresponding to the charging data. It is used to train the regression model and help the model identify abnormal trends of different degrees. Specifically, confirmed accident charging data is labeled as 1 by manual means or auxiliary tools, and normal samples are labeled as 0. For samples that are suspected but have not caused safety problems, they can be assigned an intermediate score in the range of [0.1 to 0.9] by manual expert scoring, statistical evaluation and other methods.
[0127] TS2: Preprocess the original dataset and split it to obtain the training dataset and validation dataset.
[0128] The preprocessing involves processing the charging data of the original dataset through the charging data preprocessing unit 1 to generate charging time-domain information and charging frequency-domain information; the division involves dividing the original dataset into a training dataset and a validation dataset according to an 8:2 ratio.
[0129] TS3. The time-domain feature extraction unit 2A and the frequency-domain feature extraction unit 2B in the charging anomaly detection device are independently combined with the anomaly identification unit 5 to form a charging anomaly detection model based on time-domain features and a charging anomaly detection model based on frequency-domain features.
[0130] It should be noted that the charging anomaly detection model based on time-domain features and the charging anomaly detection model based on frequency-domain features formed in this step are two independent models. They do not include cross-attention fusion and dynamic factor control, but only focus on the independent training of the feature extraction capabilities of each modality. This avoids gradient interference caused by the synchronous training of lightweight neural networks and cross-attention fusion in the early training stage, and ensures the stability of the feature extraction path.
[0131] TS4. The charging anomaly detection model based on time domain features and the charging anomaly detection model based on frequency domain features are trained using the training dataset to obtain the trained charging anomaly detection model based on time domain features and the charging anomaly detection model based on frequency domain features.
[0132] For any charging anomaly detection model, the training includes the following sub-steps:
[0133] The charging data in the training dataset is input into the corresponding charging anomaly detection model for forward propagation to obtain the anomaly detection results.
[0134] The mean squared error (MSE) loss function is used to calculate the loss between the anomaly detection results and the anomaly states in the training dataset, and the loss value is obtained.
[0135] Based on the loss value, backpropagation is performed on the trainable parameters of the charging anomaly detection model to obtain the gradient values of the trainable parameters. An optimizer (such as the Adam optimizer) is then used to update the trainable parameters of the charging anomaly detection model based on the gradient values to obtain the updated charging anomaly detection model.
[0136] Determine if the current training epoch meets the requirement of a validation epoch (default is 100 epochs): If yes, use the charging data from the validation dataset as input to the corresponding updated charging anomaly detection model for forward propagation to obtain the anomaly detection result; if no, continue to use the training dataset to propagate the updated charging anomaly detection model forward.
[0137] Determine whether the current anomaly detection result and the loss value of the anomaly state in the validation dataset or the current training round meet a training completion threshold: if yes, obtain the completed charging anomaly detection model; if not, continue to use the training dataset to propagate the updated charging anomaly detection model forward.
[0138] The training completion threshold can be evaluated using the mean squared error on the validation set. When the MSE value is lower than the set threshold (e.g., 0.15), the model is considered to have sufficient generalization ability, thus completing the training task of the current stage.
[0139] It should be noted that the training completion threshold can be flexibly set according to the safety tolerance of the specific charging scenario, the custom early warning strategy, or the actual deployment accuracy requirements, and this invention does not impose any specific limitations on it.
[0140] TS5. The trainable parameters of the corresponding time-domain feature extraction unit and spectrum feature extraction unit in the completed training of the charging anomaly detection model based on time-domain features and the charging anomaly detection model based on frequency-domain features are loaded into the time-domain feature extraction unit 2A and the spectrum feature extraction unit 2B in the charging anomaly detection device, and the parameters are frozen to form the frozen charging anomaly detection device.
[0141] It should be noted that the purpose of freezing the trainable parameters of the time-domain feature extraction unit 2A and the spectrum feature extraction unit 2B in the charging anomaly detection device is to prevent gradient conflicts or parameter drift during subsequent training and to ensure that their learned stable feature extraction capabilities are not destroyed.
[0142] Meanwhile, the freezing operation can serve as an "anchor point" for steady-state feature input, allowing the subsequent training of the lightweight neural network, the time-frequency feature dynamic fusion unit 4, and the anomaly recognition unit 5 to focus more on the correlation between modeling environment information and feature fusion strategy, thereby improving the robustness of the overall anomaly recognition system under multi-factor environments.
[0143] TS6. The frozen charging anomaly detection device is trained using the training dataset to obtain the initially trained charging anomaly detection device.
[0144] Since the training process in this stage is consistent with the training process in TS4 mentioned above, including forward propagation, loss calculation and parameter update, it will not be described again in this invention.
[0145] It is important to emphasize that the focus of training in this stage is on the effective modeling of the lightweight neural network and the time-frequency feature dynamic fusion unit 4. In particular, by introducing environmental data (such as charging pile temperature data and charging gun temperature data) into the lightweight neural network, it outputs dynamic environmental factors, thereby enabling the model to learn the dynamic influence of temperature changes on the time-frequency feature fusion strategy, thus achieving adaptive anomaly detection based on environmental information.
[0146] TS7. Unfreeze the trainable parameters of the corresponding time-domain feature extraction unit 2A and spectrum feature extraction unit 2B in the initially trained charging anomaly detection device to form the unfrozen charging anomaly detection device.
[0147] TS8. The training dataset is used to train the thawed charging anomaly detection device to obtain the trained charging anomaly detection device.
[0148] It should be noted that, by unfreezing the time-domain feature extraction unit 2A and the spectral feature extraction unit 2B in step TS7, and enabling them to be updated together with the lightweight neural network, the time-frequency feature dynamic fusion unit 4, and the anomaly detection unit 5 during joint training, the present invention achieves end-to-end training across the entire chain. This not only allows for further fine-tuning of the feature representation formed in the early frozen state, but also enables the time-frequency feature extraction path to better adapt to the fusion mechanism guided by the dynamic environmental factors generated by the lightweight neural network, thereby improving the overall modeling ability and detection accuracy of the model for anomaly change trends.
[0149] In particular, when environmental disturbances are significant or the boundaries of anomalies are blurred, the aforementioned joint fine-tuning mechanism helps to enhance the model's sensitivity to identifying "fuzzy regions," thereby effectively distinguishing between systematic anomalies and normal protective anomalies.
[0150] Compared to existing technologies, this invention introduces a dynamic environmental factor mechanism to construct a perturbation vector based on external environmental data. Specifically, it generates dynamic adjustment factors through a lightweight neural network and combines an attention mechanism to achieve differentiated weighted expression of charging features. This enables the model to dynamically adjust its feature focus according to changes in the external environment, thereby improving its ability to perceive abnormal charging signals under different environments, effectively reducing the risk of false detection caused by environmental fluctuations, and enhancing the generalization ability and robustness of anomaly detection.
[0151] Furthermore, this invention decouples and models the time-domain information of charging voltage and current, and enhances the temporal representation capability of voltage and current through a bidirectional cross-attention mechanism, effectively capturing the deep dependency between voltage and current during charging. At the same time, it employs a depthwise separable convolution and pointwise compression mechanism in the frequency domain to improve the efficiency and consistency of spectral feature extraction, thereby constructing a charging feature vector that combines time-domain dynamic features and frequency-domain local sensitivity, significantly improving the model's accuracy in identifying gradual anomalies and complex fluctuation patterns.
[0152] Ultimately, this invention addresses the differences in modeling requirements and gradient sensitivity among different functional modules within the model structure by employing a three-stage training strategy: "separate training—parameter freezing—joint fine-tuning." First, the time-domain feature extraction module and the frequency-domain feature extraction module are trained independently, allowing them to fully learn the basic feature representation capabilities of the charging data without being disturbed by dynamic factors. Second, the parameters of the trained basic feature extraction module are frozen, focusing on training the lightweight neural network and the time-frequency feature fusion module. This enables the model to effectively learn the correlation mapping relationship between environmental perturbations and feature weighting based on stable input. Third, all modules are unfrozen for joint fine-tuning, ensuring full-link synergy between the feature extraction path and the fusion mechanism, further improving the model's anomaly detection accuracy and boundary sensitivity in complex, dynamic environments. Therefore, through this training strategy, this invention effectively avoids early gradient conflict during training, improves the stability of the model training process, and significantly enhances the model's generalization ability and robustness under multi-factor environmental perturbations.
[0153] Based on the same inventive concept, this application also provides an electronic device, which can be a server, desktop computing device, or mobile computing device (e.g., laptop computing device, handheld computing device, tablet computer, netbook, etc.) or other terminal device. The device includes one or more processors and a memory, wherein the processor is used to execute a program to implement the electric vehicle charging anomaly detection method of the embodiments of the present invention; the memory is used to store a computer program executable by the processor.
[0154] Based on the same inventive concept, this application also provides a computer-readable storage medium corresponding to the aforementioned embodiment of a method for detecting charging anomalies in electric vehicles. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the method for detecting charging anomalies in electric vehicles as described in any of the above embodiments.
[0155] This application may take the form of a computer program product implemented on one or more storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing program code. Computer storage media include permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information may be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to: phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0156] The embodiments described above are merely examples of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and the present invention also intends to include these modifications and variations.
Claims
1. A method for detecting charging anomalies in electric vehicles, characterized in that, Includes the following steps: S1: Preprocess the charging voltage data and charging current data to generate charging time domain information and charging frequency domain information; S2A: Extracts time-domain features from charging time-domain information to form a charging time-domain feature vector; S2B: Extract spectral features from charging frequency domain information to form a charging spectral feature vector; S3: Concatenate the charging time-domain feature vector and the charging spectrum feature vector to obtain the concatenated charging feature vector; S4: Based on dynamic environmental factors, perform attention feature fusion on the spliced charging feature vector to generate a fused charging feature vector. S5: Perform anomaly detection on the fused charging feature vector to generate anomaly detection results corresponding to the current charging period; Step S2A includes the following sub-steps: One-dimensional convolution operation is performed on the voltage time-domain information in the charging time-domain information to form a local feature sequence of voltage; The local feature sequence of voltage is vector-encoded to form a fixed-dimensional embedding vector sequence, thereby obtaining the embedding vector of voltage. One-dimensional convolution operation is performed on the current time-domain information in the charging time-domain information to form a local feature sequence of the current; Vector encoding is performed on the local feature sequence of the current to obtain the embedding vector of the current; The voltage embedding vector is used as the query vector and the current embedding vector is used as the key vector to generate weights. The weights are then multiplied and fused with the current embedding vector to obtain the enhanced current embedding vector. Meanwhile, the current embedding vector is used as the query vector and the voltage embedding vector is used as the key vector to generate weights, and the weights are multiplied and fused with the voltage embedding vector to obtain the enhanced voltage embedding vector. The enhanced voltage embedding vector and the enhanced current embedding vector are sequentially concatenated and fully connected to obtain the charging time-domain feature vector after preliminary fusion. Bidirectional time-series feature extraction is performed on the initially fused charging time-domain feature vector to extract the contextual feature representation reflected in the joint evolution of voltage and current, forming the final charging time-domain feature vector.
2. The method for detecting charging anomalies in electric vehicles according to claim 1, characterized in that, Step S2B includes the following sub-steps: The voltage spectrum information and current spectrum information in the charging frequency domain information are concatenated in the channel dimension to form a two-dimensional spectrum tensor. A two-dimensional spectral feature vector is obtained by performing depthwise separable convolutional feature extraction on the two-dimensional spectral tensor. Perform pointwise convolution on the two-dimensional spectral feature vector to obtain the compressed two-dimensional spectral features; The compressed spectral features are subjected to feature mapping and nonlinear transformation to generate a fixed-dimensional spectral embedding vector, thus obtaining the charging spectral feature vector.
3. The method for detecting charging anomalies in electric vehicles according to claim 2, characterized in that, The dynamic environmental factors are generated through a lightweight neural network, the specific structure of which is shown below: In the formula, Represents dynamic environmental factors; This indicates the input of environmental data; This represents a multilayer perceptron, consisting of several fully connected layers and nonlinear activation functions, used to extract the nonlinear features implicit in the input feature vector of environmental data. For matrix transformation operations; In step S4, attention feature fusion is used to calculate attention weights by using the dynamic environmental factors as query vectors and the concatenated charging feature vectors as key vectors, and then multiplying the weights by the concatenated charging feature vectors to generate a fused charging feature vector.
4. The method for detecting charging anomalies in electric vehicles according to any one of claims 1-3, characterized in that, After obtaining the anomaly detection result corresponding to the current charging period, the following steps are also included: Determine whether the abnormal detection result corresponding to the current charging period triggers an abnormal warning threshold: if not, continue to execute step S1; if yes, suspend the current charging process of the electric vehicle and prompt for manual intervention. The triggering determination of the constant early warning threshold is expressed as follows: In the formula, Anomaly detection results corresponding to the current charging period T; The length of the history window used for smoothing references; This indicates the minimum risk tolerance threshold; This indicates the threshold for moderate risk.
5. A charging anomaly detection device for an electric vehicle used to perform the charging anomaly detection method for an electric vehicle as described in claim 1, characterized in that, It includes a charging data preprocessing unit, a time-domain feature extraction unit, a spectrum feature extraction unit, a time-frequency feature splicing unit, a time-frequency feature dynamic fusion unit, and an anomaly identification unit; The charging data preprocessing unit is used to preprocess the charging voltage data and charging current data to generate charging time domain information and charging frequency domain information. The time-domain feature extraction unit is used to extract time-domain features from charging time-domain information to form a charging time-domain feature vector; The spectrum feature extraction unit is used to extract spectrum features from the charging frequency domain information to form a charging spectrum feature vector; The time-frequency feature splicing unit is used to splice the charging time-domain feature vector and the charging spectrum feature vector to obtain the spliced charging feature vector. The time-frequency feature dynamic fusion unit is used to perform attention feature fusion on the spliced charging feature vector according to dynamic environmental factors to generate a fused charging feature vector. The anomaly identification unit is used to identify anomalies in the fused charging feature vector and generate anomaly detection results corresponding to the current charging period.
6. The electric vehicle charging anomaly detection device according to claim 5, characterized in that, The temporal feature extraction unit includes a voltage convolutional layer, a voltage embedding layer, a current convolutional layer, a current embedding layer, a bidirectional cross-attention layer, a temporal feature fusion layer, and a bidirectional long short-term memory neural network layer. The voltage convolutional layer is used to perform one-dimensional convolution operations on the voltage time-domain information in the charging time-domain information to form a local feature sequence of voltage. The voltage embedding layer is used to perform vector encoding on the local feature sequence of voltage, so as to form a fixed-dimensional embedding vector sequence, thereby obtaining the voltage embedding vector. The current convolutional layer is used to perform one-dimensional convolution operations on the current time-domain information in the charging time-domain information to form a local feature sequence of the current. The current embedding layer is used to perform vector encoding on the local feature sequence of the current, thereby obtaining the embedding vector of the current. The bidirectional cross-attention layer is used to generate weights by using the voltage embedding vector as the query vector and the current embedding vector as the key vector, and then multiplies and fuses the weights with the current embedding vector to obtain the enhanced current embedding vector. Simultaneously, the current embedding vector is used as the query vector, and the voltage embedding vector is used as the key vector to generate weights. The weights are then multiplied and fused with the voltage embedding vector to obtain the enhanced voltage embedding vector. The time-domain feature fusion layer is used to sequentially concatenate and fully connect the enhanced voltage embedding vector and the enhanced current embedding vector to obtain the initially fused charging time-domain feature vector. The bidirectional long short-term memory neural network layer is used to extract bidirectional time-series features from the initially fused charging time-domain feature vector, so as to extract the contextual feature representation reflected in the joint evolution of voltage and current, and form the final charging time-domain feature vector.
7. The charging anomaly detection device for electric vehicles according to claim 6, characterized in that, The spectral feature extraction unit includes a spectral input reconstruction module, a depthwise separable convolution module, a channel compression module, and a spectral embedding layer; The spectrum input reconstruction module is used to splice the voltage spectrum information and current spectrum information in the charging frequency domain information in the channel dimension to form a two-dimensional spectrum tensor. The depthwise separable convolution module is used to perform depthwise separable convolution feature extraction on the two-dimensional spectral tensor to obtain a two-dimensional spectral feature vector. The channel compression module is used to perform pointwise convolution on the two-dimensional spectral feature vector to obtain compressed two-dimensional spectral features. The spectrum embedding layer is used to perform feature mapping and nonlinear transformation on the compressed spectrum features to generate a fixed-dimensional spectrum embedding vector and obtain the charging spectrum feature vector.
8. The charging anomaly detection device for electric vehicles according to claim 7, characterized in that, The dynamic environmental factors are generated through a lightweight neural network, the specific structure of which is shown below: In the formula, Represents dynamic environmental factors; This indicates the input of environmental data; This represents a multilayer perceptron, consisting of several fully connected layers and nonlinear activation functions, used to extract the nonlinear features implicit in the input feature vector of environmental data. For matrix transformation operations; In step S4, attention feature fusion is used to calculate attention weights by using the dynamic environmental factors as query vectors and the concatenated charging feature vectors as key vectors, and then multiplying the weights by the concatenated charging feature vectors to generate a fused charging feature vector.
9. A charging pile, characterized in that, This includes an electrical parameter acquisition module, an environmental data acquisition sensor, and a charging anomaly detection device for electric vehicles; The electrical parameter acquisition module includes a voltage sensor and a current sensor installed in the charging path, which are used to collect the output voltage data and output current data of the charging gun in real time during the charging process, digitize them to form charging voltage data and charging current data, and transmit them to the charging abnormality detection device of the electric vehicle. The environmental data acquisition sensors are installed inside the charging pile housing and the charging gun, respectively, to collect the temperature data of the charging pile and the temperature data of the charging gun, and then digitize them and transmit them to the charging anomaly detection device of the electric vehicle. The electric vehicle charging anomaly detection device is the electric vehicle charging anomaly detection device according to any one of claims 5-8.
Citation Information
Patent Citations
Intelligent control system and method of charging pile
CN116639010A
Fault diagnosis method and device and computer program product
CN119475233A