A receiving method, a sending method and a transmission system for adapted communication protocol data
By analyzing and verifying the data packets in the battery management system of lithium battery electric vehicles, compatibility with different controller protocols is achieved, and the problems of high adaptation costs and poor maintenance in the existing technology are solved, thereby improving data transmission Accuracy and efficiency.
Patent Information
- Application Number
- CN202410608463.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-16
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-05-16
AI Technical Summary
In the prior art, the battery management system of lithium battery electric vehicles needs to be adapted to controllers and instruments from different manufacturers, resulting in inconsistent data transmission protocols and different hardware interfaces, resulting in high software development costs, poor maintenance and increased probability of errors.
By analyzing the received original data packet, obtaining communication protocols and verification policies, verifying the verification code in the data frame, deleting the data frame, performing operations based on the function code, and encapsulating the functional data to In the data frame, the structure is filled and the checksum correction code is added to achieve compatibility with different controller protocols.
It effectively reduces the cost of software development and maintenance, improves the accuracy and compatibility of data transmission, and reduces the complexity of adapting to different controllers.
Smart Images

Figure CN118353983B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a receiving method, a sending method and a transmission system for adapted communication protocol data. Background Art
[0002] Generally, lithium battery electric vehicles are mainly composed of a controller, an instrument and a battery pack (such as a lithium battery pack). Among them, the controller converts the electrical energy of the battery pack into mechanical energy according to the operating parameters of the battery, and the instrument displays information such as the operating status of the battery pack and the controller. The battery management system (BMS) in the battery pack is responsible for collecting data such as battery cell voltage, current and temperature, and sends the collected data to the controller and instrument after calculation and processing.
[0003] Among them, the battery pack needs to adapt to the controllers and instruments of different manufacturers, and the communication protocol data requirements of the controllers of different manufacturers. However, although the data of the battery pack is single, there is currently no unified data transmission format and standard. The data transmission protocols of various controller and instrument manufacturers are inconsistent, and the hardware interfaces are also inconsistent. It may be CAN communication (CAN: Controller Area Network, a multi-node communication protocol widely used in the automotive and industrial fields), it may be UART communication (UART: Universal Asynchronous Receiver / Transmitter, Chinese name is universal asynchronous receiver / transmitter, it is an asynchronous receiver / transmitter, UART communication is a bidirectional, serial, asynchronous communication protocol), and it may be 485 communication (a remote weighing data acquisition method of a communication interface).
[0004] Among them, the current common practice is to develop different BMS communication protocol software for different controller instrument protocols and different hardware interfaces. Then, every time a new manufacturer's controller is adapted, it is necessary to reorganize the definition data and integrate the protocol into the hardware processing logic, and generate different sets of software for different communication protocols. Therefore, the maintainability of the software is reduced, the development workload is large, and the probability of errors increases.
[0005] Therefore the prior art still needs to be improved and enhanced. Summary of the invention
[0006] The main purpose of the present invention is to provide a receiving method, processing method, sending method and transmission system for adapting communication protocol data, aiming to solve the problems of fault tolerance, maintainability and high software development cost when adapting to different controller instruments in the prior art.
[0007] In order to achieve the above object, the present invention adopts the following technical solutions:
[0008] In a first aspect, an embodiment of the present application provides a method for receiving adapted communication protocol data, which is applied to a battery management system, and the receiving method includes:
[0009] Parsing the received original data packet to obtain a corresponding communication protocol and a verification strategy, and using the verification strategy to verify an original verification code in a current data frame of the original data packet;
[0010] After the original check code is verified, the current data frame is deleted to obtain a first target data frame, and a corresponding operation is performed according to a function code in the first target data frame.
[0011] In some embodiments, the received original data packet is parsed to obtain a corresponding communication protocol and a verification strategy, and the verification strategy is used to verify the original verification code in the current data frame of the original data packet, which includes:
[0012] The original data is received by using the hardware layer of the communication module in the battery management system, and the original data packet is parsed by using the interface layer of the communication module to obtain a plurality of data frames.
[0013] In some embodiments, the current data frame includes: a frame header, a data packet length, a data frame function code, a check code, and a frame tail;
[0014] The method of parsing the received original data packet to obtain a corresponding communication protocol and a verification strategy, and using the verification strategy to verify an original verification code in a current data frame of the original data packet includes:
[0015] Using the interface layer of the communication module in the battery management system to search for the corresponding communication protocol according to the frame header and frame tail in the current data frame;
[0016] Utilizing the hardware layer of the communication module to obtain a corresponding verification strategy according to the communication protocol;
[0017] After the original data is calculated using the interface layer to obtain a theoretical correction code, the theoretical correction code is compared with the original verification code.
[0018] In some embodiments, after the original check code is checked, the current data frame is deleted to obtain a first target data frame, and a corresponding operation is performed according to a function code in the first target data frame, including:
[0019] If the theoretical correction code is consistent with the original check code, the frame header, the data packet length check code and the frame tail in the current data frame are deleted by using the interface layer to obtain the first target data frame;
[0020] Sending the first target data frame to a corresponding application layer according to the communication protocol, and using the application layer to perform a corresponding operation according to a function code in the first target data frame;
[0021] The corresponding operations include: obtaining temperature data, current data, working time data and / or status data, and executing one or more of the power on and off actions of the battery.
[0022] In a second aspect, an embodiment of the present application provides a method for sending adapted communication protocol data, which is applied to a battery management system, and the sending method includes:
[0023] Encapsulating the functional data into the first target data frame according to a preset encapsulation method to obtain a second target data frame, and completing the structures of all the second target data frames to obtain a target data packet;
[0024] Verify the target data packet according to the verification strategy to obtain a new correction code, add the new correction code to the target data packet to obtain a new data packet, and send the new data packet to the controller;
[0025] Wherein, the first target data frame and the verification strategy are both obtained by the above-mentioned receiving method of adapted communication protocol data.
[0026] In some embodiments, encapsulating the functional data into the first target data frame in a preset encapsulation manner to obtain a second target data frame, and completing the structures of all the second target data frames to obtain a target data packet, includes:
[0027] Using the application layer of the communication module in the battery management system to encapsulate the function data corresponding to the function code in the current data frame into the first target data frame according to the preset encapsulation method corresponding to the communication protocol, so as to obtain the second target data;
[0028] Using the interface layer of the communication module according to the communication protocol definition, adding a corresponding frame header, data length, function code and frame tail to each of the second target data to obtain the target data packet;
[0029] The functional data include: temperature data, current data, working time data and status data.
[0030] In some embodiments, the step of verifying the target data packet according to the verification strategy to obtain a new correction code, and adding the new correction code to the target data packet to obtain a new data packet, so as to send the new data packet to the controller, includes:
[0031] Utilizing the interface layer to calculate the target data packet according to the verification strategy corresponding to the communication protocol to obtain the new correction code;
[0032] The new correction code is added to the target data packet by using the interface layer to obtain the new data packet, and the new data packet is sent to the controller by using the hardware layer of the communication module.
[0033] In a third aspect, an embodiment of the present application provides a transmission system for adapting communication protocol data, including: a receiving end and a sending end;
[0034] The receiving end is used to parse the received original data packet to obtain the corresponding communication protocol and verification strategy, and use the verification strategy to verify the original verification code in the current data frame of the original data packet;
[0035] The receiving end is further used to delete the current data frame to obtain a first target data frame after the original check code is checked, and perform a corresponding operation according to the function code in the first target data frame;
[0036] The transmitting end is used to encapsulate the functional data into the first target data frame according to a preset encapsulation method to obtain a second target data frame, and complete the structure of all the second target data frames to obtain a target data packet;
[0037] The sending end is further used to verify the target data packet according to the verification strategy to obtain a new correction code, and add the new correction code to the target data packet to obtain a new data packet, so as to send the new data packet to the controller.
[0038] In a fourth aspect, an embodiment of the present application provides a lithium battery electric vehicle, comprising: a memory, a processor, a display, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the method described above when executed by the processor.
[0039] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which implements the steps of the method described above when executed by a processor.
[0040] Compared with the prior art, the present invention provides a receiving method, a sending method and a transmission system for adapted communication protocol data. The receiving method parses the original data packet to obtain a corresponding verification strategy, uses the verification strategy to verify the original verification code in the current data frame, and deletes the current data frame after the verification passes, and then performs corresponding operations according to the function code in the obtained first target data frame, thereby achieving compatibility with different communication protocols and effectively reducing software development costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0042] Figure 1 A flowchart of a preferred embodiment of a method for receiving adapted communication protocol data provided by the present invention;
[0043] Figure 2 A flowchart of step S100 in a preferred embodiment of the method for receiving adapted communication protocol data provided by the present invention;
[0044] Figure 3 A flowchart of step S200 in a preferred embodiment of the method for receiving adapted communication protocol data provided by the present invention;
[0045] Figure 4 A flowchart of data parsing and processing in a preferred embodiment of the method for receiving adapted communication protocol data provided by the present invention;
[0046] Figure 5 A flowchart of a preferred embodiment of a method for transmitting adapted communication protocol data provided by the present invention;
[0047] Figure 6 A flowchart of step S1000 in a preferred embodiment of the method for transmitting adapted communication protocol data provided by the present invention;
[0048] Figure 7 A flowchart of step S2000 in a preferred embodiment of the method for transmitting adapted communication protocol data provided by the present invention;
[0049] Figure 8 The architecture relationship diagram of the transmission system of the adaptive communication protocol data provided by the present invention;
[0050] Fig. 9 A schematic diagram of the operating environment of a preferred embodiment of the lithium battery electric vehicle provided by the present invention. DETAILED DESCRIPTION
[0051] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0052] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0053] Hereinafter, the terms "including", "having" and their cognates that can be used in various embodiments of the present application are intended only to indicate specific features, numbers, steps, operations, elements, components or a combination of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or a combination of the foregoing items or increasing the possibility of one or more features, numbers, steps, operations, elements, components or a combination of the foregoing items. In addition, the terms "first", "second", "third" and the like are only used to distinguish descriptions and cannot be understood as indicating or implying relative importance.
[0054] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.
[0055] The present invention provides a receiving method, a sending method and a transmission system for adapted communication protocol data. In the process of receiving data, the present invention receives and parses the original data packet to obtain a corresponding verification strategy, uses the verification strategy to verify the original verification code in the current data frame of the original data packet, deletes the current data frame after the verification passes, and then performs corresponding operations according to the function code in the obtained first target data frame. In the process of sending data, the function data is encapsulated into the first target data frame and the remaining structure is completed, and the obtained target data packet is verified according to the verification strategy to obtain a new correction code, and the new correction code is encapsulated into the target data packet so that the obtained new data packet can be sent out, thereby achieving compatibility with protocols of different controllers and effectively reducing software development and maintenance costs.
[0056] The following describes the design scheme of the method for receiving adapted communication protocol data and the method for sending adapted communication protocol data through specific exemplary embodiments. It should be noted that the following embodiments are only used to explain the technical scheme of the invention and are not specifically limited:
[0057] See also Figure 1 The embodiment of the present application provides a method for receiving adapted communication protocol data, which is applied to a battery management system. The receiving method includes:
[0058] S100, parsing the received original data packet to obtain the corresponding communication protocol and verification strategy, and using the verification strategy to verify the original verification code in the current data frame of the original data packet.
[0059] The current data frame includes: a frame header, a data packet length, a data frame function code, a check code and a frame tail.
[0060] Specifically, the lithium battery electric bicycle includes a battery management system (BMS), and the battery management system includes: a communication module. In this application, the communication module is divided into a data application layer, an interface layer, and a hardware layer. The communication module can decouple data transmission and communication protocols, and is compatible with the hardware communication protocols of all controller manufacturers (for example: SPI, I2C, CAN, USB, and UART, etc.). The communication module mainly realizes two major functions: receiving and sending.
[0061] In the lithium battery electric bicycle system, the battery is a passive data transmission feature. In this application, a set of software is compatible with the communication protocols of different manufacturers. Then, the process of the software to achieve reception is as follows:
[0062] First, the communication module receives the raw data on the link, which can come from the controller system or instrument, and can be communicated through CAN or UART and other hardware interfaces. Among them, the raw data is mainly the battery status of the controller, such as power on and off, and can also be requested for battery status data, such as battery temperature, voltage and current information.
[0063] The data is usually transmitted in the form of data frames, and the structure of the data frame mainly includes: frame header, data packet length, data frame function code, check code and frame tail information.
[0064] Then, the communication module parses the received original data packet, that is, finds the communication protocol of the corresponding controller and the verification strategy corresponding to the communication protocol according to the frame header and frame tail of the data frame.
[0065] Secondly, the communication module uses the verification strategy to verify the original verification code in the current data frame of the original data packet, that is, uses the corresponding verification strategy found to verify the accuracy of the received data frame.
[0066] In this application, after parsing the original data to obtain the corresponding verification strategy, the verification strategy is used to verify the original verification code in the current data frame of the original data packet to verify the accuracy of the data frame, effectively ensuring the correctness of the data transmission process and avoiding problems such as mistransmission.
[0067] For further information, see Figure 2 Step S100: parsing the received original data packet to obtain the corresponding communication protocol and verification strategy, and using the verification strategy to verify the original verification code in the current data frame of the original data packet, including:
[0068] S110, using the interface layer of the communication module in the battery management system to search for a corresponding communication protocol according to the frame header and frame footer in the current data frame;
[0069] S120, using the hardware layer of the communication module to obtain a corresponding verification strategy according to the communication protocol;
[0070] S130, after calculating the original data using the interface layer to obtain a theoretical correction code, the theoretical correction code is compared with the original check code.
[0071] Specifically, the specific implementation process of the receiving method of the adapted communication protocol data is as follows:
[0072] First, the interface layer is responsible for parsing the data protocol, that is, finding the communication protocol of the corresponding manufacturer based on the frame header and frame tail of the data frame, and finding the verification strategy of the corresponding manufacturer based on the communication protocol, so as to verify the accuracy of the received data frame:
[0073] For example, the frame header corresponding to the protocol of manufacturer A is AA and the frame trailer is DD; the frame header corresponding to the protocol of manufacturer B is BB and the frame trailer is EE.
[0074] Then, the manufacturer's protocol can be determined through the frame header and frame tail. After determining the manufacturer's protocol, it is necessary to further ensure the accuracy of the data. The general protocol will have a check on the entire data packet, such as CRC check (CRC is a cyclic redundancy check code, which is the most commonly used error checking code in the field of data communication. Its characteristic is that the length of the information field and the check field can be arbitrarily selected. Cyclic redundancy check is a data transmission error detection function. It performs polynomial calculations on the data and attaches the results to the end of the frame. The receiving device also executes a similar algorithm to ensure the correctness and integrity of data transmission), or calculates a checksum.
[0075] Then, the accuracy of the data can be ensured through verification, that is, the interface layer calculates the original data to obtain the theoretical correction code, and compares the theoretical correction code with the original verification code. In other words, the interface layer calculates all the data to obtain the data verification value, and then compares it with the received verification code to ensure consistency, and then submits it to the protocol application layer of the corresponding manufacturer.
[0076] Furthermore, step S100, parsing the received original data packet to obtain the corresponding communication protocol and verification strategy, and using the verification strategy to verify the original verification code in the current data frame of the original data packet, previously includes:
[0077] S10, using the hardware layer of the communication module in the battery management system to receive the original data, and using the interface layer of the communication module to parse the original data packet to obtain a number of data frames.
[0078] Specifically, before parsing, the hardware layer is solely responsible for receiving the original data on the link and submitting it to the interface layer (or data interface layer) for processing. Then, the interface layer is responsible for parsing the data protocol to obtain several data frames.
[0079] For further information, please refer to Figure 1 S200: After the original check code is verified, the current data frame is deleted to obtain a first target data frame, and a corresponding operation is performed according to the function code in the first target data frame.
[0080] The corresponding operations include: obtaining temperature data, current data, working time data and / or status data, and executing one or more of the power on and off actions of the battery.
[0081] Specifically, when the original check code in the current data frame is checked, if the original check code passes the check, the frame header, frame tail, data packet length and check code in the current data frame are deleted to obtain the first target data frame. Then, the corresponding operation is performed according to the function code in the first target data frame, for example, temperature data, current data, working time data or / and status data are obtained according to the corresponding function code, and one or more of the power on / off actions of the battery are executed.
[0082] In the present application, by first deleting the data frame and then executing the corresponding functional operation, it helps to reduce the recognition processing of the entire data, thereby speeding up the execution of the corresponding operation and improving the processing efficiency.
[0083] For further information, see Figure 3 Step S200: after the original check code is verified, the current data frame is deleted to obtain a first target data frame, and a corresponding operation is performed according to the function code in the first target data frame, including:
[0084] S210, if the theoretical correction code is consistent with the original check code, the frame header, the data packet length check code and the frame tail in the current data frame are deleted by using the interface layer to obtain a first target data frame;
[0085] S220: Send the first target data frame to the corresponding application layer according to the communication protocol, and use the application layer to perform corresponding operations according to the function code in the first target data frame.
[0086] Specifically, after the theoretical correction code is calculated, the theoretical correction code is compared with the original check code:
[0087] If the theoretical correction code is consistent with the original check code, it means that the inspection is passed and the received data is accurate. Then, the interface layer removes the frame header, frame tail, data packet length, check code and other data in the data frame to obtain the first target data frame, and submits the first target data frame to the application layer of the corresponding manufacturer protocol.
[0088] Secondly, the application layer focuses on processing functional data. The application layer performs corresponding operations according to the function code in the first target data frame. For example, if the application layer requests the temperature data of the battery pack according to the controller or instrument, then the application layer goes to the data center in the BMS (including data collected by other software modules, such as the voltage sampling conversion module to collect voltage, the current sampling module to collect current data, and the temperature sampling module to collect temperature data) to obtain temperature data; if the working time and status data of the battery pack are requested, then the application layer goes to the corresponding layer to obtain the battery working time data and status data; if the battery is controlled to be turned on or off, then the battery executes the on / off action, etc. Among them, the flowchart of data parsing and processing is as follows: Figure 4 shown.
[0089] Finally, after executing the corresponding operation, the execution status is obtained, and the hardware layer sends the execution status out. In other embodiments of the present application, after executing the corresponding operation, the BMS sends the original data back.
[0090] For further information, see Figure 5 The embodiment of the present application provides a method for sending adapted communication protocol data, which is applied to a battery management system. The sending method includes:
[0091] S1000, encapsulating the functional data into the first target data frame according to a preset encapsulation method to obtain a second target data frame, and completing the structures of all the second target data frames to obtain a target data packet.
[0092] The first target data frame is obtained by the above-mentioned receiving method of the adapted communication protocol data.
[0093] Specifically, the sending function of the communication module, that is, the implementation process of the method for sending the adapted communication protocol data is as follows:
[0094] The communication module encapsulates the function data corresponding to the function code in the first target data frame into the first target data frame according to the preset encapsulation method specified by the communication protocol to obtain a second target data frame, and then completes the structure of all second target data frames according to the communication protocol to obtain a target data packet.
[0095] By encapsulating the functional data into the first target data frame and completing the structure of the encapsulated second target data frame, a target data packet is obtained for data verification, thereby improving the accuracy of the verification data.
[0096] For further information, see Figure 6 Step S1000: encapsulate the functional data into the first target data frame according to a preset encapsulation method to obtain a second target data frame, and complete the structure of all second target data frames to obtain a target data packet, including:
[0097] S1100, using the application layer of the communication module in the battery management system to encapsulate the function data corresponding to the function code in the current data frame into the first target data frame according to the preset encapsulation method corresponding to the communication protocol, to obtain the second target data;
[0098] S1200. Using the interface layer of the communication module according to the communication protocol definition, add a corresponding frame header, data length, function code and frame tail to each second target data to obtain a target data packet.
[0099] Among them, the functional data includes: temperature data, current data, working time data and status data.
[0100] Specifically, the implementation process of the method for transmitting the adapted communication protocol data is as follows:
[0101] First, the application layer of the communication module in the battery management system encapsulates the functional data (including temperature data, current data, working time data and status data) corresponding to the function code in the current data frame into the first target data frame according to the preset encapsulation method corresponding to the communication protocol, that is, the application layer is based on the function codes received from different manufacturers. For example, if the instrument controller requests temperature data, then the temperature data is combined according to the requirements of the communication protocol; similarly, if the request is for current data, working time data and status data, then the corresponding data are combined together respectively, or a mixed combination can be used. The assembly method (preset encapsulation method) is specifically determined according to the protocol manufacturer requirements of the application layer to obtain the second target data.
[0102] Then, the second target data is submitted to the interface layer, and the interface layer adds a frame header, data length, function code and frame tail defined according to the communication protocol to each second target data to obtain a target data packet.
[0103] For further information, please refer to Figure 5 , S2000, verify the target data packet according to the verification strategy to obtain a new correction code, add the new correction code to the target data packet to obtain a new data packet, and send the new data packet to the controller.
[0104] The verification strategy is obtained by the above-mentioned receiving method of the adapted communication protocol data.
[0105] Specifically, after obtaining the target data packet, the target data packet is verified according to the verification strategy to obtain a new correction code, and the new correction code is added to the target data packet to obtain a new data packet. Finally, the new data packet is sent to the controller, and a new verification code is obtained by verifying the target data packet, and the new verification code is encapsulated together to obtain a new data packet, and then the new data packet is sent to the controller, thereby realizing efficient and accurate verification processing of the transmitted data, and further improving the correctness of data transmission.
[0106] For further information, see Figure 7 Step S2000: verify the target data packet according to the verification strategy to obtain a new correction code, and add the new correction code to the target data packet to obtain a new data packet, so as to send the new data packet to the controller, including:
[0107] S2100, using the interface layer to calculate the target data packet according to the verification strategy corresponding to the communication protocol to obtain a new correction code;
[0108] S2200. Using the interface layer, add the new correction code to the target data packet to obtain a new data packet, and using the hardware layer of the communication module to send the new data packet to the controller.
[0109] Specifically, after obtaining the target data packet, the interface layer calculates the target data packet according to the verification strategy corresponding to the communication protocol to obtain a new correction code, and adds the new correction code to the target data packet to obtain a new data packet.
[0110] Then, the interface layer submits the complete data (new data packet) to the hardware layer, and the hardware layer sends the new data packet to the controller. That is, the hardware layer can trigger the data to be sent to the bus one by one by configuring the MCU hardware register through cyclic scanning or interrupt mode. Finally, the controller receives the data on the bus and the instrument is responsible for displaying it.
[0111] Therefore, the hardware layer in this application is independent of the communication protocol and has independent processing capabilities, which is convenient for software maintenance and MCU replacement. Moreover, for communication protocols such as CAN or UART of different hardware circuits, it is only necessary to initialize the corresponding interface during initialization and assign the corresponding interface function pointer to the data application layer and the interface layer.
[0112] Furthermore, after the MCU is started, the data application layer, interface layer and hardware layer need to be connected vertically in series. Then, by assigning the function pointer to the corresponding layer, it is equivalent to leaving a contact method for the corresponding layer. For example, after the hardware receives the data, it contacts and sends the data to the interface layer. The interface layer processes it immediately after receiving it and finds that it can be submitted to the application layer, so it contacts the application layer, and the application layer processes the data again. Then, after the application layer processes the data, it contacts the interface layer to assemble the data. After the interface layer assembles the data, it contacts the hardware layer, and the hardware layer is responsible for sending the data.
[0113] For further information, see Figure 8 , an embodiment of the present application provides a transmission system for adapted communication protocol data, including: a receiving end 1 and a sending end 2.
[0114] Receiving end 1 is used to parse the received original data packet, obtain the corresponding communication protocol and verification strategy, and use the verification strategy to verify the original check code in the current data frame of the original data packet; receiving end 1 is also used to delete the current data frame to obtain the first target data frame after the original check code is verified, and perform corresponding operations according to the function code in the first target data frame.
[0115] The transmitting end 2 is used to encapsulate the functional data into the first target data frame according to a preset encapsulation method to obtain the second target data frame, and complete the structure of all the second target data frames to obtain the target data packet; the transmitting end 2 is also used to verify the target data packet according to the verification strategy to obtain a new correction code, and add the new correction code to the target data packet to obtain a new data packet, so as to send the new data packet to the controller.
[0116] Specifically, the transmission system of the adapted communication protocol data is applicable to the receiving method of the adapted communication protocol data and the sending method of the adapted communication protocol data. Then, the implementation process of the transmission system of the adapted communication protocol data is as follows:
[0117] When the communication module is in the state of receiving data, first, after receiving the original data on the link, the communication module parses the original data packet, that is, according to the frame header and frame tail of the data frame, finds the communication protocol of the corresponding manufacturer and the verification strategy corresponding to the communication protocol.
[0118] Then, the original check code in the current data frame of the original data packet is checked using the check strategy, that is, the accuracy of the received data frame is checked using the corresponding check strategy found. Finally, after the original check code is checked, the current data frame is deleted to obtain the first target data frame, and the corresponding operation is performed according to the function code in the first target data frame, for example, obtaining temperature data, current data, working time data or / and status data, and performing one or more of the power on / off actions of the battery.
[0119] When the communication module is in the state of sending data, first, the communication module encapsulates the function data corresponding to the function code in the first target data frame into the first target data frame according to the preset encapsulation method specified by the communication protocol to obtain the second target data frame. Then, according to the communication protocol, the structure of all the second target data frames is completed to obtain the target data packet, and the target data packet is verified according to the verification strategy to obtain a new correction code, and then the new correction code is added to the target data packet to obtain a new data packet.
[0120] Finally, the new data packet is sent to the controller, a new check code is obtained by checking the target data packet, and the new check code is encapsulated to obtain a new data packet, and then the new data packet is sent to the controller.
[0121] In the present application, in the process of receiving data, after the original data packet is parsed to obtain the corresponding verification strategy, the original verification code in the current data frame is verified using the verification strategy, and the corresponding operation is performed according to the function code of the current data frame after the verification is passed. In the process of sending data, the function data is encapsulated into the first target data frame, the remaining structure is completed, and the obtained target data packet is verified according to the verification strategy to obtain a new correction code, and the new correction code is encapsulated into the target data packet to obtain a new data packet.
[0122] This application implements a set of software compatible with communication protocols of different controller manufacturers, and provides a reasonable architecture for separation of communication protocol analysis, data processing and hardware layers, which is convenient for software maintenance. The hardware layer is independent of the protocol; the data processing logic of an application layer can be transmitted through different CAN or UART hardware interfaces.
[0123] Furthermore, if Fig. 9 As shown, based on the above-mentioned method for receiving and sending adapted communication protocol data, the present invention also provides a lithium battery electric vehicle, which includes a processor 10, a memory 20 and a display 30. Fig. 9 Only some components of the lithium battery electric vehicle are shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
[0124] In some embodiments, the memory 20 may be an internal storage unit of a lithium battery electric vehicle, such as a hard disk or memory of a lithium battery electric vehicle. In other embodiments, the memory 20 may also be an external storage device of a lithium battery electric vehicle, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on a lithium battery electric vehicle. Further, the memory 20 may also include both an internal storage unit of a lithium battery electric vehicle and an external storage device. The memory 20 is used to store application software and various types of data installed in a lithium battery electric vehicle, such as program codes for installing a lithium battery electric vehicle. The memory 20 may also be used to temporarily store data that has been output or is to be output. In one embodiment, a computer program 40 is stored on the memory 20, and the computer program 40 can be executed by the processor 10, thereby realizing the receiving method of the adapted communication protocol data or the sending method of the adapted communication protocol data in the present application.
[0125] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run program codes or process data stored in the memory 20, such as executing a receiving method for adapted communication protocol data or a sending method for adapted communication protocol data.
[0126] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 30 is used to display information on the lithium battery electric vehicle and to display a visual user interface. The components 10-30 of the lithium battery electric vehicle communicate with each other through a system bus.
[0127] In one embodiment, the steps implemented when the processor 10 executes the computer program 40 in the memory 20 can refer to the corresponding description in the above-mentioned method for receiving adapted communication protocol data or the method for sending adapted communication protocol data, and will not be repeated here.
[0128] Furthermore, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program 40, and when the computer program 40 is executed by a processor, it implements the steps of the above-mentioned method for receiving adapted communication protocol data or the method for sending adapted communication protocol data; since the above-mentioned steps of the method for receiving adapted communication protocol data or the method for sending adapted communication protocol data are described in detail, they will not be repeated here.
[0129] In summary, the present invention provides a receiving method, a sending method and a transmission system for adapted communication protocol data, wherein the receiving method comprises: parsing the received original data packet to obtain the corresponding communication protocol and verification strategy, and using the verification strategy to verify the original verification code in the current data frame of the original data packet; after the original verification code is verified, the current data frame is deleted to obtain a first target data frame, and corresponding operations are performed according to the function code in the first target data frame.
[0130] After parsing the original data packet to obtain the corresponding verification strategy, the verification strategy is used to verify the original verification code in the current data frame, and the current data frame is deleted after the verification passes, and then the corresponding operation is performed according to the function code in the obtained first target data frame, thereby achieving compatibility with different communication protocols and effectively reducing software development costs.
[0131] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A method for receiving adapted communication protocol data, It is characterized in that Applied to a battery management system, the receiving method includes: Parsing the received original data packet, adapting the corresponding communication protocol and verification strategy, and verifying the original verification code in the current data frame of the original data packet using the verification strategy; After the original check code is verified, the current data frame is deleted to obtain a first target data frame, and a corresponding operation is performed according to the function code in the first target data frame; The current data frame includes: a frame header, a data packet length, a data frame function code, a check code and a frame tail; The step of parsing the received original data packet, adapting the corresponding communication protocol and verification strategy, and verifying the original verification code in the current data frame of the original data packet using the verification strategy includes: Using the interface layer of the communication module in the battery management system to search for the corresponding communication protocol according to the frame header and frame tail in the current data frame; Utilizing the hardware layer of the communication module to obtain a corresponding verification strategy according to the communication protocol; After calculating the original data using the interface layer to obtain a theoretical check code, the theoretical check code is compared with the original check code; After the original check code is checked, the current data frame is deleted to obtain a first target data frame, and a corresponding operation is performed according to the function code in the first target data frame, including: If the theoretical check code is consistent with the original check code, the frame header, the data packet length check code and the frame tail in the current data frame are deleted by using the interface layer to obtain the first target data frame; Sending the first target data frame to a corresponding application layer according to the communication protocol, and using the application layer to perform a corresponding operation according to a function code in the first target data frame; The corresponding operations include: obtaining temperature data, current data, working time data and / or status data, and executing one or more of the power on and off actions of the battery.
2. The method for receiving adapted communication protocol data according to claim 1, It is characterized in that The method of parsing the received original data packet, adapting the corresponding communication protocol and verification strategy, and verifying the original verification code in the current data frame of the original data packet using the verification strategy includes: The original data is received by using the hardware layer of the communication module in the battery management system, and the original data packet is parsed by using the interface layer of the communication module to obtain a plurality of data frames.
3. A method for transmitting adapted communication protocol data, It is characterized in that Applied to a battery management system, the sending method includes: Encapsulating the functional data into the first target data frame according to a preset encapsulation method to obtain a second target data frame, and completing the structures of all the second target data frames to obtain a target data packet; Verify the target data packet according to the verification strategy to obtain a new verification code, add the new verification code to the target data packet to obtain a new data packet, and send the new data packet to the controller; Wherein, the first target data frame and the verification strategy are both obtained by the method for receiving adapted communication protocol data according to any one of claims 1-2.
4. The method for transmitting the adapted communication protocol data according to claim 3, It is characterized in that The step of encapsulating the functional data into the first target data frame in a preset encapsulation manner to obtain a second target data frame, and completing the structures of all the second target data frames to obtain a target data packet includes: Using the application layer of the communication module in the battery management system to encapsulate the function data corresponding to the function code in the current data frame into the first target data frame according to the preset encapsulation method corresponding to the communication protocol, so as to obtain the second target data; Using the interface layer of the communication module according to the communication protocol definition, adding a corresponding frame header, data length, function code and frame tail to each of the second target data to obtain the target data packet; The functional data include: temperature data, current data, working time data and status data.
5. The method for transmitting the adapted communication protocol data according to claim 4, It is characterized in that The step of verifying the target data packet according to the verification strategy to obtain a new verification code, and adding the new verification code to the target data packet to obtain a new data packet, so as to send the new data packet to the controller, includes: Utilizing the interface layer to calculate the target data packet according to the verification strategy corresponding to the communication protocol to obtain the new verification code; The new check code is added to the target data packet by using the interface layer to obtain the new data packet, and the new data packet is sent to the controller by using the hardware layer of the communication module.
6. A transmission system for adapting communication protocol data, It is characterized in that Including: receiving end and sending end; The receiving end is used to parse the received original data packet, adapt the corresponding communication protocol and verification strategy, and use the verification strategy to verify the original verification code in the current data frame of the original data packet; The receiving end is further used to delete the current data frame to obtain a first target data frame after the original check code is checked, and perform a corresponding operation according to the function code in the first target data frame; The transmitting end is used to encapsulate the functional data into the first target data frame according to a preset encapsulation method to obtain a second target data frame, and complete the structure of all the second target data frames to obtain a target data packet; The sending end is further used to verify the target data packet according to the verification strategy to obtain a new verification code, and add the new verification code to the target data packet to obtain a new data packet, so as to send the new data packet to the controller.
7. A lithium battery electric vehicle, It is characterized in that include: A memory, a processor, a display, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the method according to any one of claims 1 to 5 when executed by the processor.
8. A computer-readable storage medium, It is characterized in that A computer program is stored, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Serial port data analysis method and device
CN110032535A
Verification method of software communication protocol
CN110995686A
Serial port communication method based on inspection mode and serial port chip
CN113177014A
Private protocol fault-tolerant processing method and device based on serial communication and storage medium
CN114337915A
Multi-protocol adaptive analysis method, Internet of Things metering device, equipment and medium
CN115334175A
