A detection method for illegal charging of battery vehicles

By combining self-supervised learning, contrastive learning and variational autoencoder technology, edge computing is used to detect illegal charging of battery vehicles, which solves the problem of relying on manual experience and high data labeling costs in the existing technology, and achieves efficient, accurate and real-time detection. Violation detection significantly improves detection accuracy and real-time performance.

CN118514566BActive Publication Date: 2024-09-10ZHUHAI GONGFENG NEW ENERGY DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410958337.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2024-09-10
Estimated Expiration
2044-07-17

AI Technical Summary

Technical Problem

Existing battery vehicle charging violation detection methods rely on manual experience, have high data annotation costs, lack of real-time detection, and poor model generalization capabilities, making it difficult to achieve efficient, accurate, and real-time violation detection.

Method used

Combining self-supervised learning, contrastive learning, variational autoencoder (VAE) and edge computing technology, it collects data in real time through sensors, generates pseudo labels, performs data enhancement and multi-perspective analysis, and deploys SimCLR and VAE models to perform real-time on edge devices. processing and anomaly detection.

Benefits of technology

It reduces data annotation costs, improves detection accuracy and real-time performance, reduces missed detection and false detection rates, enables real-time monitoring and rapid response to the battery vehicle charging process, and ensures the safety and compliance of the charging process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118514566B
    Figure CN118514566B
Patent Text Reader

Abstract

The present invention discloses a detection method for illegal charging of electric battery vehicles, comprising the following steps: S1, installing sensors on electric battery vehicles and charging piles, collecting current, voltage, and temperature charging data in real time, and performing preliminary processing on edge devices; S2, generating pseudo labels through self-supervised learning; S3, generating different views through data enhancement technology, and using the contrastive learning model SimCLR training model to learn the feature representation of the charging process under different views; S4, using variational autoencoders to model normal charging data and generate a distribution model of the normal charging process; S5, deploying the trained SimCLR contrastive learning model and VAE model on the edge computing node, processing sensor data in real time, and when abnormal charging behavior is detected, the system immediately sends an alarm signal to notify the user or management system to take measures. The present invention provides an efficient and accurate solution for the detection of illegal charging of electric battery vehicles by combining machine learning algorithms and edge computing technologies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of deep learning technology, and in particular to a method for detecting illegal charging of electric battery vehicles. Background Art

[0002] With the popularity of electric vehicles, the charging safety of electric vehicles has received increasing attention. During the charging process of electric vehicles, if the operation is improper or non-compliant charging equipment is used, serious safety accidents such as fire and explosion may occur. Therefore, real-time monitoring and anomaly detection of the charging process of electric vehicles are particularly important. At present, the detection technology of illegal charging of electric vehicles mainly relies on traditional rule engines and manual monitoring. These methods have the following core difficulties:

[0003] 1. Reliance on human experience: Existing detection methods often rely on the operator's experience to determine whether charging is normal by observing the changes in current, voltage and temperature during the charging process. This method is not only time-consuming and laborious, but also easily affected by human factors, resulting in insufficient detection accuracy.

[0004] 2. High cost of data annotation: In order to train a high-precision detection model, a large amount of labeled data is usually required. However, manual data annotation is not only costly but also inefficient, making it difficult to meet the needs of actual applications.

[0005] 3. Insufficient real-time detection: Traditional detection methods often require data to be transmitted to a central server for processing and analysis, which will result in high latency and make it difficult to achieve real-time monitoring and rapid response to the battery vehicle charging process.

[0006] 4. Poor model generalization ability: Due to the complexity and diversity of electric vehicle charging scenarios, existing detection models often find it difficult to cope with charging behaviors in different environments, have poor generalization capabilities, and are prone to missed detections and false detections.

[0007] Therefore, how to use advanced machine learning technology and edge computing technology to develop a method for detecting illegal charging of electric bicycles that can reduce data annotation costs and improve detection accuracy and real-time performance is an urgent problem that technical personnel in this field need to solve. Summary of the invention

[0008] This patent proposes a method for detecting illegal charging of electric battery vehicles that combines self-supervised learning, contrastive learning, variational autoencoder (VAE) and edge computing, aiming to effectively solve the above-mentioned problems in the prior art. One purpose of the present invention is to propose a method for detecting illegal charging of electric battery vehicles. By combining advanced machine learning algorithms and edge computing technology, the present invention provides an efficient, accurate and real-time solution for detecting illegal charging of electric battery vehicles, which has high application value and broad market prospects.

[0009] A method for detecting illegal charging of an electric battery vehicle according to an embodiment of the present invention comprises the following steps:

[0010] S1. Install sensors on battery vehicles and charging piles to collect current, voltage, and temperature charging data in real time, and perform preliminary processing on edge devices;

[0011] S2, generate pseudo labels through self-supervised learning;

[0012] S3, generate different views through data enhancement technology, and use the contrastive learning model SimCLR to train the model to learn the feature representation of the charging process under different views;

[0013] S4. Use a variational autoencoder to model normal charging data and generate a distribution model of the normal charging process;

[0014] S5. Deploy the trained SimCLR comparative learning model and VAE model on the edge computing node to process sensor data in real time. When abnormal charging behavior is detected, the system immediately sends an alarm signal to notify the user or management system to take measures.

[0015] Optionally, the S1 specifically includes:

[0016] S11. Install a current sensor, a voltage sensor and a temperature sensor on the battery vehicle to collect current, voltage and temperature data during the charging process in real time;

[0017] S12, installing corresponding current sensors, voltage sensors and temperature sensors on the charging pile to collect current, voltage and temperature data of the charging pile in real time;

[0018] S13, the collected current data is expressed as , the voltage data is expressed as , the temperature data is expressed as ;

[0019] S14: Use edge computing devices to preliminarily process the collected current, voltage, and temperature data to calculate real-time power ;

[0020] S15, by calculating the power change rate Detect rapid changes;

[0021] S16, the processed data , , , and Stored in the cache of the edge computing device.

[0022] Optionally, the S2 specifically includes:

[0023] S21: The charging data preliminarily processed on the edge device , , , and Perform data preprocessing;

[0024] S22, using a self-supervised learning method to generate pseudo labels, automatically labeling unlabeled data, and dividing the charging data into normal charging data and potential abnormal charging data;

[0025] S23. Design comparative learning tasks, generate different views through data enhancement technology, add noise, time series disturbance, etc., to obtain enhanced data views and ;

[0026] S24. Use the SimCLR model for contrastive learning, and train the contrastive learning model by maximizing the similarity of feature representations of the same charging process under different views;

[0027] S25. Setting loss function is the contrast loss function:

[0028] ; Loss function

[0029] in, represents the similarity function, represents the feature representation of the model, is the temperature parameter;

[0030] S26. By optimizing the loss function , train the SimCLR model so that it can learn the feature representation of the charging process under different views;

[0031] S27. Use the trained SimCLR model to characterize the charging data, input the pseudo-label data into the model, and obtain the feature representation of the charging process.

[0032] Optionally, the S22 specifically includes:

[0033] S221. Calculate the data feature vector at each time point , which contains the current ,Voltage ,temperature ,power and power change rate :

[0034] ];

[0035] S222. Design a self-supervised task. Through time series prediction, divide the data into input sequence and target sequence. The input sequence is arrive , the target sequence is ;

[0036] S223, use the Transformer model for time series prediction. The Transformer model includes an encoder and a decoder. The encoder takes the input sequence arrive Encoded as hidden representation , the decoder is based on the hidden representation Generate feature representation of target sequence ;

[0037] S224. Set the loss function of the Transformer model to the prediction error :

[0038] ;

[0039] in, represents the actual target sequence feature vector, Represents the target sequence feature vector predicted by the model;

[0040] S225, based on prediction error Perform cluster analysis and use K-means clustering to divide the data into normal charging data and potential abnormal charging data. The cluster center is represented as ;

[0041] S226. Calculate the distance from each data point to the cluster center and assign pseudo labels :

[0042] ;

[0043] in, Indicates time point The corresponding pseudo-labels are Indicates Cluster centers.

[0044] Optionally, the S23 specifically includes:

[0045] S231. Perform data enhancement and define multiple enhancement operations , including random noise , time reversal , timing disturbance :

[0046] ;

[0047] ;

[0048] in, Represents the original charging data, It means that the mean is 0 and the variance is Random noise sampled from a Gaussian distribution, It means that the mean is 0 and the variance is A temporal perturbation sampled from a Gaussian distribution;

[0049] S232, generate multiple enhanced views, each original data Generate a pair of enhanced views :

[0050] ;

[0051] in, Indicates Raw charging data samples, and Respectively represent View of samples after noise enhancement and timing perturbation;

[0052] S233, by applying the normalization operation on the generated views, the representation consistency of different views in the same feature space is achieved;

[0053] S234, the enhanced view and The data is input into the contrastive learning model for training, and the feature representation of the charging process is learned by maximizing the similarity of feature representations of the same charging process in different views.

[0054] Optionally, the S3 specifically includes:

[0055] S31. Using the enhanced charging data view and , normalize the enhanced charging data view:

[0056] ;

[0057] in, is the original data view, is the mean of the data, is the standard deviation of the data;

[0058] S32. Set the architecture of the contrastive learning model SimCLR, including the encoder network and projection head :

[0059] ;

[0060] in, To pass the encoder network The extracted features represent To pass through the projection head The obtained feature vector is This is the normalized data view;

[0061] S33, Computational Enhanced View and The feature representation and , and the corresponding projection vector and :

[0062] ;

[0063] ;

[0064] in, and It is an enhanced view after standardization. and is through the encoder network, The extracted features represent and Through the projection head, The obtained feature vector;

[0065] S34. Define different loss functions for contrastive learning :

[0066] ;

[0067] in, is the temperature parameter, which controls the smoothness of the similarity distribution. and is the projection vector, and is the norm of the corresponding vector, is the batch size;

[0068] S35. By optimizing the loss function Perform model training and update the encoder network and projection head The parameters of maximizing the similarity of feature representations of the same charging process in different views;

[0069] S36. After the training is completed, the SimCLR model is saved and deployed to the edge computing node to process and analyze the charging data in real time;

[0070] S37. Use the trained SimCLR model to extract features from the charging data collected in real time, generate feature representation of the charging process, and provide input data for subsequent anomaly detection.

[0071] Optionally, the S4 specifically includes:

[0072] S41, obtaining a characteristic representation of the charging data processed by the SimCLR model in claim 4 ;

[0073] S42. Construct a variational autoencoder model. The VAE model includes an encoder network and decoder network ,in represents the input features, represents latent variables;

[0074] S43, using normal charging data characteristics The VAE model is trained by maximizing the following evidence lower bound loss function:

[0075] ;

[0076] in, represents the loss function of the lower bound of the evidence, represents the expected value, which is the value of the latent variable On the basis of the encoder distribution Calculated, Indicates that given the latent variable In the case of , the decoder generates input features The logarithmic probability of represents the Kullback-Leibler divergence, which is used to measure the difference between two distributions. Represents the encoder network, given the input features Latent variables are generated later The distribution of Represents latent variables The prior distribution of

[0077] S44, encoder network The normal charging data characteristics of the input Mapping to latent variables Distribution:

[0078] ;

[0079] in, represents a normal distribution, represents the mean generated by the encoder network, represents the variance generated by the encoder network;

[0080] S45, decoder network According to the latent variable Generate and normal charging data characteristics Similar reconstruction features :

[0081] ;

[0082] in, represents the mean generated by the decoder network, represents the variance generated by the decoder network;

[0083] S46. During the training process, the parameters of the VAE model are optimized by minimizing the weighted sum of the reconstruction error and the Kullback-Leibler divergence. and :

[0084] ;

[0085] in, is the number of reconstruction samples, is from latent variables sampled in;

[0086] Calculation of Kullback-Leibler divergence:

[0087] ;

[0088] in, is the dimension of the latent variable, and Respectively represent Variance and mean of the dimension;

[0089] S47. Use the trained VAE model to infer the actual charging data features and calculate the reconstruction features With actual characteristics The reconstruction error between , and identify abnormal charging behavior based on the size of the reconstruction error.

[0090] Optionally, the S5 specifically includes:

[0091] S51. Deploy the trained SimCLR contrastive learning model and variational autoencoder model on the edge computing node.

[0092] S52. Real-time acquisition of charging data feature representation collected on edge devices ,in Indicates at time The characteristics of the moment;

[0093] S53, representing the real-time charging data characteristics Input SimCLR model and extract its feature representation ;

[0094] S54, the extracted features are represented Input VAE model and calculate its latent variables :

[0095] ;

[0096] in, represents the latent variable distribution generated by the encoder network of the VAE model;

[0097] S55. Decoder network using VAE model, according to latent variables Generating Reconstructed Feature Representations :

[0098] ;

[0099] in, represents the reconstructed feature distribution generated by the decoder network of the VAE model;

[0100] S56. Calculate the actual feature representation and reconstructed feature representation The reconstruction error between , where the reconstruction error is:

[0101] ;

[0102] in, Represents the dimension of the feature, and Respectively represent The actual eigenvalues ​​and reconstructed eigenvalues ​​of the dimension;

[0103] S57, the calculated reconstruction error With the preset threshold When the reconstruction error is greater than the threshold When the battery is charged, it is identified as abnormal charging behavior and an alarm signal is issued;

[0104] S58. When abnormal charging behavior is detected, the system immediately notifies the user or the management system to take measures.

[0105] The beneficial effects of the present invention are:

[0106] The present invention makes full use of self-supervised learning, contrastive learning, variational autoencoder (VAE) and edge computing technology, and describes in detail the method for detecting illegal charging of battery vehicles, which has the following advantages:

[0107] 1. Reduce dependence on labeled data: Generate pseudo labels through self-supervised learning, reduce the need for a large amount of manually labeled data, reduce data labeling costs, and improve data processing efficiency.

[0108] 2. Improve detection accuracy: Combining the SimCLR contrastive learning model and the variational autoencoder (VAE) model, the charging data is analyzed from multiple perspectives to effectively learn the characteristic differences between normal charging and illegal charging, thereby improving the robustness and accuracy of the detection model and significantly reducing the missed detection and false detection rates.

[0109] 3. Enhance real-time performance and efficiency: By deploying edge computing nodes at the battery vehicle or charging pile end, charging data is collected and processed in real time, which reduces data transmission delays, realizes real-time monitoring and rapid response of the charging process, and improves the real-time performance and response speed of the system.

[0110] 4. Distributed computing: Deploy the trained contrastive learning model and VAE model on edge devices to share the computing load of the central server and improve the computing efficiency and reliability of the overall system.

[0111] 5. High safety: When abnormal charging behavior is detected, the system can promptly send out an alarm signal to notify the user or management system to take measures to ensure the safety and compliance of the charging process and effectively prevent potential safety hazards that may occur during the charging process.

[0112] By combining advanced machine learning algorithms and edge computing technologies, the present invention provides an efficient, accurate and real-time solution for the detection of illegal charging of electric bicycles, which has high application value and broad market prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0113] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0114] Figure 1 The overall process of the present invention is demonstrated, including data collection and preprocessing, pseudo-label generation by self-supervised learning, SimCLR contrastive learning model training, VAE model training, and real-time detection on edge computing nodes;

[0115] Figure 2 The training process of the SimCLR contrastive learning model is demonstrated, including the specific steps of data augmentation to generate different views, feature representation extraction, and contrastive learning training. DETAILED DESCRIPTION

[0116] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, which only illustrate the basic structure of the present invention in a schematic manner, and therefore only show the components related to the present invention.

[0117] refer to Figure 1 A method for detecting illegal charging of a battery vehicle comprises the following steps:

[0118] S1. Install sensors on battery vehicles and charging piles to collect current, voltage, and temperature charging data in real time, and perform preliminary processing on edge devices;

[0119] In this implementation, S1 specifically includes:

[0120] S11. Install a current sensor, a voltage sensor and a temperature sensor on the battery vehicle to collect current, voltage and temperature data during the charging process in real time;

[0121] S12, installing corresponding current sensors, voltage sensors and temperature sensors on the charging pile to collect current, voltage and temperature data of the charging pile in real time;

[0122] S13, the collected current data is expressed as , the voltage data is expressed as , the temperature data is expressed as ;

[0123] S14: Use edge computing devices to preliminarily process the collected current, voltage, and temperature data to calculate real-time power ;

[0124] S15, by calculating the power change rate Detect rapid changes;

[0125] S16, the processed data , , , and Stored in the cache of the edge computing device.

[0126] S2, generate pseudo labels through self-supervised learning;

[0127] In this implementation, S2 specifically includes:

[0128] S21: The charging data preliminarily processed on the edge device , , , and Perform data preprocessing;

[0129] S22, using a self-supervised learning method to generate pseudo labels, automatically labeling unlabeled data, and dividing the charging data into normal charging data and potential abnormal charging data;

[0130] S23. Design comparative learning tasks, generate different views through data enhancement technology, add noise, time series disturbance, etc., to obtain enhanced data views and ;

[0131] S24. Use the SimCLR model for contrastive learning, and train the contrastive learning model by maximizing the similarity of feature representations of the same charging process under different views;

[0132] S25. Setting loss function is the contrast loss function:

[0133] ;

[0134] in, represents the similarity function, represents the feature representation of the model, is the temperature parameter;

[0135] S26. By optimizing the loss function , train the SimCLR model so that it can learn the feature representation of the charging process under different views;

[0136] S27. Use the trained SimCLR model to characterize the charging data, input the pseudo-label data into the model, and obtain the feature representation of the charging process.

[0137] S21: The charging data preliminarily processed on the edge device , , , and Perform data preprocessing;

[0138] S22, using a self-supervised learning method to generate pseudo labels, automatically labeling unlabeled data, and dividing the charging data into normal charging data and potential abnormal charging data;

[0139] In this implementation, S22 specifically includes:

[0140] S221. Calculate the data feature vector at each time point , which contains the current ,Voltage ,temperature ,power and power change rate :

[0141] ];

[0142] S222. Design a self-supervised task. Through time series prediction, divide the data into input sequence and target sequence. The input sequence is arrive , the target sequence is ;

[0143] S223, use the Transformer model for time series prediction. The Transformer model includes an encoder and a decoder. The encoder takes the input sequence arrive Encoded as hidden representation , the decoder is based on the hidden representation Generate feature representation of target sequence ;

[0144] S224. Set the loss function of the Transformer model to the prediction error :

[0145] ;

[0146] in, represents the actual target sequence feature vector, Represents the target sequence feature vector predicted by the model;

[0147] S225, based on prediction error Perform cluster analysis and use K-means clustering to divide the data into normal charging data and potential abnormal charging data. The cluster center is represented as ;

[0148] S226. Calculate the distance from each data point to the cluster center and assign pseudo labels :

[0149] ;

[0150] in, Indicates time point The corresponding pseudo-labels are Indicates Cluster centers.

[0151] S23. Design comparative learning tasks, generate different views through data enhancement technology, add noise, time series disturbance, etc., to obtain enhanced data views and ;

[0152] In this implementation, S23 specifically includes:

[0153] S231. Perform data enhancement and define multiple enhancement operations , including random noise , time reversal , timing disturbance :

[0154] ;

[0155] ;

[0156] in, Represents the original charging data, It means that the mean is 0 and the variance is Random noise sampled from a Gaussian distribution, It means that the mean is 0 and the variance is A temporal perturbation sampled from a Gaussian distribution;

[0157] S232, generate multiple enhanced views, each original data Generate a pair of enhanced views :

[0158] ;

[0159] in, Indicates Raw charging data samples, and Respectively represent View of samples after noise enhancement and timing perturbation;

[0160] S233, by applying the normalization operation on the generated views, the representation consistency of different views in the same feature space is achieved;

[0161] S234, the enhanced view and The data is input into the contrastive learning model for training, and the feature representation of the charging process is learned by maximizing the similarity of feature representations of the same charging process in different views.

[0162] S3, generate different views through data enhancement technology, and use the contrastive learning model SimCLR to train the model to learn the feature representation of the charging process under different views;

[0163] In this implementation, S3 specifically includes:

[0164] S31. Using the enhanced charging data view and , normalize the enhanced charging data view:

[0165] ;

[0166] in, is the original data view, is the mean of the data, is the standard deviation of the data;

[0167] S32. Set the architecture of the contrastive learning model SimCLR, including the encoder network and projection head :

[0168] ;

[0169] in, To pass the encoder network The extracted features represent To pass through the projection head The obtained feature vector is This is the normalized data view;

[0170] S33, Computational Enhanced View and The feature representation and , and the corresponding projection vector and :

[0171] ;

[0172] ;

[0173] in, and It is an enhanced view after standardization. and is through the encoder network, The extracted features represent and Through the projection head, The obtained feature vector;

[0174] S34. Define different loss functions for contrastive learning :

[0175] ;

[0176] in, is the temperature parameter, which controls the smoothness of the similarity distribution. and is the projection vector, and is the norm of the corresponding vector, is the batch size;

[0177] S35. By optimizing the loss function Perform model training and update the encoder network and projection head The parameters of maximizing the similarity of feature representations of the same charging process in different views;

[0178] S36. After the training is completed, the SimCLR model is saved and deployed to the edge computing node to process and analyze the charging data in real time;

[0179] S37. Use the trained SimCLR model to extract features from the charging data collected in real time, generate feature representation of the charging process, and provide input data for subsequent anomaly detection.

[0180] S4. Use a variational autoencoder to model normal charging data and generate a distribution model of the normal charging process;

[0181] In this implementation, S4 specifically includes:

[0182] S41, obtaining a characteristic representation of the charging data processed by the SimCLR model in claim 4 ;

[0183] S42. Construct a variational autoencoder model. The VAE model includes an encoder network and decoder network ,in represents the input features, represents latent variables;

[0184] S43, using normal charging data characteristics The VAE model is trained by maximizing the following evidence lower bound loss function:

[0185] ;

[0186] in, represents the loss function of the lower bound of the evidence, represents the expected value, which is the value of the latent variable On the basis of the encoder distribution Calculated, Indicates that given the latent variable In the case of , the decoder generates input features The logarithmic probability of represents the Kullback-Leibler divergence, which is used to measure the difference between two distributions. Represents the encoder network, given the input features Latent variables are generated later The distribution of Represents latent variables The prior distribution of

[0187] S44, encoder network The normal charging data characteristics of the input Mapping to latent variables Distribution:

[0188] ;

[0189] in, represents a normal distribution, represents the mean generated by the encoder network, represents the variance generated by the encoder network;

[0190] S45, decoder network According to the latent variable Generate and normal charging data characteristics Similar reconstruction features :

[0191] ;

[0192] in, represents the mean generated by the decoder network, represents the variance generated by the decoder network;

[0193] S46. During the training process, the parameters of the VAE model are optimized by minimizing the weighted sum of the reconstruction error and the Kullback-Leibler divergence. and :

[0194] ;

[0195] in, is the number of reconstruction samples, is from latent variables sampled in;

[0196] Calculation of Kullback-Leibler divergence:

[0197] ;

[0198] in, is the dimension of the latent variable, and Respectively represent Variance and mean of the dimension;

[0199] S47. Use the trained VAE model to infer the actual charging data features and calculate the reconstruction features With actual characteristics The reconstruction error between , and identify abnormal charging behavior based on the size of the reconstruction error.

[0200] S5. Deploy the trained SimCLR comparative learning model and VAE model on the edge computing node to process sensor data in real time. When abnormal charging behavior is detected, the system immediately sends an alarm signal to notify the user or management system to take measures.

[0201] In this implementation, S5 specifically includes:

[0202] S51. Deploy the trained SimCLR comparative learning model and variational autoencoding on edge computing nodes

[0203] Device model;

[0204] S52. Real-time acquisition of charging data feature representation collected on edge devices ,in Indicates at time The characteristics of the moment;

[0205] S53, representing the real-time charging data characteristics Input SimCLR model and extract its feature representation ;

[0206] S54, the extracted features are represented Input VAE model and calculate its latent variables :

[0207] ;

[0208] in, represents the latent variable distribution generated by the encoder network of the VAE model;

[0209] S55. Decoder network using VAE model, according to latent variables Generating Reconstructed Feature Representations :

[0210] ;

[0211] in, represents the reconstructed feature distribution generated by the decoder network of the VAE model;

[0212] S56. Calculate the actual feature representation and reconstructed feature representation The reconstruction error between , where the reconstruction error is:

[0213] ;

[0214] in, Represents the dimension of the feature, and Respectively represent The actual eigenvalues ​​and reconstructed eigenvalues ​​of the dimension;

[0215] S57, the calculated reconstruction error With the preset threshold When the reconstruction error is greater than the threshold When the battery is charged, it is identified as abnormal charging behavior and an alarm signal is issued;

[0216] S58. When abnormal charging behavior is detected, the system immediately notifies the user or the management system to take measures.

[0217] Embodiment 1:

[0218] In order to verify the effectiveness of the battery vehicle illegal charging detection method proposed in the present invention, we conducted a large number of experiments and tested it in actual application scenarios. The following is a detailed description of a specific embodiment.

[0219] Scenario description:

[0220] The test site was selected at a large battery vehicle charging station, which handles the charging needs of about 1,000 battery vehicles every day, including normal charging and fast charging modes. 50 charging piles were installed in the charging station, each of which was equipped with a current sensor, a voltage sensor, and a temperature sensor for real-time charging data collection. The data collected by these sensors was initially processed by the edge computing node and then input into the contrastive learning model SimCLR and the variational autoencoder (VAE) model deployed on the edge device for real-time analysis.

[0221] In this scenario, we mainly face the following problems: 1. How to reduce the dependence on manually labeled data; 2. How to improve the accuracy of abnormal detection in the charging process; 3. How to achieve real-time detection and timely response; 4. How to improve the generalization ability of the model in a complex environment.

[0222] Application Process:

[0223] First, we use self-supervised learning methods to generate pseudo labels, reducing the need for a large amount of manually annotated data. By performing data enhancement on 5,000 normal charging data collected from August to December 2023, charging data pairs of different views are generated, and the SimCLR model is used for comparative learning training to obtain the feature representation of the charging process. In the data enhancement process, we use techniques such as adding noise and time series perturbation to ensure that the model can learn the diverse characteristics of the charging process.

[0224] Next, we used the variational autoencoder (VAE) model to model the normal charging data. The VAE model maps the normal charging data features to the distribution of latent variables through the encoder network, and then generates reconstructed data similar to the normal charging data through the decoder network. During the training process, we used a large amount of normal charging data for training to ensure that the model can accurately capture the distribution characteristics of the normal charging process.

[0225] In actual applications, charging data is collected in real time by sensors and transmitted to edge computing nodes for processing. The processed data is first extracted through the SimCLR model and then input into the trained VAE model for anomaly detection. The VAE model identifies abnormal charging behavior based on the degree of deviation between the actual charging data and the normal distribution. When abnormal charging behavior is detected, the system immediately sends an alarm signal to notify the management personnel of the charging station to take corresponding measures.

[0226] Specific data proves:

[0227] In order to verify the effectiveness of the method of the present invention, we conducted a long-term test in actual scenarios and collected a large amount of charging data. The test data includes 10,000 normal charging processes and 500 abnormal charging processes from January to March 2024. Abnormal charging includes excessive current, low voltage, abnormal temperature increase, etc.

[0228] During the test, our method showed excellent detection results. The following are the specific experimental data:

[0229] 1. Reduce dependency on labeled data:

[0230] For the pseudo labels generated by self-supervised learning, we only used about 2,000 manually labeled normal charging data for initial training. The remaining 8,000 normal charging data and 500 abnormal charging data were automatically labeled through self-supervised learning, saving a lot of manual labeling costs.

[0231] 2. Improve detection accuracy:

[0232] In 10,000 normal charging processes, our method only had 15 false positives, with a false positive rate of 0.15%. In 500 abnormal charging processes, our method successfully detected 485 abnormal behaviors, with a false negative rate of 3%. Compared with the traditional rule engine method, the false positive rate was reduced by 70% and the false negative rate was reduced by 50%. In traditional methods, the false positive rate is usually around 0.5% and the false negative rate is around 6%.

[0233] 3. Enhance real-time performance and efficiency:

[0234] Through the application of edge computing technology, the data transmission delay is reduced from 500 milliseconds in traditional methods to 50 milliseconds, and the real-time performance is significantly improved. The response time of the entire detection process is within 100 milliseconds, realizing real-time monitoring of the charging process. The detection response time of traditional methods is generally between 500-1000 milliseconds.

[0235] 4. Improve model generalization ability:

[0236] Under different charging environments, including high temperature (above 40°C), low temperature (below -10°C), humidity (relative humidity above 80%) and other complex conditions, the model can still maintain a high detection accuracy. After multiple environmental tests, the model's false alarm rate in high temperature environments is 0.2%, and the false alarm rate in low temperature environments is 3.5%, both significantly better than traditional methods. The false alarm rate of traditional methods in high temperature environments is about 0.7%, and the false alarm rate in low temperature environments is about 7%.

[0237] Table 1 Charging data collection and processing

[0238] Data collection time Normal charging times Abnormal charging times Remark August-December 2023 5000 0 Initial training data January-March 2024 5000 500 Test Data

[0239] Table 2 Comparison of detection accuracy

[0240] method Normal charging times Number of false positives False alarm rate (%) Abnormal charging times Number of missed reports Missing reporting rate (%) Method of the present invention 10000 15 0.15 500 15 3.00 Traditional rules engine approach 10000 50 0.50 500 30 6.00

[0241] Table 3 Comparison of real-time performance and response time

[0242] method Data transmission delay (milliseconds) Detection response time (milliseconds) Method of the present invention 50 100 Traditional rules engine approach 500 500-1000

[0243] Table 4 Model generalization ability test

[0244] Environmental conditions method Normal charging times False positives False alarm rate (%) Abnormal charging times Number of missed reports Missing reporting rate (%) High temperature (above 40℃) Method of the present invention 1000 2 0.20 100 3 3.00 High temperature (above 40℃) Traditional rules engine approach 1000 7 0.70 100 7 7.00 Low temperature (below -10℃) Method of the present invention 1000 3 0.30 100 4 4.00 Low temperature (below -10℃) Traditional rules engine approach 1000 10 1.00 100 10 10.00 Humidity (relative humidity above 80%) Method of the present invention 1000 1 0.10 100 2 2.00 Humidity (relative humidity above 80%) Traditional rules engine approach 1000 5 0.50 100 5 5.00

[0245] Referring to the above table, it can be seen that the method of the present invention has significant advantages in reducing the dependence on labeled data, improving detection accuracy, enhancing real-time performance and efficiency, and improving the generalization ability of the model. This method provides an efficient, accurate, and real-time solution for the detection of illegal charging of battery vehicles, which has high application value and broad market prospects.

[0246] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A method for detecting illegal charging of battery vehicles. It is characterized in that The steps include: S1. Install sensors on battery vehicles and charging piles to collect current, voltage, and temperature charging data in real time, and perform preliminary processing on edge devices; S2, generate pseudo labels through self-supervised learning; S3, generate different views through data enhancement technology, and use the contrastive learning model SimCLR to train the model to learn the feature representation of the charging process under different views; S4. Use a variational autoencoder to model normal charging data and generate a distribution model of the normal charging process; S5. Deploy the trained SimCLR comparative learning model and VAE model on the edge computing node to process sensor data in real time. When abnormal charging behavior is detected, the system immediately sends an alarm signal to notify the user or management system to take measures. The S2 specifically includes: S21, pre-processing the charging data I(t), V(t), T(t), P(t) and ΔP(t) preliminarily processed on the edge device; S22, using a self-supervised learning method to generate pseudo labels, automatically labeling unlabeled data, and dividing the charging data into normal charging data and potential abnormal charging data; S23. Design a comparative learning task, generate different views through data enhancement technology, add noise and time series disturbance, and obtain the enhanced data view X 1 and X 2 ; S24. Use the SimCLR model for contrastive learning, and train the contrastive learning model by maximizing the similarity of feature representations of the same charging process under different views; S25. Set the loss function L as the contrast loss function: Among them, sim represents the similarity function, h represents the characteristic representation of the model, and τ is the temperature parameter; S26. By optimizing the loss function L, the SimCLR model is trained so that it can learn the feature representation of the charging process under different views; S27, using the trained SimCLR model to characterize the charging data, inputting the pseudo-label data into the model, and obtaining the characteristic representation of the charging process; The S3 specifically includes: S31. Using the charging data view X after data enhancement 1 and X 2 , normalize the enhanced charging data view: Where X is the original data view, μ is the mean of the data, and σ is the standard deviation of the data; S32. Set the architecture of the contrastive learning model SimCLR, including the encoder network f(·) and the projection head g(·): h i =f(X′ i ),z i =g(h i ); Among them, h i is the feature representation extracted by the encoder network f(·), z i is the feature vector obtained by the projection head g(·), X′ i This is the normalized data view; S33. Calculate enhanced view X′ 1 and X′ 2 The characteristic representation h 1 and h 2 , and the corresponding projection vector z 1 and z 2 : h 1 =f(X′ 1 ),h 2 =f(X′ 2 ); z 1 =g(h 1 ),z 2 =g(h 2 ); Among them, X′ 1 and X′ 2 is the enhanced view after normalization, h 1 and h 2 is the feature representation extracted by the encoder network, f(·), z 1 and z 2 is the feature vector obtained by the projection head, g(·); S34. Define different loss functions L′ for contrastive learning: Among them, τ is the temperature parameter, which controls the smoothness of the similarity distribution, z i,1 and z i,2 is the projection vector, ||z i,1 || and ||z i,2 || is the norm of the corresponding vector, and N is the batch size; S35, training the model by optimizing the loss function L′, updating the parameters of the encoder network f(·) and the projection head g(·) to maximize the similarity of feature representation of the same charging process under different views; S36. After the training is completed, the SimCLR model is saved and deployed to the edge computing node to process and analyze the charging data in real time; S37, using the trained SimCLR model to extract features from the real-time collected charging data, generate feature representations of the charging process, and provide input data for subsequent anomaly detection; The S4 specifically includes: S41, obtaining a characteristic representation h of the charging data processed by the SimCLR model; S42, build a variational autoencoder model, the VAE model includes the encoder network q φ (z|h) and the decoder network p θ (h|z), where h represents the input feature and z represents the latent variable; S43. Use the normal charging data feature h to train the VAE model and optimize it by maximizing the following evidence lower bound loss function: Among them, L ELBO represents the loss function of the lower bound of the evidence, represents the expected value, which is on the latent variable z, according to the encoder distribution q φ (z|h), logz represents the logarithmic probability of the decoder generating the input feature h given the latent variable z, D KL represents the Kullback-Leibler divergence, which is used to measure the difference between two distributions, q φ (z|h) represents the encoder network, which generates the distribution of the latent variable z given the input feature h, and p(z) represents the prior distribution of the latent variable z; S44, encoder network q φ (z|h) maps the input normal charging data feature h to the distribution of the latent variable z: Where N represents normal distribution, μ φ (h) represents the mean generated by the encoder network, represents the variance generated by the encoder network; S45, decoder network p θ (h|z) Generates a reconstructed feature similar to the normal charging data feature h based on the latent variable z Among them, μ θ (z) represents the mean generated by the decoder network, represents the variance generated by the decoder network; S46. During the training process, the parameters φ and θ of the VAE model are optimized by minimizing the weighted sum of the reconstruction error and the Kullback-Leibler divergence: Where L is the number of reconstructed samples, z (l) From q φ latent variables sampled in (z|h); Calculation of Kullback-Leibler divergence: Where J is the dimension of the latent variable, and Respectively represent the variance and mean of the j-th dimension; S47. Use the trained VAE model to infer the actual charging data features and calculate the reconstruction features The reconstruction error between the actual feature h And identify abnormal charging behavior based on the size of the reconstruction error; The S5 specifically includes: S51. Deploy the trained SimCLR contrastive learning model and variational autoencoder model on the edge computing node. S52, acquiring charging data feature representation h(t) collected on the edge device in real time, where h(t) represents the feature at time t; S53, input the real-time charging data feature representation h(t) into the SimCLR model, and extract its feature representation h simclr (t); S54, the extracted features are represented as h simclr (t) Input the VAE model and calculate its latent variable z(t): z(t)=q φ (z|h simclr (t)); Among them, q φ (z|h simclr (t)) represents the latent variable distribution generated by the encoder network of the VAE model; S55. Use the decoder network of the VAE model to generate a reconstructed feature representation based on the latent variable z(t) Among them, p θ (h|z(t)) represents the reconstructed feature distribution generated by the decoder network of the VAE model; S56. Calculate the actual feature representation h simclr (t) and reconstructed feature representation The reconstruction error between The reconstruction error is: Among them, N represents the dimension of the feature, h simclr,i (t) and Represent the actual eigenvalue and reconstructed eigenvalue of the i-th dimension respectively; S57, the calculated reconstruction error Compare with the preset threshold ∈, when the reconstruction error is greater than the threshold ∈, it is identified as abnormal charging behavior and an alarm signal is issued; S58. When abnormal charging behavior is detected, the system immediately notifies the user or the management system to take measures.

2. A method for detecting illegal charging of battery vehicles according to claim 1, It is characterized in that The S1 specifically includes: S11. Install a current sensor, a voltage sensor and a temperature sensor on the battery vehicle to collect current, voltage and temperature data during the charging process in real time; S12, installing corresponding current sensors, voltage sensors and temperature sensors on the charging pile to collect current, voltage and temperature data of the charging pile in real time; S13, the collected current data is expressed as I(t), the voltage data is expressed as V(t), and the temperature data is expressed as T(t); S14, preliminarily processing the collected current, voltage and temperature data through the edge computing device to calculate the real-time power P(t); S15, detecting rapid changes by calculating the power change rate ΔP(t); S16. Store the processed data I(t), V(t), T(t), P(t) and ΔP(t) in the cache of the edge computing device.

3. A method for detecting illegal charging of battery vehicles according to claim 1, It is characterized in that The S22 specifically includes: S221. Calculate the data feature vector X(t) at each time point, which includes current I(t), voltage V(t), temperature T(t), power P(t) and power change rate ΔP(t): X(t)=[I(t),V(t),T(t),P(t),ΔP(t)]; S222. Design a self-supervised task. Through time series prediction, divide the data into input sequence and target sequence. The input sequence is X(t) to X(t+k), and the target sequence is X(t+k+1). S223. Use the Transformer model for time series prediction. The Transformer model includes an encoder and a decoder. The encoder encodes the input sequence X(t) to X(t+k) into a hidden representation H, and the decoder generates a feature representation of the target sequence based on the hidden representation H. S224. Set the loss function of the Transformer model to the prediction error E(t): Among them, X(t+k+1) represents the actual target sequence feature vector, Represents the target sequence feature vector predicted by the model; S225. Perform cluster analysis based on the prediction error E(t), use K-means clustering to divide the data into normal charging data and potential abnormal charging data, and the cluster center is represented by C 1 ,C 2 ,…,C K ; S226. Calculate the distance from each data point to the cluster center and assign pseudo labels in, represents the pseudo label corresponding to time point t, C i represents the i-th cluster center.

4. A method for detecting illegal charging of battery vehicles according to claim 3, It is characterized in that The S23 specifically includes: S231, perform data enhancement and define multiple enhancement operations A, including random noise A noise , time reversal A reverse , timing disturbance A shift : X 1 =A noise (X)=X+∈ noise ,∈ noise ~N(0,σ 2 ); X 2 =A shift (X)=X+∈ shift ,∈ shift ~N(0,δ 2 ); Where X represents the original charging data, ∈ noise It means that the mean is 0 and the variance is σ 2 Random noise sampled from a Gaussian distribution, ∈ shift It means that the mean is 0 and the variance is δ 2 A temporal perturbation sampled from a Gaussian distribution; S232, generate multiple enhanced views, and generate a pair of enhanced views (X) for each original data X 1 ,X 2 ): (X 1,i ,X 2,i )=(A noise (X i ),A shift (X i )); Among them, X i represents the i-th raw charging data sample, X 1,i and X 2,i They represent the views of the i-th sample after noise enhancement and timing perturbation respectively; S233, by applying the normalization operation on the generated views, the representation consistency of different views in the same feature space is achieved; S234: The enhanced view X′ 1 and X′ 2 The data is input into the contrastive learning model for training, and the feature representation of the charging process is learned by maximizing the similarity of feature representations of the same charging process in different views.