Charging pile CAN message offline analysis method, system and device and storage medium
Through a method of offline analysis of CAN packets for charging piles, the Python library and protocol dictionary are used to standardize and analyze charging pile messages, solving the complex problems of offline analysis in the existing technology, realizing customized analysis and intuitive display of multi-format packets, improving user experience and data analysis efficiency.
Patent Information
- Application Number
- CN202411973235.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-22
AI Technical Summary
The prior art is difficult to quickly and accurately analyze the CAN messages generated by charging piles offline, and the operation is complicated and inconvenient for technicians to obtain the required information.
Provides an offline analysis method for CAN packets for charging piles. By loading Python library, the configuration file reads the path and protocol dictionary, reading and loading the message data of the charging pile, standardizing the message data format, judging the protocol type based on the frame ID, querying the protocol dictionary for parsing, and saving and displaying the analysis results in the format specified by the user.
It realizes custom analysis of CAN messages of charging piles, supports CAN messages in multiple formats, provides an intuitive graphical interface, reduces operation difficulty, improves user experience, and does not need to connect to charging piles in real time, making it easier for technicians to conduct data analysis in the laboratory or office.
Smart Images

Figure CN119865538A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of charging piles, and relates to a charging pile CAN message offline parsing method, system, equipment and storage medium. Background Art
[0002] With the popularity of electric vehicles, charging piles are important supporting facilities for electric vehicles. The stability and reliability of their internal communication are crucial to ensure the smooth progress of the charging process. CAN bus is the main way for charging piles to communicate with external devices. Its messages contain rich control instructions, status information and possible fault information. However, in practical applications, due to environmental restrictions or testing requirements, it is often necessary to perform offline analysis on the CAN messages generated by charging piles.
[0003] Traditional offline analysis methods often rely on specific software or hardware facilities and are complex to operate, making it difficult for technicians to quickly and accurately obtain the required information. Summary of the invention
[0004] The purpose of the present invention is to overcome the shortcomings of the above-mentioned prior art and provide a charging pile CAN message offline parsing method, system, device and storage medium, which can support customized parsing rules and cope with CAN message parsing in various formats.
[0005] In order to achieve the above object, the present invention adopts the following technical solutions: A charging pile CAN message offline parsing method includes the following process: S1, load Python library, configuration file reading path and protocol dictionary; S2, read and load the message data of the charging pile; S3, standardize the file format and text format of message data; S4, judging the protocol type according to the frame ID of the message data; S5, query the protocol dictionary according to the protocol type and parse the message data; S6, converting the parsed data text into a format specified by the user, saving it to a folder specified by the user, and displaying key information on the UI interface.
[0006] Preferably, in S3, the file format of the message data is converted into the CSV format, and the text format of the message data is converted into the UTF-8 format.
[0007] Preferably, in S3, the frame ID format of the message data is converted into 8 characters following 0x; and the data domain format is converted into 16 characters.
[0008] Preferably, in S4, the protocol types include the format of BMS protocol 2023-A, the format of BMS protocol 2023-B, the format of BMS protocol 2015+, the TCU protocol format and the charging module protocol format.
[0009] Preferably, in S5, the frame data format is obtained according to the protocol type of the message data frame ID; the protocol dictionary is queried, and data parsing is performed according to the keywords of the data frame.
[0010] Preferably, in S6, the parsed data is written into a database; the data is written into a text type of a specific text format using designated characters; a saving path for the parsed text is selected and the text is saved.
[0011] Preferably, in S6, matplotlib is used to import a drawing module; the parsed message data is extracted; the data to be displayed is selected; the drawing board is divided into blocks according to the data to be displayed; redundancy is performed according to the maximum and minimum values of the data to be displayed; and the graph is displayed.
[0012] A charging pile CAN message offline parsing system, comprising: Initialization module, used to load Python library, configuration file reading path and protocol dictionary; A reading module is used to read and load the message data of the charging pile; A standardization module is used to standardize the file format and text format of message data; A protocol type determination module is used to determine the protocol type according to the frame ID of the message data; The parsing module is used to query the protocol dictionary according to the protocol type and parse the message data; The display module is used to convert the parsed data text into the format specified by the user, save it to the folder specified by the user, and display key information on the UI interface.
[0013] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the charging pile CAN message offline parsing method when executing the computer program.
[0014] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the charging pile CAN message offline parsing method are implemented.
[0015] Compared with the prior art, the present invention has the following beneficial effects: The present invention can identify the type, format and key information of charging pile messages, parse the messages through preset parsing rules, and display the parsing results in an intuitive way, providing strong data support for technicians, supporting custom parsing rules, and being able to deal with CAN message parsing in various formats; providing an intuitive graphical interface, reducing the difficulty of operation, and improving user experience; and facilitating data analysis in laboratories, offices, and other environments without the need to connect to the charging pile in real time. It is used to parse the communication data messages generated between the charging pile TMU and the electric vehicle BMS, the charging pile CMU and the charging module, the charging pile CMU and the PCS, the charging pile CMU and the TMU, the charging pile CMU, the TMU and the charging pile TCU, and the charging pile TCU and the operation platform, to achieve offline translation of data in different formats and protocols, and to help engineers and technicians analyze and diagnose communication data during the charging process without directly connecting to the charging pile. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 This is a flowchart of offline analysis of the charging pile CAN message of the present invention; Figure 2 A flowchart for formatting file data of the present invention; Figure 3 It is a flow chart of determining the protocol type of the present invention; Figure 4 The data parsing and storage flow chart of the present invention; Figure 5 This is the message parsing example 1 of the present invention; Figure 6 This is the message parsing example 2 of the present invention; Figure 7 A flowchart for obtaining key information of the present invention; Figure 8 A graphical display flow chart of the present invention; Fig. 9 This is an operation interface diagram of the present invention; Fig.10 This is a diagram of a graphical display interface of the present invention. DETAILED DESCRIPTION
[0017] The embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0018] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first" and "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0019] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which the present invention belongs. The terms "installed", "connected", and "connected" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection, an electrical connection, or can communicate with each other; it can be directly connected or indirectly connected through an intermediate medium, and it can be the internal connection of two elements or the interaction relationship between two elements. The term "and / or" used in this article includes any and all combinations of one or more related listed items. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0020] The disclosure below provides many different embodiments or examples to realize different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or reference letters in different examples, and this repetition is for the purpose of simplicity and clarity, which itself does not indicate the relationship between the various embodiments and / or settings discussed. In addition, the present invention provides various specific examples of processes and materials, but those of ordinary skill in the art can be aware of the application of other processes and / or the use of other materials.
[0021] like Figure 1 As shown in the figure, the charging pile CAN message offline parsing method based on Python according to the present invention includes the following process: S1, initialize the tool after startup, load necessary Python libraries and configuration files, etc.
[0022] S2, read in the custom protocol dictionary.
[0023] S3, after inputting the message data of the charging pile, load the data file through the file reading module.
[0024] S4, standardize the file data and text format of the message data. The current standard file format is CSV format, and the standard text format is UTF-8.
[0025] S5: Determine the protocol type based on the frame ID.
[0026] S6, querying the protocol dictionary according to the protocol type, and parsing the message data in the message data.
[0027] S7, converting the parsed data text into a format specified by the user, saving it to a folder specified by the user, and displaying key information on the UI interface.
[0028] like Figure 2 As shown in S4, the specific process of file data standardization is: (1) Analyze the input file format.
[0029] (2) Determine whether the file format is allowed. Currently allowed text formats are: CSV, TXT, XLS, and XLSX.
[0030] (3) If the file format is one of the above four, proceed to the next step; otherwise, no response.
[0031] (4) If the file format is TXT, XLS or XLSX, convert the file format to CSV. Then proceed to the next step. If it is CSV format, jump directly to the next step.
[0032] (5) Determine whether the text format is allowed. Currently allowed text formats are: GBK and UTF-8.
[0033] (6) If the text format is one of the above two, proceed to the next step; otherwise, no response.
[0034] (7) If the text format is GBK, convert the text to UTF-8 format. Then proceed to the next step. If it is UTF-8 format, jump directly to the next step.
[0035] (8) Determine whether it is a standard frame ID format. The standard frame ID format is 0x followed by 8 characters.
[0036] (9) If it is a standard frame ID, proceed to the next step; otherwise, after standardizing the frame ID, proceed to the next step.
[0037] (10) Determine whether the message data field is a standard data field. The standard data field format is 16 characters.
[0038] (11) If it is a standard data field, the execution ends; otherwise, the execution ends after the standard data field.
[0039] like Figure 3 As shown, in S5, the specific process of determining the protocol type is as follows: (1) Determine the protocol type based on the frame ID of the message data.
[0040] (2) If the frame ID format conforms to the format of BMS protocol 2023-A, the message is a message in the format of BMS protocol 2023-A and the execution ends. If not, proceed to the next step.
[0041] (3) If the frame ID format conforms to the format of BMS protocol 2023-B, the message is a message in the format of BMS protocol 2023-B and the execution ends. If not, proceed to the next step.
[0042] (4) If the frame ID format conforms to the format of BMS protocol 2015+, the message is a message in the format of BMS protocol 2015+ and the execution ends. If not, proceed to the next step.
[0043] (5) If the frame ID format conforms to the TCU protocol format, the message is a TCU format message and the execution ends. If not, proceed to the next step.
[0044] (6) If the frame ID format conforms to the protocol format of charging module 1, the message is a message in the format of charging module 1 and the execution ends. If not, proceed to the next step.
[0045] (7) If the frame ID format conforms to the protocol format of charging module 2, then the message is a message in the format of charging module 2 and the execution ends. If not, then the message is an error message and the execution ends.
[0046] like Figure 4 As shown, in S6, the specific process of message data parsing is: (1) Obtain the frame data format according to the protocol type of the message data frame ID.
[0047] (2) Query the protocol dictionary and parse the data according to the keywords of the data frame. The parsed message data is as follows: Figure 5 and 6 shown.
[0048] (3) Write the parsed data into the database.
[0049] (4) Use specified characters to write data into a text file in a specific text format.
[0050] (5) Select the save path for the parsed text and save the text.
[0051] like Figure 7 As shown, in S7, the specific process of printing key information is as follows: (1) Read the protocol type and keywords.
[0052] (2) If the frame data is in the format of BMS protocol 2023-A and the message data is the version number, it will print: BMS 2023-A: "V***" "Gun number: **...", and the execution ends. If it does not match, proceed to the next step.
[0053] (3) If the frame data is in the format of BMS protocol 2023-B and the message data is the version number, it will print: BMS 2023-B: "V***" "Gun number: **...", and the execution ends. If it does not match, proceed to the next step.
[0054] (4) If the frame data is in the format of BMS protocol 2015+ and the message data is the version number, it will print: BMS 2015+: “V***” “Gun number: **...” and the execution ends. If it does not match, proceed to the next step.
[0055] (5) If there is no gun number in the above steps, nothing will be printed.
[0056] (6) If the frame data is in the format of the TCU protocol and the message data is the version number, then print: TCU version: "V **" CMU version: "V **" TMU version: "V **" "Gun number: **...", and the execution ends. If it does not match, proceed to the next step.
[0057] (7) If the frame data is in the format of the charging module 1 protocol and the message data is the version number, then it will print: Charging module 1: "Manufacturer", "Module version number...", and the execution ends. If it does not match, proceed to the next step.
[0058] (8) If the frame data is in the format of the charging module 1 protocol and the message data is the version number, then the following will be printed: Charging module 2: "Manufacturer", "Module version number...", and the execution ends. If it does not match, proceed to the next step.
[0059] (9) If the frame data is in the format of the TCU protocol and the message data is fault data, the following will be printed: fault code "specific fault" "gun number: **..." fault code "specific fault" "gun number: **...", and the execution ends. If it does not match, the execution ends.
[0060] like Figure 8 As shown, in S7, the specific process of graphical display is: (1) If Fig. 9 As shown, use matplotlib to import the drawing module.
[0061] (2) Extract the parsed message data.
[0062] (3) Select the data to be displayed.
[0063] (4) Divide the drawing board into blocks according to the data to be displayed. If there is only voltage and current or only SOC value, there is no need to divide the drawing board into blocks.
[0064] (5) Create redundancy based on the maximum and minimum values of the data to be displayed.
[0065] (6) Fig.10 As shown, the graphics are displayed.
[0066] The following are device embodiments of the present invention, which can be used to perform method embodiments of the present invention. For details not disclosed in the device embodiments, please refer to the method embodiments of the present invention.
[0067] In another embodiment of the present invention, a charging pile CAN message offline parsing system is provided, and the charging pile CAN message offline parsing system can be used to implement the above-mentioned charging pile CAN message offline parsing method. Specifically, the charging pile CAN message offline parsing system includes an initialization module, a reading module, a standardization module, a protocol type judgment module, a parsing module and a display module.
[0068] Among them, the initialization module is used to load the Python library, the configuration file reading path and the protocol dictionary; The reading module is used to read and load the message data of the charging pile.
[0069] The standardization module is used to standardize the file format and text format of message data.
[0070] The protocol type determination module is used to determine the protocol type according to the frame ID of the message data.
[0071] The parsing module is used to query the protocol dictionary according to the protocol type and parse the message data.
[0072] The display module is used to convert the parsed data text into a user-specified format, save it to a user-specified folder, and display key information on the UI interface.
[0073] In yet another embodiment of the present invention, a terminal device is provided. The terminal device includes a processor and a memory, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement the corresponding method flow or corresponding function; the processor described in the embodiment of the present invention can be used for the operation of the charging pile CAN message offline parsing method, including: S1, loading the Python library, configuring the file reading path and protocol dictionary; S2, reading and loading the message data of the charging pile; S3, standardizing the file format and text format of the message data; S4, judging the protocol type according to the frame ID of the message data; S5, querying the protocol dictionary according to the protocol type, and parsing the message data; S6, converting the parsed data text into a user-specified format, saving it to a user-specified folder, and displaying key information on the UI interface.
[0074] In another embodiment, the present invention further provides a computer-readable storage medium (Memory), which is a memory device in a terminal device for storing programs and data. It is understandable that the computer-readable storage medium here can include both the built-in storage medium in the terminal device and the extended storage medium supported by the terminal device. The computer-readable storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory.
[0075] One or more instructions stored in a computer-readable storage medium can be loaded and executed by the processor to implement the corresponding steps of the offline parsing method of the charging pile CAN message in the above-mentioned embodiment; one or more instructions in the computer-readable storage medium are loaded by the processor and the following steps are executed: S1, loading the Python library, configuring the file reading path and protocol dictionary; S2, reading and loading the message data of the charging pile; S3, standardizing the file format and text format of the message data; S4, judging the protocol type according to the frame ID of the message data; S5, querying the protocol dictionary according to the protocol type, and parsing the message data; S6, converting the parsed data text into the format specified by the user, saving it to the folder specified by the user, and displaying key information on the UI interface.
[0076] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0077] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0078] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0079] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0080] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0081] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0082] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0083] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0084] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
[0085] It should be understood that the above description is for illustration and not for limitation. Many embodiments and many applications beyond the examples provided will be apparent to those skilled in the art upon reading the above description. Therefore, the scope of this patent should not be determined with reference to the above description, but rather with reference to the preceding claims and the full scope of equivalents to which such claims are entitled. For the purpose of comprehensiveness, all articles and references, including disclosures of patent applications and publications, are incorporated herein by reference. The omission of any aspect of the subject matter disclosed herein in the preceding claims is not intended to be a waiver of such subject matter, nor should it be considered that the applicant has not considered such subject matter to be part of the disclosed inventive subject matter.
Claims
1. A charging pile CAN message offline parsing method, characterized in that: The process includes: S1, load Python library, configuration file reading path and protocol dictionary; S2, read and load the message data of the charging pile; S3, standardize the file format and text format of message data; S4, judging the protocol type according to the frame ID of the message data; S5, query the protocol dictionary according to the protocol type and parse the message data; S6, converting the parsed data text into a format specified by the user, saving it to a folder specified by the user, and displaying key information on the UI interface.
2. The charging pile CAN message offline parsing method according to claim 1 is characterized in that: In S3, the file format of the message data is converted into CSV format, and the text format of the message data is converted into UTF-8 format.
3. The charging pile CAN message offline parsing method according to claim 1 is characterized in that: In S3, the frame ID format of the message data is converted into 8 characters following 0x; and the data field format is converted into 16 characters.
4. The charging pile CAN message offline parsing method according to claim 1 is characterized in that: In S4, the protocol types include the format of BMS protocol 2023-A, the format of BMS protocol 2023-B, the format of BMS protocol 2015+, the TCU protocol format and the charging module protocol format.
5. The charging pile CAN message offline parsing method according to claim 1 is characterized in that: In S5, the frame data format is obtained according to the protocol type of the message data frame ID; Query the protocol dictionary and parse the data based on the keywords of the data frame.
6. The charging pile CAN message offline parsing method according to claim 1 is characterized in that: In S6, the parsed data is written into a database; the data is written into a text type of a specific text format using designated characters; a saving path for the parsed text is selected and the text is saved.
7. The charging pile CAN message offline parsing method according to claim 1 is characterized in that: In S6, use matplotlib to import the drawing module; extract the parsed message data; select the data to be displayed; divide the drawing board into blocks according to the data to be displayed; and make redundancy according to the maximum and minimum values of the data to be displayed; Display the graph.
8. A charging pile CAN message offline analysis system, characterized in that: include: Initialization module, used to load Python library, configuration file reading path and protocol dictionary; A reading module is used to read and load the message data of the charging pile; A standardization module is used to standardize the file format and text format of message data; A protocol type determination module is used to determine the protocol type according to the frame ID of the message data; The parsing module is used to query the protocol dictionary according to the protocol type and parse the message data; The display module is used to convert the parsed data text into the format specified by the user, save it to the folder specified by the user, and display key information on the UI interface.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the charging pile CAN message offline parsing method as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by the processor, the steps of the charging pile CAN message offline parsing method as claimed in any one of claims 1 to 7 are implemented.