Development and Simulation of Real-Time Early Warning Protection System for Electric Vehicle Charging Based on a Two-Layer Protection Model

: With the increase of ﬁre problems of new energy vehicles (EVs), more and more attention has been paid to charging safety. Firstly, the charging safety problems and protection strategies in the power grid are summarized from the grid side, the charging equipment side, the vehicle side, and the operation platform side, and a solution for the vehicle side charging safety protection is proposed. Secondly, with regards to building a charging early warning protection system architecture, a real-time protection strategy for EV charging is proposed; a battery temperature difference, battery voltage ramp rate, and current ramp rate are proposed; and a double-layer protection model of an active protection layer and a big data protection layer is established based on the real-time monitoring of 27 parameters. Finally, by building a physical simulation platform of the early warning system, the simulation and veriﬁcation are carried out based on the BYD Han model. The system was demonstrated in the State Grid Tianjin Electric Power Company of China. The results show that the system can realize the charging real-time early warning and deal with it in time when the battery charging is abnormal, which has practical application value for the popularization and development of EVs.


Introduction
Facing the current world energy and environmental problems, as a green means of transportation, EVs have great advantages and application prospects in dealing with the greenhouse effect caused by urban carbon dioxide emissions and changing the energy structure. According to the data of China charging Alliance: By the beginning of September 2021, the number of new energy vehicles in China was 6.78 million, accounting for 2.28% of the total number of vehicles. By September 2021, the cumulative number of charging infrastructure in China was 2.223 million, with an on year-on-year increase of 56.8% [1]. In November 2020, the general office of the State Council of China issued the new energy vehicle industry development plan (2021)(2022)(2023)(2024)(2025)(2026)(2027)(2028)(2029)(2030)(2031)(2032)(2033)(2034)(2035). The plan proposes that by 2025, the sales of new energy vehicles will account for 20% of the total sales of vehicles in that year; by 2035, EVs will become the mainstream of newly sold vehicles. However, the popularity of EVs also brings various charging problems. For example, (1) battery on fire; (2) incompatible charging interface; (3) battery life is shortened due to overcharge and over-discharge; (4) the cause of vehicle pile communication failure is unknown; (5) charging equipment failure, charging incompatibility, and charging start failure; (6) abnormal protection measures are not right (including control guidance; communication protocol; access control; emergency stop; and the gun can be drawn during the charging process, but it cannot be drawn when The charging safety of electric vehicles is affected by many factors, involving inconsistent standards among car companies, pile companies, battery manufacturers, and irregular access conditions for manufacturers. The research on electric vehicle charging safety in Japan, the United States, and other countries started earlier and more comprehensively than in China, but there was still no effective method to evaluate its safety level. The authors of [3] proposed the evaluation index of "qualified rate of safety protection of EV charging equipment", which was applied to the comprehensive evaluation system of EV to improve the safety protection ability of EV. The authors of [4,5] proposed a comprehensive evaluation method to consider the safety of EVs and charging stations at the same time. Fabio Freschi proposed that the EV charging equipment should be equipped with an insulating transformer to isolate the current from the power grid for monitoring the safety of the EV charging process [6]. Claus-Christian carbon improved the safety of the charging infrastructure, which ensured the charging safety of EVs by providing data and materials within the safety range [7]. In order to solve the problem of easy damage of the EV battery pack, Tomasz wierzbicki proposed a data-driven safety envelope algorithm to ensure the safety of the EV battery pack [8]. The authors of [9] pointed out the importance of battery safety for electric vehicle-charging safety, which proposed a high-dimensional data stream outlier detection algorithm (DSOD) based on angle distribution for battery system safety assessment. In terms of charging and swapping protection technology, experts and scholars mainly focus on EV-pile data research, system simulation research, and charging safety protection. Most experts are still The charging safety of electric vehicles is affected by many factors, involving inconsistent standards among car companies, pile companies, battery manufacturers, and irregular access conditions for manufacturers. The research on electric vehicle charging safety in Japan, the United States, and other countries started earlier and more comprehensively than in China, but there was still no effective method to evaluate its safety level. The authors of [3] proposed the evaluation index of "qualified rate of safety protection of EV charging equipment", which was applied to the comprehensive evaluation system of EV to improve the safety protection ability of EV. The authors of [4,5] proposed a comprehensive evaluation method to consider the safety of EVs and charging stations at the same time. Fabio Freschi proposed that the EV charging equipment should be equipped with an insulating transformer to isolate the current from the power grid for monitoring the safety of the EV charging process [6]. Claus-Christian carbon improved the safety of the charging infrastructure, which ensured the charging safety of EVs by providing data and materials within the safety range [7]. In order to solve the problem of easy damage of the EV battery pack, Tomasz wierzbicki proposed a data-driven safety envelope algorithm to ensure the safety of the EV battery pack [8]. The authors of [9] pointed out the importance of battery safety for electric vehicle-charging safety, which proposed a high-dimensional data stream outlier detection algorithm (DSOD) based on angle distribution for battery system safety assessment. In terms of charging and swapping protection technology, experts and scholars mainly focus on EV-pile data research, system simulation research, and charging safety protection. Most experts are still in the theoretical research stage and fail to solve the fundamental problem of charging safety. The current situation and problems of the above three aspects are analyzed in this paper. First of all, in terms of EV-pile data analysis, in terms of vehicle pile data analysis, Ref. [10] developed a fault diagnosis method of an EV battery system that was based on big data statistical method. The authors of [11] applied battery power spectral density (PSD) big data system judgment and detection technology to improve the control and reliability of the battery system, so as to ensure the safety of EV charging. Qian Lijun designed a charging safety early warning model by analyzing the influencing factors of EV charging safety, using the training principle of genetic wavelet neural network and the characteristics of multi-scale and multi-resolution, which improved the safety early warning ability of the charging system [12]. The authors of [13] proposed a battery model-based EV charging fault monitoring and early warning method, which can identify more than 10 fault types. According to the fault types, it can be summarized into five types of faults, including BMS and charger communication failure, and the fault verification data are given. The authors of [14] proposed a battery model-based monitoring and early warning method for electric vehicle charging faults. The authors of [15] proposed a fault early warning method for the electric vehicle charging process based on an adaptive deep belief network. The authors of [16] analyzed the influencing factors of electric vehicle charging safety. It summarizes the charging safety protection method, which predicts the future research direction of charging safety. The authors of [17] can diagnose and warn the charging failure of EVs, minimize the harm caused by battery failure in the operation of EVs, realize the short-term and medium-term intelligent protection and control function of charging safety, and eliminate hidden dangers. However, due to the large number of battery manufacturers, it is difficult to effectively guarantee.
Second, in terms of system simulation, Ref. [18] summarized the safety influencing factors in the charging process of EVs from the four aspects of equipment, technology, monitoring, and management. It proposes a dynamic early warning method for shortcircuit or micro-short circuit in the battery pack based on monitoring data, which is effective to control and eliminate potential failures. The authors of [19] proposed an intelligent power-off control algorithm of EV charging system that was based on PID (proportional integral derivative) control, and designed the hardware. The performance was verified by simulation experiments, which showed the superior performance of the algorithm in realizing the intelligent power-off control of EV charging. The authors of [20] divided the safety level of EV charging, starting from three aspects: people, surrounding facilities, and charging equipment, which established three security lines to ensure the charging safety of EVs. In terms of DC conduction charging safety, Tian Xiang of Jiangsu University expounded the working principle of DC conduction charging. It studied the risk points of DC conduction charging, which introduced the risk matrix analysis method to evaluate the risk level [21]. Wang Zhen of China Nanjing University of Science and Technology designed a safety protection device with the functions of monitoring key safety factors and evaluating the safety state of charging from three aspects: people, vehicles, and equipment [22]. However, most of the simulations are based on simulated data, and it is difficult to reflect the working conditions of multiple scenarios and battery aging and decay.
Finally, in terms of charging safety protection, [23] defined the safety level of charging facilities. It combined with the five new national standards released in 2016, which analyzed the factors affecting the charging safety of EVs and provided solutions for charging safe program. The authors of [24] analyzed the charging safety requirements from the perspectives of physical connection safety, electrical connection safety, and charging interaction protection, which are based on the current national standards for EV charging systems and interfaces. The authors of [25][26][27] proposed a method for detection and safety assessment of surrounding electromagnetic signals in the wireless charging process of EVs, which are based on second-order matched filtering and spectral feature extraction. The method of spectral feature analysis and quantitative extraction was used to realize the safety diagnosis of the surrounding electromagnetic environment, which summarized the charging failure from the perspective of battery mechanism. However, it is difficult to effectively popularize this method, and it cannot be consistently implemented in manufacturing companies such as car companies and batteries.
To sum up, with the gradual increase of EV charging accidents, relevant experts and scholars in charging and swapping protection technology are still in the theoretical research stage or build models in terms of EV-pile data research, system simulation research, and charging safety protection. For simulation, it fails to truly reflect the actual charging scene and fails to solve the fundamental problem of charging safety. It is difficult to implement protection technology and specifications in a unified manner on car companies, pile companies, and battery manufacturers. At the same time that there are equipment, technology, or management problems of manufacturers, it is difficult to fundamentally solve electric vehicle accidents; there is a lack of effective solutions for charging protection. Before there was no effective way to manage these problems, but now the parameters of the battery can be monitored in real time through a third-party system, making predictions, early warnings, and preventing accidents. According to the current situation of charging early warning by scholars, this paper puts forward its limitations, a third-party charging safety early warning and protection system on the vehicle side is developed, a charging early warning and protection system architecture is constructed, and an electric vehicle charging real-time protection strategy is proposed. According to real-time monitoring of 27 parameters including measurement voltage, measurement current, output current, and maximum/minimum cell temperature, the battery temperature difference, battery voltage ramp rate, and current ramp rate are proposed, and a double-layer protection model of an active protection layer and a big data protection layer is established by building a physical simulation platform of the early warning system to simulate and verify. The purpose of this is to realize the charging real-time early warning and deal with it in time when the battery charging is abnormal, which will have a practical application value for the popularization and development of EVs.

Classification of Charging Network Protection Levels
According to the composition of the EV charging network, it can be divided into four aspects: grid side safety, charging equipment side safety, vehicle side safety, and operation platform side safety (as is shown in Figure 2). the safety diagnosis of the surrounding electromagnetic environment, which summarized the charging failure from the perspective of battery mechanism. However, it is difficult to effectively popularize this method, and it cannot be consistently implemented in manufacturing companies such as car companies and batteries.
To sum up, with the gradual increase of EV charging accidents, relevant experts and scholars in charging and swapping protection technology are still in the theoretical research stage or build models in terms of EV-pile data research, system simulation research, and charging safety protection. For simulation, it fails to truly reflect the actual charging scene and fails to solve the fundamental problem of charging safety. It is difficult to implement protection technology and specifications in a unified manner on car companies, pile companies, and battery manufacturers. At the same time that there are equipment, technology, or management problems of manufacturers, it is difficult to fundamentally solve electric vehicle accidents; there is a lack of effective solutions for charging protection. Before there was no effective way to manage these problems, but now the parameters of the battery can be monitored in real time through a third-party system, making predictions, early warnings, and preventing accidents. According to the current situation of charging early warning by scholars, this paper puts forward its limitations, a thirdparty charging safety early warning and protection system on the vehicle side is developed, a charging early warning and protection system architecture is constructed, and an electric vehicle charging real-time protection strategy is proposed. According to real-time monitoring of 27 parameters including measurement voltage, measurement current, output current, and maximum/minimum cell temperature, the battery temperature difference, battery voltage ramp rate, and current ramp rate are proposed, and a double-layer protection model of an active protection layer and a big data protection layer is established by building a physical simulation platform of the early warning system to simulate and verify. The purpose of this is to realize the charging real-time early warning and deal with it in time when the battery charging is abnormal, which will have a practical application value for the popularization and development of EVs.

Classification of Charging Network Protection Levels
According to the composition of the EV charging network, it can be divided into four aspects: grid side safety, charging equipment side safety, vehicle side safety, and operation platform side safety (as is shown in Figure 2).

Safety Problem
(1) Grid-side charging safety issues It is mainly caused by the adverse effects of electric vehicle charging behavior on the stable operation of the power grid [21], which are mainly reflected in the load exceeding limit/insufficient capacity, power quality exceeding limit (amplitude, harmonics, frequency, unbalance, etc.), resonance risk (harmonic amplification), relay protection action (reverse discharge does not meet the requirements, overcurrent, overvoltage, etc.), and a lack of the anti-islanding protection.
(2) Charging safety issues on the charging device side Mainly for the adverse effects of electric vehicle charging behavior on personnel and charging facilities, including: equipment leakage/personnel electric shock risk, charging equipment failure, charging incompatibility, and charging startup failure, abnormal protection measures are not in place (including control guidance, communication protocol, access control, emergency stop, the gun can be pulled during the charging process, and the gun cannot be pulled at the end of charging, etc.). The measurement deviation of the charging electric quantity is large, which leads to the hidden danger of overcharging the vehicle.
(3) Charging safety issues on the charging vehicle side The adverse effects of electric vehicle charging behavior on the battery or battery management system [10][11][12][13], including the battery management (BMS) system safety protection measures, are out of control (overcharge, short circuit, thermal runaway, etc.); BMS communication protocol consistency is poor (the charging speed is increased by relaxing the charging voltage, most of which are logistics vehicles); and the battery has a poor anti-collision coefficient and leaks.
(4) Charging safety issues on the operating platform side The main reason is that the system itself is not perfect [20], including the risk of electricity stealing (time-sharing rental cars have the largest proportion of electricity stealing in the early stage of the industry); abnormal charging transactions; too much or too little metering; offline charging equipment; no local charging counter measures; the overall experience is poor; hackers can attack the operation platform; and there is a risk of service network paralysis.

Protection Strategy
For the four types of charging safety problems on the grid side, charging equipment side, vehicle side, and operation platform side, the currently promoted technologies have adopted corresponding protection strategies as follows: (1) Grid side security protection strategy For group charging or high-power charging, the large-scale station area orderly charging technology is adopted, and the station area is used as the unit to manage the charging load in layers and zones, and the charging load is collected through the orderly charging controller (energy controller, energy router, etc.). Information is gathered for the electricity load of the station area, the charging plan is arranged according to the needs of users such as charging and car use time, and the control strategy is adopted based on the peak and valley electricity price to guide users to charge during the low-electricity price period, so as to realize the "peak shaving and valley filling" on the grid side.
(2) Safety protection strategy on the charging device side In the process of rapid development of electric vehicles and charging facilities, due to the non-compliance of production and manufacturing, irregular construction, and acceptance, the problem of charging interoperability inconsistency appears. Unified charging interoperability is shown through the establishment of unified interface specifications, standard interfaces, and protocols.
In terms of the consistency of the charging interface, the interface size and the size and tolerance of the mechanical locking mechanism need to be checked before charging. During the charging process, the locking time and status of the electronic lock (by pressing the mechanical lock button and checking whether it is pulled out by the charging plug) need to be checked to avoid potential safety hazards.
In terms of communication consistency, the content, format, cycle, and timing of communication messages are judged in real time during the charging process. If an abnormal message or logic error occurs, the charging will be stopped or the power will be reduced according to the specific situation. In addition, it can send error messages for real-time processing, send fault messages or stop charging messages, and stop charging directly if necessary.
In terms of charging fault diagnosis and safety warning, it proposes charging fault classification, fault characteristic values, safety thresholds, collection, and judgment methods, and quickly analyzes the specific causes of faults and processing methods and improves the accuracy of charging fault location. Once it is found that the real-time collected values deviate from the normal range, it can directly stop charging or issue a safety warning.
(3) Vehicle side safety protection strategy Through the vehicle's own BMS, parameters such as cell voltage, total voltage, current, temperature, insulation resistance, and other parameters of the battery system can be effectively measured for the requirements of national standards.

(4) Platform-side security protection strategy
The strategy is to establish a three-layer information protection architecture for monitoring platforms, charging piles and electric vehicles, and monitor the charging and discharging status of charging piles and electric vehicles in real time. Through the monitoring platform, it establishes multi-level alarms levels and fuse measures. At the same time, the electric vehicle charging safety design includes various factors such as electrical; communication; physical; and information of the vehicle, pile, network, and operation platform, forming a system engineering. Through the four-layer network interface consisting of the data-sharing layer, the operation service layer, the infrastructure layer, and the information access layer, the electric vehicle charging network architecture is improved. A unified interface criterion is established and the data input and output are standardized.
In view of the above four types of charging safety problems, corresponding protection strategies are established respectively to realize the positioning protection in the charging network. However, it is still difficult to effectively warn and judge the charging process in real time. Due to the characteristics of the battery itself and the use of electric vehicle users in complex scenarios, the above four types of protection are difficult to provide timely warning to users, thus failing to ensure human safety. To this end, the first concern is whether the BMS of the EV itself can effectively prevent accidents. In view of the above problems, it is proposed to establish a third-party charging early warning system to realize real-time monitoring of the charging process, which cuts off the power supply when necessary. It builds a charging safety early warning protection model, which solves the safety problems in the charging process of electric vehicles.

Charging Early Warning Protection System
This part mainly studies and establishes the structure, function, system composition, and data transmission mechanism of the charging early warning real-time protection system, which develops the charging early warning device and establishes the charging early warning data protection model.

Overall Architecture of Charging Early Warning and Protection System
It shows the architecture of the electric vehicle charging safety protection early warning system, as is shown in Figure 3. The architecture is divided into device access layer, early warning protection layer, local server layer (local storage), cloud server layer (MySQL database), and security protection platform. The equipment access layer includes electric vehicles and charging piles, and electric vehicles are connected to charging piles for charging.
World Electr. Veh. J. 2022, 13, x FOR PEER REVIEW 7 of 20 early warning protection layer, local server layer (local storage), cloud server layer (MySQL database), and security protection platform. The equipment access layer includes electric vehicles and charging piles, and electric vehicles are connected to charging piles for charging. Figure 3. EV charging safety protection early warning system architecture.
The early warning protection layer includes early warning devices and necessary communication equipment. The real-time charging data is transmitted to the early warning device through CAN communication. At this stage, the vehicle pile communication data needs to be parsed and the parsed data sent to the local server through Lora (wireless) or an optical fiber/485 (wired) communication medium. In addition, the data transmission method also changes accordingly. Lora communication can be replaced with 485 wired communication or 4 G communication. The early warning device performs real-time monitoring and early warning. If an abnormal situation is found, it will give an early warning, and if necessary, the charging behavior of the charging pile will be suspended to protect the vehicle pile.
In the local server layer (local storage), the data transmitted by the early warning device is aggregated, and the data is converted and converted to facilitate data monitoring, sorting, and querying of charging information.
The cloud server layer (MySQL database) converts and collects the data compiled by the local server layer (local storage) for storage, which is convenient for data analysis, protection model establishment, and historical data analysis of the cloud platform. The data stored in this database re divided into four stages according to the charging process, namely the handshake identification stage, the parameter configuration stage, the charging stage, and the charging end stage.
The security protection platform is stored in the MySQL database through cloud transmission. This platform is divided into four parts: map screen (which can realize early warning location navigation and positioning), asset management (cars, piles, and charging guns), vehicle data viewing, and historical data analysis. Due to the massive amount of electric vehicle safety information in the database, it is necessary to classify, summarize, and compare the massive data in order to realize functions such as visualization of important data, big data analysis, and early warning of charging safety.
Based on this architecture, and distributed, digital, and intelligent technologies, a charging safety protection platform is built, which deeply integrates embedded, cloud storage, cloud computing, big data, and artificial intelligence technologies to support the development of electric vehicle safety protection platforms. Key technologies of the platform: In the local server layer (local storage), the data transmitted by the early warning device is aggregated, and the data is converted and converted to facilitate data monitoring, sorting, and querying of charging information.
The cloud server layer (MySQL database) converts and collects the data compiled by the local server layer (local storage) for storage, which is convenient for data analysis, protection model establishment, and historical data analysis of the cloud platform. The data stored in this database re divided into four stages according to the charging process, namely the handshake identification stage, the parameter configuration stage, the charging stage, and the charging end stage.
The security protection platform is stored in the MySQL database through cloud transmission. This platform is divided into four parts: map screen (which can realize early warning location navigation and positioning), asset management (cars, piles, and charging guns), vehicle data viewing, and historical data analysis. Due to the massive amount of electric vehicle safety information in the database, it is necessary to classify, summarize, and compare the massive data in order to realize functions such as visualization of important data, big data analysis, and early warning of charging safety.
Based on this architecture, and distributed, digital, and intelligent technologies, a charging safety protection platform is built, which deeply integrates embedded, cloud storage, cloud computing, big data, and artificial intelligence technologies to support the development of electric vehicle safety protection platforms. Key technologies of the platform: (1) Meeting the key technologies of intercommunication and interconnection of early warning devices in various scenarios. The developed early warning device has wireless (4 G/5 G and Lora), wired (485/fiber) multiple communication methods, and can meet the needs of multiple scenarios in residential areas, commercial areas and industrial areas, and real-time data interaction and evaluation of charging data.
(2) Based on the self-developed vehicle pile communication protocol based on GB/27930.
Based on the standard requirements, it defines the communication mechanism and obtain the pile output voltage, output current, vehicle demand voltage and demand current, power battery type, vehicle type, vehicle total power, vehicle SOC (27 parameters such as charging status), alarm or not, maximum battery temperature, minimum battery temperature, charged amount, charging mode, and output power. (3) There are multiple local/remote deployment methods. In terms of local deployment, the protocol and the visualization platform are integrated, and remote access can be used to deploy the protocol locally and realize cloud storage remotely.

System Composition and Data Transmission Mechanism
As shown in Figure 4, the system includes an electric vehicle, a charging pile, an early warning device, a Lora transmitter, a Lora receiver, and a cloud platform. (1) Meeting the key technologies of intercommunication and interconnection of early warning devices in various scenarios. The developed early warning device has wireless (4 G/5 G and Lora), wired (485/fiber) multiple communication methods, and can meet the needs of multiple scenarios in residential areas, commercial areas and industrial areas, and real-time data interaction and evaluation of charging data.
(2) Based on the self-developed vehicle pile communication protocol based on GB/27930.
Based on the standard requirements, it defines the communication mechanism and obtain the pile output voltage, output current, vehicle demand voltage and demand current, power battery type, vehicle type, vehicle total power, vehicle SOC (27 parameters such as charging status), alarm or not, maximum battery temperature, minimum battery temperature, charged amount, charging mode, and output power. (3) There are multiple local/remote deployment methods. In terms of local deployment, the protocol and the visualization platform are integrated, and remote access can be used to deploy the protocol locally and realize cloud storage remotely.

System Composition and Data Transmission Mechanism
As shown in Figure 4, the system includes an electric vehicle, a charging pile, an early warning device, a Lora transmitter, a Lora receiver, and a cloud platform. It shows the flow of system data (taking the Lora networking solution as an example) in Figure 5. The electric vehicle and the charging pile of the system are interconnected. The developed device analyzes the real-time communication (hexadecimal) of the vehicle pile and sends it to the local server by Lora, and then sends it to the cloud platform and stores it through plaintext analysis. Real-time monitoring and early warning are realized It shows the flow of system data (taking the Lora networking solution as an example) in Figure 5. The electric vehicle and the charging pile of the system are interconnected. The developed device analyzes the real-time communication (hexadecimal) of the vehicle pile and sends it to the local server by Lora, and then sends it to the cloud platform and stores it through plaintext analysis. Real-time monitoring and early warning are realized by using big data and artificial intelligence technology. The developed system mainly includes a hardware part and software part.
World Electr. Veh. J. 2022, 13, x FOR PEER REVIEW 9 of 20 by using big data and artificial intelligence technology. The developed system mainly includes a hardware part and software part. The hardware part is an indispensable part of the electric vehicle charging safety warning device. It is necessary to fully consider the anti-interference, reliability, and low power consumption, so that the device can operate in different working environments without signal interference. The operating power of the device needs to be reduced (the power of the single board is 0.72 W).
The hardware system block diagram is shown in Figure 6. The hardware circuit consists of the following parts: STM32F405    The hardware part is an indispensable part of the electric vehicle charging safety warning device. It is necessary to fully consider the anti-interference, reliability, and low power consumption, so that the device can operate in different working environments without signal interference. The operating power of the device needs to be reduced (the power of the single board is 0.72 W).
The hardware system block diagram is shown in Figure 6. The hardware circuit consists of the following parts: STM32F405  The hardware part is an indispensable part of the electric vehicle charging safety warning device. It is necessary to fully consider the anti-interference, reliability, and low power consumption, so that the device can operate in different working environments without signal interference. The operating power of the device needs to be reduced (the power of the single board is 0.72 W).
The hardware system block diagram is shown in Figure 6. The hardware circuit consists of the following parts: STM32F405     Figure 5 is the device software design frame diagram, which consists of four parts: system initialization, vehicle pile charging data collection, vehicle pile communication protocol analysis, and Lora wireless communication. The initialization part includes timer initialization, clock initialization, serial port initialization, and CAN initialization. The data acquisition part includes CAN communication, received data, and cached data. The protocol analysis part includes analysis data, and early warning judgment, and the data communication part includes Lora communication and transfer data.

Data Protection Model
The data protection model (as is shown in Figure 7) includes a double-layer protection model, a real-time charging network data model, a charging historical data model, and a security decision-making model. The two-layer protection model includes an active protection layer and a big data protection layer. The active protection layer includes a single overvoltage protection model, a battery over-temperature protection model, an excessive temperature difference protection model, and an abnormal temperature rise protection model. The big data protection layer contains a power battery imbalance model, vehicle battery life prediction model, charging behavior model, and battery safety scoring model. protocol analysis part includes analysis data, and early warning judgment, and the data communication part includes Lora communication and transfer data.

Data Protection Model
The data protection model (as is shown in Figure 7) includes a double-layer protection model, a real-time charging network data model, a charging historical data model, and a security decision-making model. The two-layer protection model includes an active protection layer and a big data protection layer. The active protection layer includes a single overvoltage protection model, a battery over-temperature protection model, an excessive temperature difference protection model, and an abnormal temperature rise protection model. The big data protection layer contains a power battery imbalance model, vehicle battery life prediction model, charging behavior model, and battery safety scoring model. When charging electric vehicles, the active protection layer model is used to protect the safety accidents of charging when the parameter indicators are abnormal, such as single battery overvoltage, battery over-temperature, excessive temperature difference, and abnormal temperature rise. The big data protection layer provides the data foundation for the protection layer model, and the data is collected and organized through the big data protection layer to build a model, such as the battery safety score to evaluate the probability of a high-risk battery charging accident, and then the user's charging behavior cycle and other data information to establish a charging behavior model. It establishes a vehicle battery life prediction model that is based on the vehicle's environmental factors, user charging habits and battery characteristics, to provide users with an information reference and reduce the probability of charging safety accidents. The charging real-time data model mainly collects the charging data of the vehicle pile in real time through the communication device and sends it to the cloud platform. The power grid historical data model is used to complete the storage of real-time charging data.
The safety decision-making model mainly evaluates and analyzes the results of charging behavior, issues the results of policy execution, and alarms or powers off.
The protection model indicators of the early warning protection system mainly include the demand voltage exceeding the maximum allowable voltage, the demand current exceeding the maximum allowable current, charging overcurrent, battery pack overvoltage, charger output voltage out of tolerance, charger output current out of tolerance, battery cell overvoltage, battery over-temperature, charging SOC out of range, battery imbalance, abnormal battery temperature rise, and charging SOC unchanged. Among them, in When charging electric vehicles, the active protection layer model is used to protect the safety accidents of charging when the parameter indicators are abnormal, such as single battery overvoltage, battery over-temperature, excessive temperature difference, and abnormal temperature rise. The big data protection layer provides the data foundation for the protection layer model, and the data is collected and organized through the big data protection layer to build a model, such as the battery safety score to evaluate the probability of a high-risk battery charging accident, and then the user's charging behavior cycle and other data information to establish a charging behavior model. It establishes a vehicle battery life prediction model that is based on the vehicle's environmental factors, user charging habits and battery characteristics, to provide users with an information reference and reduce the probability of charging safety accidents. The charging real-time data model mainly collects the charging data of the vehicle pile in real time through the communication device and sends it to the cloud platform. The power grid historical data model is used to complete the storage of real-time charging data.
The safety decision-making model mainly evaluates and analyzes the results of charging behavior, issues the results of policy execution, and alarms or powers off.
The protection model indicators of the early warning protection system mainly include the demand voltage exceeding the maximum allowable voltage, the demand current exceeding the maximum allowable current, charging overcurrent, battery pack overvoltage, charger output voltage out of tolerance, charger output current out of tolerance, battery cell overvoltage, battery over-temperature, charging SOC out of range, battery imbalance, abnormal battery temperature rise, and charging SOC unchanged. Among them, in the protection model, the battery voltage rise rate, temperature rise rate, temperature difference, measurement current rise rate, and vehicle voltage rise rate are more concerned. The sections are defined as follows: The battery voltage ramp rate refers to the amount of change in battery voltage per minute during charging.
In Formula (1), V v (V/min) is the battery voltage rising rate, V n (V) is the voltage value at time n, V n−1 (V) is the voltage value 1 minute before time n, and the denominator "1"unit is "min".
The temperature rise rate refers to the change in the maximum temperature of the battery per minute during the charging process.
In Formula (2), T T ( • C/min) is the temperature rise rate, T a ( • C) is the temperature value at time a, T a−1 ( • C) is the temperature value 1 minute before time a, and the denominator "1"unit is "min".
At the same time, the temperature difference refers to the difference between the highest temperature and the lowest temperature of the battery during the charging process.
In Formula (3), T t ( • C) is the temperature difference at time t, the highest temperature of the battery at this time is T h ( • C), and the lowest temperature of the battery is T l ( • C).
Measured current ramp rate refers to the amount of change in battery current per minute during charging.
In Formula (4), I A (A/min) is the measurement current rising rate, T m (A) is the current value at time m, T m−1 (A) is the current value at time m − 1, and the denominator "1"unit is "min".

System Construction
Build the physical simulation platform of the charging early warning system as is shown in Figure 8, which consists of the equipment access layer, the early warning protection layer, the local server layer, the cloud server layer, and the security protection platform.
It can be seen that the relationship between various levels is established through the construction of the charging safety protection early warning system.
(1) In the equipment access layer, a 60 kW DC charging pile is used, and the electric vehicle and the DC charging pile are interconnected and charged; (2) In the early warning protection layer, the charging safety early warning device is the core device of the early warning protection layer. It is deployed inside the DC charging pile and installed on the backplane to analyze the collected CAN messages. The parameters include real-time values such as SOC, measurement current, measurement voltage, cell voltage, maximum cell temperature, and charging time. At the same time, the Lora device used for the sending end is deployed in the pile together with the early warning device, and the early warning device is connected to the Lora and the charging pile through 485. The rated value is 12 V, and it has the function of identifying two charging guns at the same time. (3) In the local server layer, it consists of the local server and the Lora receiver, which is transmitted to the cloud server layer through 4 G or wired network. The local server deploys the Lora receiver, which is connected to the local server through the 485-to-USB port to realize plaintext parsing; (4) The cloud server layer includes cloud server and Mysql database, which is connected to the local server through 4 G or wired network. The database stores the historical data of charging between vehicle piles, which is convenient for in-depth analysis of charging data and user behavior research on the platform in the later stage; (5) The security protection platform is remotely connected to the cloud service layer through the network, and the data in the cloud server is processed and analyzed for visual display. It has the following functions: map screen (it can realize early warning location navigation and positioning), asset management (car, piles, charging guns), vehicle data viewing, and historical data analysis. It can be seen that the relationship between various levels is established through the construction of the charging safety protection early warning system.
(1) In the equipment access layer, a 60 kW DC charging pile is used, and the electric vehicle and the DC charging pile are interconnected and charged; (2) In the early warning protection layer, the charging safety early warning device is the core device of the early warning protection layer. It is deployed inside the DC charging pile and installed on the backplane to analyze the collected CAN messages. The parameters include real-time values such as SOC, measurement current, measurement voltage, cell voltage, maximum cell temperature, and charging time. At the same time, the Lora device used for the sending end is deployed in the pile together with the early warning device, and the early warning device is connected to the Lora and the charging pile through 485. The rated value is 12 V, and it has the function of identifying two charging guns at the same time. (3) In the local server layer, it consists of the local server and the Lora receiver, which is transmitted to the cloud server layer through 4 G or wired network. The local server deploys the Lora receiver, which is connected to the local server through the 485-to-USB port to realize plaintext parsing; (4) The cloud server layer includes cloud server and Mysql database, which is connected to the local server through 4 G or wired network. The database stores the historical data of charging between vehicle piles, which is convenient for in-depth analysis of charging data and user behavior research on the platform in the later stage; (5) The security protection platform is remotely connected to the cloud service layer through the network, and the data in the cloud server is processed and analyzed for visual display. It has the following functions: map screen (it can realize early warning location navigation and positioning), asset management (car, piles, charging guns), vehicle data viewing, and historical data analysis.

Case Simulation
The simulation scene uses a 60 kW charger of State Grid NARI Pret, BYD Han (battery capacity 76.896 kWh, charging power 80 kW), and the local server is Lenovo (ThinkStation) P920 workstation 32 GB/512 G solid state + 2 T machine, Lora transmitter (USR -LG206), receiver (USR-LG210-L), Alibaba Cloud, and MySQL 5.7, which is used to build a simulation verification platform (as is shown in Figure 9). The simulation scene uses a 60 kW charger of State Grid NARI Pret, BYD Han (battery capacity 76.896 kWh, charging power 80 kW), and the local server is Lenovo (Think-Station) P920 workstation 32 GB/512 G solid state + 2 T machine, Lora transmitter (USR -LG206), receiver (USR-LG210-L), Alibaba Cloud, and MySQL 5.7, which is used to build a simulation verification platform (as is shown in Figure 9). The early warning device is connected to the CAN bus of the car pile, which sends the early warning device to the server through 485, and then to the "cloud platform" through 4 G. Using Lora networking, the system has the functions of message parsing, forwarding, and processing. It also includes data processing, and physical enhanced functions such as communication, local storage, and encrypted transmission.
The battery temperature difference monitored by BYD Han EV fluctuates with the Figure 9. Simulation deployment diagram (the left is the early warning module deployed in the charging pile, and the right is the system).
The early warning device is connected to the CAN bus of the car pile, which sends the early warning device to the server through 485, and then to the "cloud platform" through 4 G. Using Lora networking, the system has the functions of message parsing, forwarding, and processing. It also includes data processing, and physical enhanced functions such as communication, local storage, and encrypted transmission.
The battery temperature difference monitored by BYD Han EV fluctuates with the SOC (battery state) ( Figure 10). During the charging process, the temperature difference change rate is monitored in real time. When the temperature difference exceeds the maximum allowable value, an alarm will be issued (the threshold varies with different battery types, here the threshold is 15 • C). Figure 9. Simulation deployment diagram (the left is the early warning module deployed in the charging pile, and the right is the system).
The early warning device is connected to the CAN bus of the car pile, which sends the early warning device to the server through 485, and then to the "cloud platform" through 4 G. Using Lora networking, the system has the functions of message parsing, forwarding, and processing. It also includes data processing, and physical enhanced functions such as communication, local storage, and encrypted transmission.
The battery temperature difference monitored by BYD Han EV fluctuates with the SOC (battery state) ( Figure 10). During the charging process, the temperature difference change rate is monitored in real time. When the temperature difference exceeds the maximum allowable value, an alarm will be issued (the threshold varies with different battery types, here the threshold is 15 °C ). The battery temperature difference refers to the difference between the highest temperature of the battery cell and the lowest temperature of the battery cell at the same time during the charging process. It can be seen from Figure 11 that as the SOC of the battery The battery temperature difference refers to the difference between the highest temperature of the battery cell and the lowest temperature of the battery cell at the same time during the charging process. It can be seen from Figure 11 that as the SOC of the battery increases, the maximum temperature of the battery cell and the minimum temperature of the battery cell gradually increase, the SOC rises from 24 to 83, the maximum cell temperature rises from 30 • C to the maximum 47 • C, the minimum cell temperature increases from 30 • C rises to 45 • C, and the maximum battery temperature difference is 2.5 • C. When charging starts, the maximum temperature of the battery cell is not much different from the minimum temperature of the cell. As the charging continues, the temperature difference fluctuates, and the error is within 1 • C, which relates to the battery manufacturing process.
The following is an analysis of the difference between the output voltage of the charger. The difference between the voltage measurement value of the BMS and the output voltage value of the charger is greater than 5 V (based on NB/T 33008) as the reference alarm threshold. Set the voltage measurement value V 1 of the BMS, and the output voltage value of the charger is V 2 . If the voltage is overvoltage. V 1 is the voltage measurement of the BMS (battery management system), V 2 is the actual output voltage value of the charger. Due to the difference of charging piles and electric vehicle manufacturers, the voltage measurement value of BMS and the output voltage value of the charger may be different. In the actual charging process, the voltage measurement value of the BMS is greater than the output voltage value of the charger, or the charger output voltage value is greater than the BMS voltage measurement value. However, in theory, the difference between the two should be within a certain range, otherwise there may be problems with the car's BMS system or the charger control system, and an alarm should be issued. Therefore, this paper adopts the warning when the absolute value of V 1 − V 2 is greater than a certain threshold. This test requirement stipulates in China (NB/T 33008.1 5.12.15) that V 1 − V 2 should be within the range of ±5 V, otherwise it will do not meet the requirements. Therefore, this paper adopts the absolute value of V 1 − V 2 greater than 5 V as the warning threshold. increases, the maximum temperature of the battery cell and the minimum temperature of the battery cell gradually increase, the SOC rises from 24 to 83, the maximum cell temperature rises from 30 °C to the maximum 47 °C, the minimum cell temperature increases from 30 °C rises to 45 °C, and the maximum battery temperature difference is 2.5 °C. When charging starts, the maximum temperature of the battery cell is not much different from the minimum temperature of the cell. As the charging continues, the temperature difference fluctuates, and the error is within 1 °C, which relates to the battery manufacturing process. Figure 11. While the battery model is a lithium iron phosphate battery, the curve diagram of the measured voltage, output voltage, and measured current output current during the charging process of an EV is in an abnormal state.
The following is an analysis of the difference between the output voltage of the charger. The difference between the voltage measurement value of the BMS and the output voltage value of the charger is greater than 5 V (based on NB/T 33008) as the reference alarm threshold. Set the voltage measurement value 1 V of the BMS, and the output voltage value of the charger is 2 the voltage is overvoltage.
1 V is the voltage measurement of the BMS (battery management system), 2 V is the actual output voltage value of the charger. Due to the difference of charging piles and electric vehicle manufacturers, the voltage measurement value of BMS and the output voltage value of the charger may be different. In the actual charging process, the voltage measurement value of the BMS is greater than the output voltage value of the charger, or the charger output voltage value is greater than the BMS voltage measurement value. However, in theory, the difference between the two should be within a certain range, otherwise there may be problems with the car's BMS system or the charger control system, and an alarm should be issued. Therefore, this paper adopts the warning when the absolute value of 12 VV − is greater than a certain threshold. This test requirement stipulates Figure 11. While the battery model is a lithium iron phosphate battery, the curve diagram of the measured voltage, output voltage, and measured current output current during the charging process of an EV is in an abnormal state.
It is a graph of double y-axis, which is a trend graph of output voltage and output current, and the measurement voltage and measurement current change with the change of SOC in Figure 12. It is a graph of double y-axis, which is a trend graph of output voltage and output current, and the measurement voltage and measurement current change with the change of SOC in Figure 12. It can be seen from the figure that with the increase of SOC, both the measurement voltage and the output voltage are increasing. However, as the SOC increases, both the output current and the measurement current decrease. It can be seen from the figure that the overall value of the output voltage is slightly higher than the measured voltage, while the overall value of the measured current is slightly higher than the output current, and the difference is not large.
As is shown in Figure 11, it can be seen that when the SOC is 60%, the output voltage value is as high as 398 V. According to Formula (5), it can be seen that the voltage is over- It can be seen from the figure that with the increase of SOC, both the measurement voltage and the output voltage are increasing. However, as the SOC increases, both the output current and the measurement current decrease. It can be seen from the figure that the overall value of the output voltage is slightly higher than the measured voltage, while the overall value of the measured current is slightly higher than the output current, and the difference is not large.
As is shown in Figure 11, it can be seen that when the SOC is 60%, the output voltage value is as high as 398 V. According to Formula (5), it can be seen that the voltage is overvoltage, the system warns, and the charging behavior is terminated to prevent the occurrence of charging safety accidents.
The following is the output current of the charger that is out of tolerance. The difference between the BMS current measurement value and the charger output current value is greater than the BMS current measurement value * 1.5% + 1 A as the benchmark as the alarm threshold. Assuming the current measurement value I 1 of BMS and the output current value I 2 of the charger, then when the output current of the charger is out of tolerance: As is shown in Figure 13, it is a real-time monitoring diagram of measuring voltage, output voltage, and measuring current and output current when the electric vehicle is normally charged. However, in the event of an accident (as shown in Figure 14), it can be seen that when the SOC is 50%, the output current is as high as 133.8 A (the reason may be battery damage). The current difference calculated by Formula (6)   However, in the event of an accident (as shown in Figure 14), it can be seen that when the SOC is 50%, the output current is as high as 133.8 A (the reason may be battery damage). The current difference calculated by Formula (6) is 133.8 A−123.1 A = 10.7 A, but A 1 * 1.5% + 1 = 123.1 A * 0.015 + 1 A = 2.8465 A, since 10.7 A > 2.8465 A, the current is out of tolerance. At this time, a charging safety warning should be carried out to terminate the charging behavior to prevent the occurrence of charging safety accidents. Figure 15 is a schematic diagram of the abnormality monitoring of the charging index based on the normal distribution, the x-axis is the charging index, and the y-axis is the probability density. The sample data comes from charging records with the same region information, the same vehicle model information, and the same time information (daily or monthly). The normal distribution N (µ, σ 2 ) is a distribution that is uniquely determined by the mean µ and the standard deviation σ. According to the sample data, the mean u and the standard deviation σ are estimated, and the number of samples is n, and the formula is as follows. It can be seen from the figure that the mean is 40 and the standard deviation is 15. Figure 13. The graph of measuring voltage, output voltage, measuring current, and output current during the charging process of lithium battery EV.
However, in the event of an accident (as shown in Figure 14), it can be seen that when the SOC is 50%, the output current is as high as 133.8 A (the reason may be battery damage). The current difference calculated by Formula (6) Figure 14. Curves of measured voltage, output voltage, measured current, and output current during the charging process of lithium battery EVs in an abnormal state. Figure 15 is a schematic diagram of the abnormality monitoring of the charging index based on the normal distribution, the x-axis is the charging index, and the y-axis is the probability density. The sample data comes from charging records with the same region information, the same vehicle model information, and the same time information (daily or monthly). The normal distribution N (μ, σ 2 ) is a distribution that is uniquely determined by the mean μ and the standard deviation σ. According to the sample data, the mean u  It shows the three-dimensional map of the maximum battery temperature and measured current, which measures voltage during a single charge of a vehicle with a lithium iron phosphate battery, as is shown in Figure 16. It shows the three-dimensional map of the maximum battery temperature and measured current, which measures voltage during a single charge of a vehicle with a lithium iron phosphate battery, as is shown in Figure 16. It shows the three-dimensional map of the maximum battery temperature and measured current, which measures voltage during a single charge of a vehicle with a lithium iron phosphate battery, as is shown in Figure 16.  First of all, it can be known that when the battery is just charging, the battery temperature is 32 degrees Celsius. As the current and voltage continue to increase, the maximum battery temperature also increases, and the maximum temperature reaches 48 degrees Celsius. At the later stage of charging, the maximum battery temperature stabilizes at 45 degrees Celsius. When the measurement voltage is 360 V-380 V and the measurement current is 0-50 A, the maximum battery temperature changes the most. The voltage or current deviation increase rapidly (the deviation is greater than 20% of the reference value), so an alarm prompt occurs or the charging is cut off to protect the charging pile and the electric vehicle. It is possible to conduct the real-time monitoring of big data through multiple charging of the model, but if you want to fundamentally solve the problem of charging safety, you need to establish a database including battery manufacturers, vehicle manufacturers, aggregators, and users' charging behavior. A complete charging management strategy and data sharing concept are established.

Conclusions
For the charging network, this paper summarizes the charging protection technology from the grid side, charging equipment side, vehicle side, and operation platform side. It proposes a relatively complete charging network protection technology, which analyzes the charging safety defects of typical car networking systems. The framework of the electric vehicle charging safety protection early warning system was constructed, the charging early warning physical simulation system was built, and the early warning device was developed. It was demonstrated and applied in China State Grid Tianjin Electric Power Company, which greatly reduced the occurrence of charging safety problems in the charging process of electric vehicles. The electric vehicle charging data real-time protection model was established, and the early warning protection model was verified by taking the BYD Han model as an example, which realized the real-time warning and safety protection for the charging process.
The established early warning model and simulation show that: (1) By summarizing the technical problems of charging safety in the charging network, the causes of typical accidents are deeply analyzed. A third-party independent early warning system architecture is proposed, which can solve the problem of charging safety in a targeted manner. (2) Through the self-developed early warning module and wired/wireless communication methods, real-time monitoring and monitoring of 27 parameters such as lithium iron phosphate battery and lithium battery measurement voltage, measurement current, output current, and maximum/minimum cell temperature were realized. The analysis effectively improved the protection range of charging safety.
(3) Through the establishment of a double-layer protection model, a real-time data model of the charging network, a historical data model of charging, and a safety decisionmaking model, a safety protection method for electric vehicle charging was proposed, and a real-time early warning simulation system was built to realize the voltage outof-tolerance and current out-of-tolerance. Abnormal alarm of temperature difference and abnormal value and power-off protection can be used to make predictions before a fire to prevent accidents.
The paper has a practical role in promoting the popularization and development of electric vehicles, ensuring the life safety of charging users and providing technical support for the government to formulate relevant specifications for charging safety. However, the electric vehicle charging safety early warning protection system involves battery manufacturers, vehicle manufacturers, aggregators, and user charging behaviors, which are strongly coupled with each other.
To this end, the follow-up early warning system will develop a large database that can track each vehicle and establish a data tracking system for each vehicle and a full-life management and early warning system for vehicle batteries. It uses big data analysis and deep learning technology to improve the accuracy and timeliness of the early warning system. In view of the seriousness of charging accidents, the necessity of the development of electric vehicles, and the many factors involved in charging protection technology, the next step is to establish the following systems and management measures to fundamentally eliminate electric vehicle accidents: (1) Relevant departments need to establish a unified standard and testing system from electric vehicle manufacturers, charging pile manufacturers and battery manufacturers; (2) Develop safer batteries; (3) Establish a complete electric vehicle-charging pile-power grid for big data charging management and operation service. In addition, a unified big data management platform should be established in terms of technology, operation, and management items.