Equipment test data frame format verification method and device, system, and storage medium
By defining the hexadecimal data frame format in the XML file and performing frame-by-frame verification, the problem of poor universality of data frame format verification for different models and communication types in the prior art is solved, and efficient data frame format verification is achieved.
Patent Information
- Application Number
- CN202510007007.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2045-01-03
AI Technical Summary
The prior art is difficult to realize universal verification of hexadecimal data frame formats of different models and communication types, resulting in large workloads, long cycles and poor versatility of software compilation.
By defining the data frame format of hexadecimal data in an XML file, including frame length, frame header, frame number and accumulation sum, and grouping data according to frame length, verifying the data accuracy frame by frame, and automatically finding the next correct frame.
The universal verification of hexadecimal data is achieved, which reduces the workload of software compilation and improves verification efficiency and universality.
Smart Images

Figure CN119402574B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data processing, and in particular relates to a method and device, a system and a storage medium for checking the format of equipment test data frames. Background Art
[0002] During the communication process of equipment products, a large number of hexadecimal communication data files will be generated. During use, the above files need to be divided and converted to form decimal data with actual physical meaning. The premise of data division and conversion is that the data is true and valid. Methods to characterize the authenticity and validity of data include: frame length, frame sequence number, cumulative sum, etc. There are differences in data frame formats for different models, different communication types, and different stages. The traditional method is to compile specific verification software for different frame formats. The software compilation workload is large and the cycle is long, but the versatility is poor, which is not conducive to rapid product assurance. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide a method and device, a system and a storage medium for checking the format of equipment test data frames, so as to realize universal checking of hexadecimal data.
[0004] To achieve the above object, the present invention adopts the following technical solution:
[0005] A method for verifying the format of an equipment test data frame, comprising:
[0006] Step S1, defining a data frame format of hexadecimal data in an XML file; wherein the data frame format includes: frame length, frame header, frame sequence number and cumulative sum;
[0007] Step S2, grouping the hexadecimal data according to the frame length;
[0008] Step S3, check the correctness of each group of data frame by frame, and automatically search for the next correct frame according to the frame format for the error situation;
[0009] Among them, read the hexadecimal data and group them according to 233 bytes per frame. Each group of data corresponds to a data transmission in the communication frame format. For each group of data, find the starting point of the data, find the frame header position requirement according to the frame format table configured in XML, and calculate whether its hexadecimal value is the required value (0xEB90). Find the frame sequence number and data length requirements according to the frame format table configured in XML, and calculate its hexadecimal value to see if the difference with the previous group of data is the required step. Find the cumulative sum and data length according to the frame format table configured in XML, and calculate whether the calculated value is consistent with the cumulative sum byte. If they are consistent, the result of this group of data is determined to be normal. If a frame has a cumulative sum error, it means that this frame is unreliable data, and continue to find the next valid data. If a frame has a cumulative sum error, it means that this frame is unreliable data, and continue to find the next valid data.
[0010] The present invention also provides an equipment test data frame format verification device, comprising:
[0011] A preprocessing module is used to define a data frame format of hexadecimal data in an XML file; wherein the data frame format includes: frame length, frame header, frame sequence number and cumulative sum;
[0012] A grouping module, used to group hexadecimal data according to frame length;
[0013] The verification module is used to verify the correctness of each group of data frame by frame, and automatically find the next correct frame according to the frame format for error conditions.
[0014] An embodiment of the present invention further provides an equipment test data frame format verification system, comprising: a memory and a processor, wherein the memory stores a computer program executed by the processor, and the computer program executes an equipment test data frame format verification method when executed by the processor.
[0015] An embodiment of the present invention further provides a storage medium, on which a computer program is stored, and the computer program executes the equipment test data frame format verification method when running.
[0016] The present invention defines the data frame format of hexadecimal data in an XML file; wherein the data frame format includes: frame length, frame header, frame sequence number and cumulative sum; the hexadecimal data is grouped according to the frame length; the correctness of each group of data is checked frame by frame; in the case of an error in the intermediate data, the next correct frame is automatically searched according to the frame format; and the technical solution of the present invention is adopted to realize the universal verification of hexadecimal data. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0018] Figure 1 The present invention is a flowchart of a method for verifying the format of a test data frame according to an embodiment of the present invention. DETAILED DESCRIPTION
[0019] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0020] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0021] Embodiment 1:
[0022] like Figure 1 As shown, an embodiment of the present invention provides a method for checking the format of an equipment test data frame, comprising:
[0023] Step S1, define the data frame format of hexadecimal data in an XML file; wherein the data frame format includes: frame length, frame header, frame sequence number and cumulative sum; configure the frame format relationship of different models and projects through the XML configuration file to realize the inspection of multiple projects;
[0024] Step S2, grouping the hexadecimal data according to the frame length;
[0025] Step S3: Check the correctness of each group of data frame by frame, and automatically search for the next correct frame according to the frame format for any error.
[0026] Furthermore, the verification process of the embodiment of the present invention is as follows: read the hexadecimal data, group them according to 233 bytes per frame, and each group of data corresponds to a data transmission in the communication frame format; for each group of data, find the data starting point (actual byte position Base), find out the frame header position (byte number 0, actual position is Base[0]) and data length (2 bytes) according to the frame format table configured in XML, and calculate whether its hexadecimal value (Base[0]*0x100+Base[1]) is the required value (0xEB90); find out the frame number (byte number 2, actual position Base[2]) and data length (2 bytes) according to the frame format table configured in XML, and calculate whether its hexadecimal value (Base[2 ]*0x100+Base[3]), whether the difference with the previous set of data (the previous frame byte position Base-frame length 233+start 2, recorded as DataB, the value is DataB[0]*x0100+DataB[1]) is the required step (step value 2); according to the frame format table configured in XML, find the cumulative sum (byte sequence number 232, actual position Base
[232] ), data length (1 byte) and calculate the cumulative sum value (the cumulative sum of all data from bytes 0 to 231, that is, ∑(Base[0]~Base
[231] )) to see if it is consistent with the cumulative sum byte (byte sequence number 232 value, that is, Base
[232] ). If they are consistent, the result of this set of data is determined to be normal. If a frame has a cumulative sum error, it means that this frame is unreliable data, and continue to search for the next valid data; if a frame has a cumulative sum error, it means that this frame is unreliable data, and continue to search for the next valid data.
[0027] In order to achieve the universality and applicability of the frame format verification software, when looking for the valid data value of the next frame, search byte by byte in the above manner until the data that meets the frame format requirements is found, and re-search the positioning byte number to avoid the intermediate errors affecting the subsequent data judgment.
[0028] Embodiment 2:
[0029] The embodiment of the present invention further provides an equipment test data frame format verification device, comprising:
[0030] A preprocessing module is used to define a data frame format of hexadecimal data in an XML file; wherein the data frame format includes: frame length, frame header, frame sequence number and cumulative sum;
[0031] A grouping module, used to group hexadecimal data according to frame length;
[0032] The verification module is used to verify the correctness of each group of data frame by frame, and automatically find the next correct frame according to the frame format for error conditions.
[0033] Embodiment 3:
[0034] An embodiment of the present invention further provides an equipment test data frame format verification system, comprising: a memory and a processor, wherein the memory stores a computer program executed by the processor, and the computer program executes an equipment test data frame format verification method when executed by the processor.
[0035] Embodiment 4:
[0036] An embodiment of the present invention further provides a storage medium, on which a computer program is stored, and the computer program executes the equipment test data frame format verification method when running.
[0037] The embodiments described above are only descriptions of the preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the protection scope determined by the claims of the present invention.
Claims
1. A method for checking the format of equipment test data frame, characterized in that: include: Step S1, defining a data frame format of hexadecimal data in an XML file; wherein the data frame format includes: frame length, frame header, frame sequence number and cumulative sum; Step S2, grouping the hexadecimal data according to the frame length; Step S3, check the correctness of each group of data frame by frame, and automatically search for the next correct frame according to the frame format for the error situation; Among them, read the hexadecimal data and group them according to 233 bytes per frame. Each group of data corresponds to a data transmission in the communication frame format. For each group of data, find the starting point of the data, find the frame header position requirement according to the frame format table configured in XML, and calculate whether its hexadecimal value is the required value. Find the frame sequence number and data length requirement according to the frame format table configured in XML, and calculate its hexadecimal value to see if the difference with the previous group of data is the required step. Find the cumulative sum and data length according to the frame format table configured in XML, and whether the calculated cumulative sum value is consistent with the cumulative sum byte. If they are consistent, the result of this group of data is determined to be normal. If there is a cumulative sum error in a frame, it means that this frame is unreliable data, and continue to look for the next valid data.
2. A device for checking the format of an equipment test data frame, characterized in that: include: A preprocessing module is used to define a data frame format of hexadecimal data in an XML file; wherein the data frame format includes: frame length, frame header, frame sequence number and cumulative sum; A grouping module, used to group hexadecimal data according to frame length; The verification module is used to verify the correctness of each group of data frame by frame, and automatically find the next correct frame according to the frame format for errors; Among them, read the hexadecimal data and group them according to 233 bytes per frame. Each group of data corresponds to a data transmission in the communication frame format. For each group of data, find the starting point of the data, find the frame header position requirement according to the frame format table configured in XML, and calculate whether its hexadecimal value is the required value. Find the frame sequence number and data length requirement according to the frame format table configured in XML, and calculate its hexadecimal value to see if the difference with the previous group of data is the required step. Find the cumulative sum and data length according to the frame format table configured in XML, and whether the calculated cumulative sum value is consistent with the cumulative sum byte. If they are consistent, the result of this group of data is determined to be normal. If there is a cumulative sum error in a frame, it means that this frame is unreliable data, and continue to look for the next valid data.
3. A data frame format verification system for equipment testing, characterized in that: include: A memory and a processor, wherein the memory stores a computer program executed by the processor, and when the computer program is executed by the processor, the equipment test data frame format verification method as claimed in claim 1 is executed.
4. A storage medium, characterized in that: The storage medium stores a computer program, and the computer program executes the equipment test data frame format verification method as claimed in claim 1 when running.
Citation Information
Patent Citations
Key test instruction system and method based on serial port redundancy strategy
CN106911530A
Method for automatically analyzing message data in terminal communication protocol
CN110719296A