Data analysis method, device and computer readable storage medium
By comparing the high, middle, and low bytes of the data packet separately, and using signal transformation ratio and correction factor to convert the signal reference value, abnormal data can be quickly identified. This solves the problem of tedious data analysis under high-speed data acquisition, and improves the efficiency of data analysis and the stability of the server.
Patent Information
- Application Number
- CN202110594916.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-28
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2041-05-28
AI Technical Summary
In high-speed data acquisition scenarios, the cumbersome data analysis and processing procedures put enormous pressure on servers, and existing technologies struggle to efficiently simplify the data analysis process.
By comparing the high, middle, and low bytes of the data packet separately, and using preset methods to determine whether the data packet is abnormal, including removing the header and tail, converting the signal ratio and correction factor to the signal reference value, splitting and comparing integer values, abnormal data can be quickly identified.
It simplifies the data analysis process, improves the efficiency of data analysis, and reduces the processing pressure on the server.
Smart Images

Figure CN115408574B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to data analysis technology, and particularly to a data analysis method, device and computer readable storage medium. BACKGROUND
[0002] In industrial production, data acquisition is everywhere, with the advent of the data information age, the value of data is obvious. Data acquisition has some difference in precision, the more precise the data is collected, the higher the value of the data is. To obtain high-precision data, it is necessary to collect data at high frequency. Generally, the collection frequency of the sensor is at least in the kilohertz level. At such a collection frequency, the sensor can generate a large amount of data in a short time, several megabytes or even tens of megabytes per second.
[0003] In the high-speed data acquisition scene, the cumbersome data analysis process brings great pressure to the server. The simplification and optimization of the data analysis process can greatly reduce the pressure of the server and improve the stability of the service program. SUMMARY
[0004] In view of the above, it is necessary to provide a data analysis method, device and computer readable storage medium, which can make the data analysis process more simple and improve the efficiency of data analysis.
[0005] The embodiment of the present application provides a data analysis method, comprising: reading a data packet from a queue, and performing data processing on the data packet, then cyclically reading first high, middle and low bytes of the processed data packet; reading a preset signal reference value, converting the signal reference value into a collection value according to a preset signal variable ratio and a correction factor; converting the collection value into an integer value; splitting the integer value into second high, middle and low bytes; comparing the first high, middle and low bytes of the processed data packet with the second high, middle and low bytes of the integer value through a preset mode, and judging whether the data packet is abnormal data according to the comparison result.
[0006] Optionally, the reading of the data packet from the queue and the data processing on the data packet comprise: removing the head and tail of the data packet.
[0007] Optionally, the comparison of the first high, middle and low bytes of the processed data packet with the second high, middle and low bytes of the integer value through the preset mode, and the judgment of whether the data packet is abnormal data according to the comparison result comprise: comparing the value of the high byte of the first high, middle and low bytes with the value of the high byte of the second high, middle and low bytes; when the value of the high byte of the first high, middle and low bytes is different from the value of the high byte of the second high, middle and low bytes, it is judged that the data packet is abnormal data.
[0008] Optionally, the comparing the first high-middle-low bytes of the processed data packet with the second high-middle-low bytes of the integer value according to the preset manner, and judging whether the data packet is abnormal data according to a comparison result comprises: when the high byte of the first high-middle-low bytes is the same as the high byte of the second high-middle-low bytes, splicing the high byte and the middle byte of the first high-middle-low bytes to obtain a spliced high-middle byte value of the first high-middle-low bytes, and splicing the high byte and the middle byte of the second high-middle-low bytes to obtain a spliced high-middle byte value of the second high-middle-low bytes; comparing the spliced high-middle byte value of the first high-middle-low bytes with the spliced high-middle byte value of the second high-middle-low bytes; and when the spliced high-middle byte value of the first high-middle-low bytes is different from the spliced high-middle byte value of the second high-middle-low bytes, judging that the data packet is abnormal data.
[0009] Optionally, the comparing the first high-middle-low bytes of the processed data packet with the second high-middle-low bytes of the integer value according to the preset manner, and judging whether the data packet is abnormal data according to a comparison result comprises: when the high byte of the first high-middle-low bytes is the same as the high byte of the second high-middle-low bytes, splicing the high byte and the middle byte of the first high-middle-low bytes to obtain a spliced high-middle byte value of the first high-middle-low bytes, and splicing the high byte and the middle byte of the second high-middle-low bytes to obtain a spliced high-middle byte value of the second high-middle-low bytes; comparing the spliced high-middle byte value of the first high-middle-low bytes with the spliced high-middle byte value of the second high-middle-low bytes; and when the spliced high-middle byte value of the first high-middle-low bytes is different from the spliced high-middle byte value of the second high-middle-low bytes, judging that the data packet is abnormal data.
[0010] The embodiment of the present application also provides an apparatus, which comprises a memory, a processor and a data analysis program stored in the memory and executable on the processor, and when the data analysis program is executed by the processor, the following steps are implemented: reading a data packet from a queue, and after data processing of the data packet, cyclically reading first, second and third high bytes of the processed data packet; reading a preset signal reference value, converting the signal reference value into an acquisition value according to a preset signal variable ratio and a correction factor; converting the acquisition value into an integer value; splitting the integer value into second, third and fourth high bytes; and comparing the first, second and third high bytes of the processed data packet with the second, third and fourth high bytes of the integer value through a preset mode, and judging whether the data packet is abnormal data according to a comparison result.
[0011] Optionally, the reading of the data packet from the queue and the data processing of the data packet comprise: removing a head and a tail of the data packet.
[0012] Optionally, the comparison of the first, second and third high bytes of the processed data packet with the second, third and fourth high bytes of the integer value through the preset mode and the judgment of whether the data packet is abnormal data according to a comparison result comprise: comparing a value of a high byte of the first, second and third high bytes with a value of a high byte of the second, third and fourth high bytes; and when the value of the high byte of the first, second and third high bytes is different from the value of the high byte of the second, third and fourth high bytes, judging that the data packet is abnormal data.
[0013] Optionally, the comparison of the first, second and third high bytes of the processed data packet with the second, third and fourth high bytes of the integer value through the preset mode and the judgment of whether the data packet is abnormal data according to a comparison result comprise: when the value of the high byte of the first, second and third high bytes is the same as the value of the high byte of the second, third and fourth high bytes, splicing the high byte with a middle byte of the first, second and third high bytes to obtain a spliced high-middle value of the first, second and third high bytes, and splicing the high byte with the middle byte of the second, third and fourth high bytes to obtain a spliced high-middle value of the second, third and fourth high bytes; comparing the spliced high-middle value of the first, second and third high bytes with the spliced high-middle value of the second, third and fourth high bytes; and when the spliced high-middle value of the first, second and third high bytes is different from the spliced high-middle value of the second, third and fourth high bytes, judging that the data packet is abnormal data.
[0014] The embodiment of the present application also provides a computer readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the steps of the data analysis method are implemented.
[0015] Compared with the prior art, the data analysis method, device and computer readable storage medium can separate and compare data packets according to high, medium and low positions, make the data analysis process simpler, and improve the efficiency of data analysis. BRIEF DESCRIPTION OF DRAWINGS
[0016] Figure 1 is a module diagram of the device of the preferred embodiment of the present application.
[0017] Figure 2 is a program module diagram of the preferred embodiment of the data analysis system of the device of the present application.
[0018] Figure 3 is a flowchart of the data analysis method of the preferred embodiment of the present application.
[0019] MAIN ELEMENT SYMBOL EXPLANATION
[0020] Apparatus 1 Data analysis system 10 Memory 20 Processor 30 Pre-processing module 101 Transformation module 102 Data splitting module 103 Comparison module 104 Steps S300-S306 DETAILED DESCRIPTION
[0021] Referring to Figure 1 , it is a module diagram of the preferred embodiment of the device of the present application. The device 1 includes a running data analysis system 10. The device 1 also includes a memory 20 and a processor 30, etc.
[0022] The memory 20 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. The processor 30 can be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips, etc.
[0023] Referring to Figure 2 , it is a program module diagram of the preferred embodiment of the data analysis system 10 of the present application.
[0024] The data analysis system 10 includes a preprocessing module 101, a conversion module 102, a data splitting module 103 and a comparison module 104. The modules are configured to be executed by one or more processors (one processor 30 in this embodiment) to complete the present application. The module referred to in the present application is a computer program segment that completes a specific instruction. The memory 20 is used to store program codes and other data of the data analysis system 10. The processor 30 is used to execute the program codes stored in the memory 20.
[0025] The preprocessing module 101 is configured to read the data packet from the queue, and perform data processing on the data packet, and then cyclically read the first high byte, the middle byte and the low byte of the processed data packet.
[0026] In this embodiment, because the head and the tail of the data packet carry some transmission parameters, in order to make the data more accurate, the preprocessing module 101 removes the head and the tail of the data packet after reading the data packet from the queue.
[0027] The conversion module 102 is configured to read a preset signal reference value, and convert the signal reference value into a collection value according to a preset signal conversion ratio and a correction factor.
[0028] For example, in some embodiments, the received signal reference value is a current value, but the temperature value needs to be collected, and the signal conversion ratio and the correction through the sensor can convert the current value into the temperature value. In this embodiment, the signal conversion ratio and the correction factor are preset by the developer.
[0029] The data splitting module 103 is configured to convert the collection value into an integer value, and split the integer value into a second high byte, a middle byte and a low byte.
[0030] Preferably, the data splitting module 103 converts the collection value into a 24-bit integer value, and splits the 24-bit integer value into a second high byte, a middle byte and a low byte.
[0031] The comparison module 104 is configured to compare the first high byte, the middle byte and the low byte of the processed data packet with the second high byte, the middle byte and the low byte of the integer value by a preset manner, and determine whether the data packet is abnormal data according to a comparison result.
[0032] Specifically, the comparison module 104 is further configured to:
[0033] compare the value of the high byte of the first high byte, the middle byte and the low byte with the value of the high byte of the second high byte, the middle byte and the low byte, and determine that the data packet is abnormal data when the value of the high byte of the first high byte, the middle byte and the low byte is different from the value of the high byte of the second high byte, the middle byte and the low byte.
[0034] Further, the comparison module 104 is further configured to:
[0035] When the value of the high byte of the first high-middle-low byte is the same as the value of the high byte of the second high-middle-low byte, the high byte and the middle byte of the first high-middle-low byte are spliced to obtain a spliced high-middle value of the first high-middle-low byte, and the high byte and the middle byte of the second high-middle-low byte are spliced to obtain a spliced high-middle value of the second high-middle-low byte; the spliced high-middle value of the first high-middle-low byte is compared with the spliced high-middle value of the second high-middle-low byte; when the spliced high-middle value of the first high-middle-low byte is different from the spliced high-middle value of the second high-middle-low byte, it is judged that the data packet is abnormal data.
[0036] Further, the comparison module 104 is further used for:
[0037] When the spliced high-middle value of the first high-middle-low byte is the same as the spliced high-middle value of the second high-middle-low byte, the high byte, the middle byte and the low byte of the first high-middle-low byte are spliced to obtain a spliced high-middle-low value of the first high-middle-low byte, and the high byte, the middle byte and the low byte of the second high-middle-low byte are spliced to obtain a spliced high-middle-low value of the second high-middle-low byte; the spliced high-middle-low value of the first high-middle-low byte is compared with the spliced high-middle-low value of the second high-middle-low byte; when the spliced high-middle-low value of the first high-middle-low byte is different from the spliced high-middle-low value of the second high-middle-low byte, it is judged that the data packet is abnormal data.
[0038] Further, the comparison module 104 is further used for:
[0039] When the spliced high-middle-low value of the first high-middle-low byte is the same as the spliced high-middle-low value of the second high-middle-low byte, it is judged that the data packet is normal data.
[0040] In this way, if the value of the data packet is abnormal in the high bit or the middle bit, it can be quickly identified, without the need of comparing the low bit value, so that the data analysis efficiency is improved.
[0041] In the embodiment, the data packet can be compared according to the high bit, the middle bit and the low bit, so that the data analysis process is simpler, and the data analysis efficiency is improved.
[0042] Referring to Figure 3 FIG. 1 is a flowchart of a data analysis method according to an embodiment of the present application. The data analysis method is applied to the device 1, and can be realized by the processor 30 executing the modules 101-104 shown in FIG. 1. Figure 2
[0043] Step S300, reading the data packet from the queue, and after data processing, the first high, middle and low bytes of the processed data packet are read.
[0044] In this embodiment, because the head and tail of the data packet carry some transmission parameters, in order to make the data more accurate, the device 1 removes the head and tail of the data packet after reading the data packet from the queue.
[0045] Step S302, reading a preset signal reference value, and converting the signal reference value into a collection value according to a preset signal variable ratio and a correction factor.
[0046] For example, in some embodiments, the received signal reference value is a current value, but the value to be collected is a temperature value, and the signal variable ratio and correction through the sensor can convert the current value into the temperature value. In this embodiment, the signal variable ratio and the correction factor are preset by the developer.
[0047] Step S304, converting the collection value into an integer value, and splitting the integer value into second high, middle and low bytes.
[0048] Preferably, the collection value is converted into a 24-bit integer value, and the 24-bit integer value is split into second high, middle and low bytes.
[0049] Step S306, comparing the first high, middle and low bytes of the processed data packet with the second high, middle and low bytes of the integer value by a preset manner, and judging whether the data packet is abnormal data according to the comparison result.
[0050] Specifically, the step S306 includes:
[0051] Comparing the value of the high byte of the first high, middle and low bytes with the value of the high byte of the second high, middle and low bytes, and when the value of the high byte of the first high, middle and low bytes is different from the value of the high byte of the second high, middle and low bytes, it is judged that the data packet is abnormal data.
[0052] Further, when the value of the high byte of the first high, middle and low bytes is the same as the value of the high byte of the second high, middle and low bytes, the high byte and the middle byte of the first high, middle and low bytes are spliced to obtain the spliced high and middle byte value of the first high, middle and low bytes, and the high byte and the middle byte of the second high, middle and low bytes are spliced to obtain the spliced high and middle byte value of the second high, middle and low bytes; the spliced high and middle byte value of the first high, middle and low bytes is compared with the spliced high and middle byte value of the second high, middle and low bytes; when the spliced high and middle byte value of the first high, middle and low bytes is different from the spliced high and middle byte value of the second high, middle and low bytes, it is judged that the data packet is abnormal data.
[0053] Further, when the high-middle-low byte spliced high-middle value of the first high-middle-low byte is the same as the high-middle-low byte spliced high-middle value of the second high-middle-low byte, the high byte, middle byte and low byte of the first high-middle-low byte are spliced to obtain the high-middle-low byte spliced high-middle value of the first high-middle-low byte, and the high byte, middle byte and low byte of the second high-middle-low byte are spliced to obtain the high-middle-low byte spliced high-middle value of the second high-middle-low byte; the high-middle-low byte spliced high-middle value of the first high-middle-low byte is compared with the high-middle-low byte spliced high-middle value of the second high-middle-low byte; when the high-middle-low byte spliced high-middle value of the first high-middle-low byte is different from the high-middle-low byte spliced high-middle value of the second high-middle-low byte, it is judged that the data packet is abnormal data.
[0054] Conversely, when the high-middle-low byte spliced high-middle value of the first high-middle-low byte is the same as the high-middle-low byte spliced high-middle value of the second high-middle-low byte, it is judged that the data packet is normal data.
[0055] In this way, if the value of the data packet is abnormal in the high bit or the middle bit, it can be quickly identified, without the need to compare the low bit value, and the efficiency of data analysis can be improved.
[0056] By applying the above method to the above device, the data packets can be compared according to the high, middle and low bits, the data analysis process is simpler, and the efficiency of data analysis is improved.
[0057] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present application rather than limiting the present application. Although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application can be modified or replaced equivalently without departing from the spirit and scope of the technical solutions of the present application.
Claims
1. A data analysis method, characterized by, The method comprises: reading a data packet from a queue and performing data processing on the data packet, and then cyclically reading first high, middle and low bytes of the processed data packet; reading a preset signal reference value, converting the signal reference value into a collection value according to a preset signal variable ratio and a correction factor; converting the collection value into an integer value, and splitting the integer value into second high, middle and low bytes; comparing the first high, middle and low bytes of the processed data packet with the second high, middle and low bytes of the integer value by a preset mode, and judging whether the data packet is abnormal data according to a comparison result; wherein the comparison of the first high, middle and low bytes of the processed data packet with the second high, middle and low bytes of the integer value by the preset mode and the judgment of whether the data packet is abnormal data according to the comparison result comprise: comparing a value of a high byte of the first high, middle and low bytes with a value of a high byte of the second high, middle and low bytes; when the value of the high byte of the first high, middle and low bytes is different from the value of the high byte of the second high, middle and low bytes, judging that the data packet is abnormal data; when the value of the high byte of the first high, middle and low bytes is the same as the value of the high byte of the second high, middle and low bytes, splicing the high byte and the middle byte of the first high, middle and low bytes to obtain a spliced high and middle byte value of the first high, middle and low bytes, and splicing the high byte and the middle byte of the second high, middle and low bytes to obtain a spliced high and middle byte value of the second high, middle and low bytes; comparing the spliced high and middle byte value of the first high, middle and low bytes with the spliced high and middle byte value of the second high, middle and low bytes; when the spliced high and middle byte value of the first high, middle and low bytes is different from the spliced high and middle byte value of the second high, middle and low bytes, judging that the data packet is abnormal data; when the spliced high and middle byte value of the first high, middle and low bytes is the same as the spliced high and middle byte value of the second high, middle and low bytes, splicing the high byte, the middle byte and the low byte of the first high, middle and low bytes to obtain a spliced high, middle and low byte value of the first high, middle and low bytes, and splicing the high byte, the middle byte and the low byte of the second high, middle and low bytes to obtain a spliced high, middle and low byte value of the second high, middle and low bytes; comparing the spliced high, middle and low byte value of the first high, middle and low bytes with the spliced high, middle and low byte value of the second high, middle and low bytes; when the spliced high, middle and low byte value of the first high, middle and low bytes is different from the spliced high, middle and low byte value of the second high, middle and low bytes, judging that the data packet is abnormal data; and when the spliced high, middle and low byte value of the first high, middle and low bytes is the same as the spliced high, middle and low byte value of the second high, middle and low bytes, judging that the data packet is normal data.
2. The data analysis method of claim 1, wherein, The reading of the data packet from the queue and the data processing on the data packet comprise: removing a head and a tail of the data packet.
3. A data analysis device, characterized by, The data analysis device comprises a memory, a processor, and a data analysis program stored on the memory and executable on the processor, and the data analysis program, when executed by the processor, implements the following steps: reading a data packet from a queue and performing data processing on the data packet, and then cyclically reading first high, middle and low bytes of the processed data packet; reading a preset signal reference value, and converting the signal reference value into a collection value according to a preset signal variable ratio and a correction factor; converting the collection value into an integer value, and splitting the integer value into second high, middle and low bytes; comparing the first high, middle and low bytes of the processed data packet with the second high, middle and low bytes of the integer value by a preset manner, and judging whether the data packet is abnormal data according to a comparison result; wherein the comparison of the first high, middle and low bytes of the processed data packet with the second high, middle and low bytes of the integer value by the preset manner and the judgment of whether the data packet is abnormal data according to the comparison result comprise: comparing a value of a high byte of the first high, middle and low bytes with a value of a high byte of the second high, middle and low bytes; when the value of the high byte of the first high, middle and low bytes is different from the value of the high byte of the second high, middle and low bytes, judging that the data packet is abnormal data; when the value of the high byte of the first high, middle and low bytes is the same as the value of the high byte of the second high, middle and low bytes, splicing the high byte with the middle byte of the first high, middle and low bytes to obtain a spliced high and middle byte value of the first high, middle and low bytes, and splicing the high byte with the middle byte of the second high, middle and low bytes to obtain a spliced high and middle byte value of the second high, middle and low bytes; comparing the spliced high and middle byte value of the first high, middle and low bytes with the spliced high and middle byte value of the second high, middle and low bytes; when the spliced high and middle byte value of the first high, middle and low bytes is different from the spliced high and middle byte value of the second high, middle and low bytes, judging that the data packet is abnormal data; when the spliced high and middle byte value of the first high, middle and low bytes is the same as the spliced high and middle byte value of the second high, middle and low bytes, splicing the high byte, the middle byte and a low byte of the first high, middle and low bytes to obtain a spliced high, middle and low byte value of the first high, middle and low bytes, and splicing the high byte, the middle byte and a low byte of the second high, middle and low bytes to obtain a spliced high, middle and low byte value of the second high, middle and low bytes; comparing the spliced high, middle and low byte value of the first high, middle and low bytes with the spliced high, middle and low byte value of the second high, middle and low bytes; when the spliced high, middle and low byte value of the first high, middle and low bytes is different from the spliced high, middle and low byte value of the second high, middle and low bytes, judging that the data packet is abnormal data; and when the spliced high, middle and low byte value of the first high, middle and low bytes is the same as the spliced high, middle and low byte value of the second high, middle and low bytes, judging that the data packet is normal data.
4. The data analysis apparatus of claim 3, wherein The reading of the data packet from the queue and the data processing on the data packet comprise: remove the head and tail of the data packet.
5. A computer readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the steps of the data analysis method in any one of claims 1 to 2.
Citation Information
Patent Citations
Method for improving traffic one-card transaction performance, computer device and computer readable storage medium
CN109766149A
Data coding method and device, equipment end and storage medium
CN112822265A