Message transmission method and device, equipment and medium

By receiving and processing collected data in wireless communication, converting it into double-byte or single-byte messages, and packaged and sent when the conditions are met, the problem of slow message transmission speed in wireless communication is solved, and transmission efficiency and stability are improved.

CN120018203APending Publication Date: 2025-05-16SINOPEC OILFIELD SERVICE CORPORATION +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311511650.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-14
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

The slower message transmission speed in wireless communications affects user experience, reduces work efficiency, and may increase hardware equipment or network bandwidth, thereby increasing costs.

Method used

By receiving the current collected data feedback from the preset interface, it is determined whether it is the first collected data or the last collected data of the current acquisition cycle. If so, it is converted into a target double-byte message; if it is the intermediate collected data, it is determined and the corresponding target single-byte message is saved to the preset message array, and packaged and sent to the host after the sending conditions are met.

Benefits of technology

By converting the double-byte message of the intermediate data collected into a single-byte message, the data length is reduced and the message transmission efficiency is improved. At the same time, the first data collected or the last data collected is still a double-byte message, ensuring that the host can recover data and ensuring the stability of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120018203A_ABST
    Figure CN120018203A_ABST
Patent Text Reader

Abstract

The invention discloses a message transmission method and device, equipment and a medium, and relates to the technical field of wireless communication, and the method comprises the steps: receiving current collection data fed back by a preset interface; if the current collection data is the data collected for the first time or the data collected for the last time in the current collection period, converting the current collection data into a target double-byte message; if the current collection data is the intermediate collection data of the current collection period, determining a target single-byte message corresponding to the current collection data; wherein the intermediate collection data is collection data except the first collection data and the last collection data in the current collection period; and storing the target double-byte message or the target single-byte message to a preset message array, packaging the double-byte message and the single-byte message stored in the preset message array when a preset sending condition is met, and sending the packaged message to a corresponding host. According to the scheme, the message transmission speed in wireless communication is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of wireless communication technology, and in particular to a message transmission method, device, equipment and medium. Background Art

[0002] Industrial Internet of Things, also known as Industrial Internet or Industry 4.0, is the integration of various types of acquisition and control sensors or controllers with perception and monitoring capabilities, as well as mobile communications, intelligent analysis and other technologies into all aspects of the industrial production process, thereby greatly improving manufacturing efficiency, improving product quality, reducing product costs and resource consumption, and ultimately achieving a new stage of upgrading traditional industries to intelligence. Using the industrial Internet of Things LORA (Long Range Radio) communication technology, the data acquisition system is upgraded and renovated, the 485 wired is replaced by the Internet of Things wireless, and the traditional transmitter is replaced by an embedded low-power battery-powered Internet of Things sensor with a microprocessor. Wireless communication transmission has been widely used, especially in oil well sites.

[0003] Wireless communication transmission is affected by signals, distance, and device performance configuration, resulting in wireless communication transmission being slower than wired communication transmission. If the wireless transmission speed is too slow, it may affect the user experience, reduce work efficiency, and may even require additional hardware equipment or network bandwidth, thereby increasing costs.

[0004] From the above, it can be seen that how to improve the speed of message transmission in wireless communication is a problem to be solved in this field. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide a message transmission method, device, equipment and medium to improve the speed of message transmission in wireless communication. The specific scheme is as follows:

[0006] In a first aspect, the present application discloses a message transmission method, comprising:

[0007] Receive the current collected data fed back by the preset interface;

[0008] If the current collected data is the first collected data or the last collected data in the current collection cycle, converting the current collected data into a target double-byte message;

[0009] If the current collected data is the middle collected data of the current collection cycle, then determine the target single-byte message corresponding to the current collected data; wherein the middle collected data is the collected data other than the first collected data and the last collected data in the current collection cycle;

[0010] The target double-byte message or the target single-byte message is saved in a preset message array, and when a preset sending condition is met, the double-byte message and the single-byte message stored in the preset message array are packaged, and the packaged message is sent to the corresponding host.

[0011] Optionally, determining a target single-byte message corresponding to the current collected data includes:

[0012] Determine whether the value of the current collected data is 0;

[0013] If the value of the current collected data is not 0, determining a first difference between the current collected data and the last collected data, and converting the first difference into a target single-byte message;

[0014] If the value of the currently collected data is 0, a preset single-byte message is determined as a target single-byte message; wherein the preset single-byte message is different from the target single-byte message obtained based on the first difference.

[0015] Optionally, the receiving of the current collected data fed back by the preset interface includes:

[0016] Receive current collected data fed back by a preset interface, and save the current collected data to a collection array;

[0017] Accordingly, determining a first difference between the current collected data and the previous collected data includes:

[0018] The last collected data is obtained from the collection array, and a first difference between the current collected data and the last collected data is determined.

[0019] Optionally, converting the first difference into a target single-byte message includes:

[0020] If the first difference is a negative number, converting the absolute value of the first difference into an eight-bit binary first message, setting the highest bit of the first message to 1 to obtain a second message, and then converting the second message into a two-bit hexadecimal target single-byte message;

[0021] If the first difference is a positive number, the first difference is converted into a two-digit hexadecimal target single-byte message.

[0022] Optionally, after receiving the current collected data fed back by the preset interface, the method further includes:

[0023] If the last collected data is 0 and the current collected data is not 0, the current collected data is determined as the last collected data of the current collection cycle.

[0024] Optionally, after receiving the current collected data fed back by the preset interface, the method further includes:

[0025] Determine the time difference between the current collection time of the current collection data and the first collection time of the current collection cycle;

[0026] If the time difference is not less than the preset time length, the current collected data is determined as the last collected data of the current collection cycle.

[0027] Optionally, after receiving the current collected data fed back by the preset interface, the method further includes:

[0028] Determine a second difference between the current collected data and a preset reference value, and determine whether an absolute value of the second difference is less than a preset threshold;

[0029] If the absolute value of the second difference is not less than the preset threshold, the current collected data is determined to be the last collected data of the current collection cycle.

[0030] Optionally, before determining the second difference between the current collected data and the preset reference value, the method further includes:

[0031] Determine whether the current collection cycle of the currently collected data is the first collection cycle;

[0032] If the current collection cycle is the first collection cycle, determining the first collection data of the current collection cycle as the preset reference value;

[0033] If the current collection cycle is not the first collection cycle, the last collection data of the previous collection cycle is determined as the preset reference value.

[0034] Optionally, after determining the current collected data as the last collected data of the current collection cycle, the method further includes:

[0035] Generate an emergency warning event, and report the emergency warning event to a corresponding preset warning processing tool so that the preset warning processing tool can process the emergency warning event accordingly.

[0036] In a second aspect, the present application discloses a message transmission device, comprising:

[0037] A data receiving module is used to receive the current collected data fed back by the preset interface;

[0038] A first execution module, configured to convert the current collected data into a target double-byte message if the current collected data is the first collected data or the last collected data in the current collection cycle;

[0039] The second execution module is used to determine the target single-byte message corresponding to the current collection data if the current collection data is the middle collection data of the current collection cycle; wherein the middle collection data is the collection data other than the first collection data and the last collection data in the current collection cycle;

[0040] The message transmission module is used to save the target double-byte message or the target single-byte message to a preset message array, and when a preset sending condition is met, the double-byte message and the single-byte message stored in the preset message array are packaged, and the packaged message is sent to the corresponding host.

[0041] In a third aspect, the present application discloses an electronic device, comprising:

[0042] Memory, used to store computer programs;

[0043] The processor is used to execute the computer program to implement the steps of the aforementioned disclosed message transmission method.

[0044] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned disclosed message transmission method are implemented.

[0045] The beneficial effects of the present application are as follows: the present application receives the current collection data fed back by the preset interface; if the current collection data is the first collection data or the last collection data of the current collection cycle, the current collection data is converted into a target double-byte message; if the current collection data is the middle collection data of the current collection cycle, a target single-byte message corresponding to the current collection data is determined; wherein the middle collection data is the collection data other than the first collection data and the last collection data in the current collection cycle; the target double-byte message or the target single-byte message is saved to a preset message array, and the double-byte message or the single-byte message in the preset message array is sent to the corresponding host. It can be seen that, on the one hand, the present application converts the double-byte message of the intermediate collected data into a single-byte message, which can greatly reduce the length of the data to be transmitted, thereby improving the message transmission efficiency. On the other hand, the first collected data or the last collected data is still a double-byte message. In this way, when the host receives the message data, it can determine the first collected data, the last collected data and the intermediate collected data in the current collection cycle, thereby facilitating the host to recover the received data and ensuring the stability of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the embodiments of the present application 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.

[0047] Figure 1 A flow chart of a message transmission method disclosed in this application;

[0048] Figure 2 A flowchart of a specific message transmission method disclosed in this application;

[0049] Figure 3 A schematic diagram of a specific message transmission structure disclosed in this application;

[0050] Figure 4 This is a schematic diagram of the structure of a message transmission device disclosed in this application;

[0051] Figure 5 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0052] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. 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 making creative work are within the scope of protection of the present invention.

[0053] Industrial Internet of Things, also known as Industrial Internet or Industry 4.0, is the integration of various acquisition and control sensors or controllers with perception and monitoring capabilities, as well as mobile communications, intelligent analysis and other technologies into all aspects of the industrial production process, thereby greatly improving manufacturing efficiency, improving product quality, reducing product costs and resource consumption, and ultimately achieving a new stage of upgrading traditional industries to intelligence. Using the industrial Internet of Things LORA communication technology, the data acquisition system is upgraded and renovated, the 485 wired is replaced by the Internet of Things wireless, and the traditional transmitter is replaced by an embedded low-power battery-powered Internet of Things sensor with a microprocessor. Wireless communication transmission has been widely used, especially in oil well sites.

[0054] Wireless communication transmission is affected by signals, distance, and device performance configuration, resulting in wireless communication transmission being slower than wired communication transmission. If the wireless transmission speed is too slow, it may affect the user experience, reduce work efficiency, and may even require additional hardware equipment or network bandwidth, thereby increasing costs.

[0055] To this end, the present application provides a message transmission solution to improve the speed of message transmission in wireless communications.

[0056] See also Figure 1 As shown, the embodiment of the present application discloses a message transmission method, including:

[0057] Step S11: receiving the current collected data fed back by the preset interface.

[0058] Receive the current collection data fed back by the preset interface, for example, the preset interface can be a pre-set sensor, that is to say, the data of the sensor acquisition device is used as the current collection data, the sensor in the present embodiment is embedded with a single-chip microcomputer (microprocessor), it should be noted that the embedded low-power battery-powered Internet of Things sensor with a microprocessor replaces the traditional transmitter, the traditional transmitter is unable to achieve true wireless transmission on the one hand, on the other hand, the microprocessor and the sensor are combined into one, so it is convenient to carry and takes up less space. In practical applications, the sensor can be a pressure sensor, a temperature sensor, a photosensitive sensor, etc., the single-chip microcomputer can be an STM32 microprocessor, and the STM32 microprocessor starts its internal digital-to-analog conversion chip (analog to digital converter, i.e. ADC) to collect sensor data, sensor data is also AD value, and the digital-to-analog conversion chip is mainly used to convert analog signals into digital signals.

[0059] In this embodiment, there are three ways to determine whether the current collected data is the last collected data in the current collection cycle, as follows:

[0060] In a first specific embodiment, after receiving the current collection data fed back by the preset interface, it also includes: determining the time difference between the current collection time of the current collection data and the first collection time of the current collection cycle; if the time difference is not less than the preset duration, the current collection data is determined as the last collection data of the current collection cycle.

[0061] A preset duration L is set, and the preset duration represents the collection cycle, that is, there are multiple collection cycles, and the sensor collects data once at regular intervals in the current collection cycle to obtain the current collection data. For example, if the collection cycle is 10 minutes, data is collected every 1 minute. If the time difference between the current collection time of the current collection data and the first collection time of the current collection cycle is not less than the preset duration, the current collection data is determined to be the last collection data of the current collection cycle. It is understandable that if the current collection data is determined to be the last collection data, the next collection data is the first collection data of the next collection cycle. It should be noted that the preset duration corresponding to each collection cycle can be set according to the specific collection scenario, for example, all collection cycles are set to the same preset duration, and different preset durations are set for different collection cycles.

[0062] In a second specific embodiment, after receiving the current collection data fed back by the preset interface, it also includes: determining a second difference between the current collection data and a preset reference value, and judging whether the absolute value of the second difference is less than a preset threshold; if the absolute value of the second difference is not less than the preset threshold, the current collection data is judged as the last collection data of the current collection cycle.

[0063] Calculate the second difference between the current collected data and the preset reference value, and compare the absolute value of the second difference with the preset threshold. If the absolute value of the second difference is not less than the preset threshold, the data difference is too large, which may be due to an abnormality in the equipment. The data needs to be immediately transmitted to the corresponding early warning device. Therefore, even if the time difference between the current collection time of the current collected data and the first collection time of the current collection cycle is less than the preset duration, the current collected data is still judged as the last collected data.

[0064] In this embodiment, before determining the second difference between the current collected data and the preset reference value, it also includes: judging whether the current collection cycle of the current collected data is the first collection cycle; if the current collection cycle is the first collection cycle, determining the first collection data of the current collection cycle as the preset reference value; if the current collection cycle is not the first collection cycle, determining the last collection data of the previous collection cycle as the preset reference value. The specific process of determining the preset reference value is:

[0065] 1) Determine the current collection cycle;

[0066] 2) If the current collection cycle is the first collection cycle, the first collection data of the current collection cycle is determined as the preset reference value;

[0067] 3) If the current collection cycle is not the first collection cycle, the last collection data of the previous collection cycle is determined as the preset reference value;

[0068] This embodiment does not use a fixed preset reference value, but tries to use data that is closer to the currently collected data as the preset reference value. In this way, there are more suitable preset reference values ​​in different scenarios.

[0069] In this embodiment, after determining the current collected data as the last collected data of the current collection cycle, it also includes: generating an emergency warning event, and reporting the emergency warning event to a corresponding preset warning processing tool, so that the preset warning processing tool can perform corresponding processing on the emergency warning event.

[0070] If the absolute value of the second difference is not less than the preset threshold, the current collected data is determined to be the last collected data of the current collection cycle, an emergency warning event is generated, and the emergency warning event is reported to the corresponding preset warning processing tool, so that the preset warning processing tool can perform corresponding processing on the emergency warning event, wherein the preset warning processing tool can also be a host, that is, the host can also process emergency warning events.

[0071] In a third specific embodiment, after receiving the current collection data fed back by the preset interface, it also includes: if the previous collection data is 0 and the current collection data is not 0, then determining the current collection data as the last collection data of the current collection cycle.

[0072] If the last collected data is 0 and the current collected data is not 0, the current collected data is determined as the last collected data of the current collection cycle. That is to say, if there is a collection data of 0 in the current collection cycle, the first non-0 collection data after the collection data of 0 is determined as the last collection data of the current collection cycle, as shown in Table 1:

[0073] Table 1

[0074]

[0075] In Table 1, 0019 is the first non-zero data after the zero data, so 0019 is the last collected data of the current collection cycle.

[0076] Step S12: If the current collected data is the first collected data or the last collected data in the current collection cycle, the current collected data is converted into a target double-byte message.

[0077] If it is determined that the current collected data is the first collected data or the last collected data in the current collection cycle, the current collected data is directly converted into a four-digit hexadecimal target double-byte message. For example, the current collected data is the first collected data, and the value is 500. The corresponding four-digit hexadecimal double-byte message is 01F4. In other words, 01F4 is directly used as the target double-byte message.

[0078] Step S13: If the current collected data is the middle collected data of the current collection cycle, determine the target single-byte message corresponding to the current collected data; wherein the middle collected data is the collected data other than the first collected data and the last collected data in the current collection cycle.

[0079] In this embodiment, determining the target single-byte message corresponding to the current collected data includes: judging whether the value of the current collected data is 0; if the value of the current collected data is not 0, determining a first difference between the current collected data and the previous collected data, and converting the first difference into a target single-byte message; if the value of the current collected data is 0, determining a preset single-byte message as the target single-byte message; wherein the preset single-byte message is different from the target single-byte message obtained based on the first difference.

[0080] If the current collected data is the intermediate collected data, it is necessary to determine whether the current collected data is 0. If so, the preset single-byte message can be directly transmitted without conversion, thereby improving the overall efficiency of message transmission. If it is not 0, the first difference between the current collected data and the previous collected data is calculated, and the first difference is converted into a target single-byte message. It should be noted that the preset single-byte message is different from the target single-byte message obtained based on the first difference. Since the converted message is a single byte as long as it is the intermediate collected data, the preset single-byte message is also a single byte. It can be understood that the first difference will not be very large, so as long as the preset single-byte message is set to a message greater than the preset threshold, such as the preset single-byte message is FF, the preset single-byte message can be distinguished from the target single-byte message obtained based on the first difference. In other words, it can be distinguished whether the first difference is 0 or the current collected data is 0, thereby reducing the time required for conversion and ensuring the stability of data transmission.

[0081] Step S14: Save the target double-byte message or the target single-byte message to a preset message array, and when a preset sending condition is met, package the double-byte message and the single-byte message stored in the preset message array, and send the packaged message to the corresponding host.

[0082] It can be understood that if the message corresponding to the current collected data is a target double-byte message, the target double-byte message is saved in the preset message array; if the message corresponding to the current collected data is a target single-byte message, the target single-byte message is saved in the preset message array; after the last collected data of the current collection cycle is saved in the preset message array, the preset sending condition is met, and then all the messages currently stored in the preset message array are packaged to obtain a packaged message, and then the packaged message is transmitted to the corresponding host. Because the packaged message is a single-byte message except for the first collected data and the last collected data, the message length is effectively reduced, so that the amount of data required to be transmitted is greatly reduced, thereby improving the message transmission efficiency.

[0083] The beneficial effects of the present application are as follows: the present application receives the current collection data fed back by the preset interface; if the current collection data is the first collection data or the last collection data of the current collection cycle, the current collection data is converted into a target double-byte message; if the current collection data is the middle collection data of the current collection cycle, a target single-byte message corresponding to the current collection data is determined; wherein the middle collection data is the collection data other than the first collection data and the last collection data in the current collection cycle; the target double-byte message or the target single-byte message is saved to a preset message array, and the double-byte message or the single-byte message in the preset message array is sent to the corresponding host. It can be seen that, on the one hand, the present application converts the double-byte message of the intermediate collected data into a single-byte message, which can greatly reduce the length of the data to be transmitted, thereby improving the message transmission efficiency. On the other hand, the first collected data or the last collected data is still a double-byte message. In this way, when the host receives the message data, it can determine the first collected data, the last collected data and the intermediate collected data in the current collection cycle, thereby facilitating the host to recover the received data and ensuring the stability of data transmission.

[0084] See also Figure 2 As shown, the embodiment of the present application discloses a specific message transmission method, including:

[0085] Step S21: receiving the current collected data fed back by the preset interface.

[0086] In this embodiment, the receiving of the current collected data fed back by the preset interface includes: receiving the current collected data fed back by the preset interface, and saving the current collected data to the collection array. It can be understood that the collection array is preset, and whenever the current collected data is received, the current collected data is converted into a four-digit hexadecimal message, and then the four-digit hexadecimal message is saved in the collection array.

[0087] Step S22: If the current collected data is the first collected data or the last collected data in the current collection cycle, the current collected data is converted into a target double-byte message.

[0088] If the current collected data is the first or last collected data of the current collection cycle, the four-digit hexadecimal message in the collection array is directly used as the target double-byte message. For example, if the record in the collection array is 0207, 0207 is directly used as the target double-byte message.

[0089] Step S23: If the current collected data is the middle collected data of the current collection cycle, and the value of the current collected data is not 0, then determine a first difference between the current collected data and the previous collected data.

[0090] In this embodiment, the determination of the first difference between the current collected data and the last collected data includes: obtaining the last collected data from the collection array, and determining the first difference between the current collected data and the last collected data. The collection array records each collected data of the current collection cycle, so that the last collected data of the current collected data can be determined, and then the first difference between the current collected data and the last collected data can be calculated. It should be noted that only when the current collected data is not 0, it is necessary to subtract the last collected data from the current collected data to obtain the first difference.

[0091] Step S24: If the first difference is a negative number, convert the absolute value of the first difference into an eight-bit binary first message, and set the highest bit of the first message to 1 to obtain a second message, and then convert the second message into a two-bit hexadecimal target single-byte message; if the first difference is a positive number, convert the first difference into a two-bit hexadecimal target single-byte message; wherein the intermediate acquisition data is the acquisition data in the current acquisition cycle except the first acquisition data and the last acquisition data.

[0092] If the first difference is a negative number, the first difference is taken as a positive number, that is, the absolute value of the first difference is obtained, and then the absolute value of the first difference is converted into an eight-bit binary first message, such as the first message is 00010011, and the highest bit of the first message is set to 1 to obtain the second message, that is, 10010011, and then the second message is converted into a two-digit hexadecimal target single-byte message, that is, 93. If the first difference is a positive number, the first difference is converted into a two-digit hexadecimal target single-byte message, for example, the four-digit hexadecimal number corresponding to the current collected data is 01F4, and the four-digit hexadecimal number corresponding to the previous collected data is 01E5, and the first difference is converted into a two-digit hexadecimal target single-byte message, that is, 0F. The details can be shown in Table 2:

[0093] Table 2

[0094]

[0095] For example, in the current acquisition cycle, a total of 7 acquisitions are made. The first acquisition and the last acquisition both convert the AD value into a double-byte message. The acquisition array corresponds to a four-digit hexadecimal number, that is, a double-byte. The four-digit hexadecimal number in the acquisition array is encoded to generate the corresponding message array. The encoding process is specifically as follows: calculate the sensor data currently collected minus the sensor data previously collected to obtain the first difference; if the first difference is negative, take the first difference as positive and convert it into an eight-bit binary number, set the highest bit of the eight-bit binary number to 1, and then convert the eight-bit binary number into a two-digit hexadecimal number; if the first difference is positive, directly convert the first difference into a two-digit hexadecimal number; store the two-digit hexadecimal number in the preset message array, wherein the two-digit hexadecimal number is a single-byte message, and add the single-byte message to the preset message array.

[0096] Step S25: Save the target double-byte message or the target single-byte message to a preset message array, and when a preset sending condition is met, package the double-byte message and the single-byte message stored in the preset message array, and send the packaged message to the corresponding host.

[0097] It can be seen that the present application divides the collected data obtained within a collection cycle into three parts: the first collection data, the intermediate collection data, and the last collection data. If the current collection data is the intermediate collection data, the first difference between the current collection data and the previous collection data is used for single-byte conversion. In other words, the double-byte message is converted into a single-byte message, thereby shortening the message length, thereby reducing the wireless communication air transmission time, and greatly improving the wireless communication efficiency of the industrial Internet of Things.

[0098] The following is a detailed description of this application. Figure 3 A specific message transmission structure schematic diagram is shown, the message transmission system includes several sensors, a data acquisition host and a wireless communication module, wherein the data acquisition host is connected to each sensor through a wireless communication line of the wireless communication module, the sensor has an embedded single-chip microcomputer, the single-chip microcomputer is used to convert each collected data fed back by the preset interface of the sensor into a single byte of the message, so as to realize message length compression and improve the speed of wireless transmission, the single-chip microcomputer is also used to pack the messages of the preset message array, and send the packed messages to the data acquisition host through the wireless communication module, the specific process is as follows:

[0099] Set the preset single-byte message to "FF", the preset threshold to "20", and set the preset duration corresponding to each acquisition cycle to 3 seconds. The STM32 microprocessor wakes itself up once every 1 second, then wakes up the low-power sensor probe, and starts the ADC to collect the sensor AD value. The ADC precision is 12 bits, and the maximum value is a 12-bit binary number, that is, the AD value range is 0--4095. In each acquisition cycle, the sensor collects data every 1 second, that is, receives the collection data fed back by the preset interface every 1 second; after booting up, it is necessary to determine whether the acquisition array and the preset message array are empty. If not, initialization processing is required, that is, clearing the acquisition array and the preset message array.

[0100] In a first specific embodiment, data collection in a first collection cycle is performed:

[0101] 1.1) Receive the first collected data of the first collection cycle (i.e., the data collected at the 0th second) fed back by the sensor, whose AD value is 500, convert 500 into a four-digit hexadecimal number 01F4, save 01F4 into the collection array, and use 01F4 as the preset reference value of the first collection cycle; directly use 01F4 of the collection array as the target double-byte message of the first collection data of the first collection cycle, and save it into the preset message array;

[0102] 1.2) Receive the second acquisition data of the first acquisition cycle fed back by the sensor (i.e., the data collected at the first second, i.e., the intermediate acquisition data), whose AD value is 519, convert 519 into a four-digit hexadecimal number 0207, and save 0207 into the acquisition array; calculate the first difference between the second acquisition data and the first acquisition data (the first difference is a positive number), convert the first difference into a two-digit hexadecimal number 13, that is, 13 is the target single-byte message after the current acquisition data is converted, and save the target single-byte message 13 into the preset message array;

[0103] 1.3) Receive the third acquisition data of the first acquisition cycle fed back by the sensor (i.e., the data collected at the second second, i.e., the middle acquisition data), whose AD value is 500, convert 500 into a four-digit hexadecimal number 01F4, and save 01F4 into the acquisition array; calculate the first difference between the third acquisition data and the second acquisition data (the first difference is a negative number), convert the absolute value of the first difference into an eight-bit binary first message, and set the highest bit of the first message to 1 to obtain a second message, and then convert the second message into a two-digit hexadecimal target single-byte message 93, and save the target single-byte message 93 into a preset message array;

[0104] 1.4) Receive the fourth data of the first acquisition cycle fed back by the sensor (i.e., the data collected at the 3rd second, i.e., the last data collected), whose AD value is 485, convert 485 into a four-digit hexadecimal number 01E5, and save 01E5 into the acquisition array; directly use 01E5 of the acquisition array as the target double-byte message of the last data collected in the first acquisition cycle, and save it into the preset message array; it should be noted that 485 is the preset reference value of the second acquisition cycle.

[0105] 1.5) Pack the target double-byte message and the target single-byte message of the first acquisition cycle in the preset message array, and actively trigger the timing report, that is, wirelessly transmit the packaged message of the first acquisition cycle to the data acquisition host; receive the various acquisition data of the second acquisition cycle to complete the message transmission in the first specific embodiment.

[0106] In the second specific embodiment, data collection of the current collection cycle is performed (the current collection cycle is not the first collection cycle):

[0107] 1.1) Receive the first collected data of the current collection cycle fed back by the sensor (i.e., the data collected at the 0th second of the current collection cycle), whose AD value is 500, convert 500 into a four-digit hexadecimal number 01F4, save 01F4 into the collection array, and the last collected data of the previous collection cycle is 500; directly use 01F4 of the collection array as the target double-byte message of the first collected data of the current collection cycle, and save it into the preset message array;

[0108] 1.2) Receive the second acquisition data of the current collection cycle fed back by the sensor (i.e., the data collected at the first second of the current acquisition cycle, i.e., the intermediate acquisition data), whose AD value is 519, convert 519 into a four-digit hexadecimal number 0207, and save 0207 into the acquisition array; calculate the first difference between the second acquisition data and the first acquisition data (the first difference is a positive number), convert the first difference into a two-digit hexadecimal number 13, that is, 13 is the target single-byte message after the current acquisition data is converted, and save the target single-byte message 13 into the preset message array;

[0109] 1.3) Receive the third data collected in the current collection cycle fed back by the sensor (i.e., the data collected in the second second, i.e., the middle data collected), whose AD value is 480, convert 480 into a four-digit hexadecimal number 01E0, and save 01E0 in the collection array; because the absolute value of the second difference between the third data collected and the preset reference value of the current collection cycle is greater than the preset threshold, even if the preset duration has not been reached, the third data collected is also used as the last data collected in the current collection cycle, that is, the target double-byte message of the third data collected is 01E0, and the target double-byte message 01E0 is saved in the preset message array;

[0110] 1.4) Packing the target double-byte message and the target single-byte message of the current acquisition cycle in the preset message array, wirelessly transmitting the packaged message of the current acquisition cycle to the data acquisition host, generating an emergency warning event, and reporting the emergency warning event to the corresponding preset warning processing tool, so that the preset warning processing tool can perform corresponding processing on the emergency warning event, wherein the preset warning processing tool can be the data acquisition host; receiving each acquisition data of the next acquisition cycle to complete the message transmission in the second specific embodiment.

[0111] In the third specific embodiment, data collection of the current collection cycle is performed (the current collection cycle is not the first collection cycle):

[0112] 1.1) Receive the first collected data of the current collection cycle fed back by the sensor (i.e., the data collected at the 0th second of the current collection cycle), whose AD value is 0, convert 0 to a four-digit hexadecimal number 0000, and save 0000 in the collection array. The last collected data of the previous collection cycle is 0; directly use 0000 of the collection array as the target double-byte message of the first collected data of the current collection cycle, and save it in the preset message array;

[0113] 1.2) Receive the second acquisition data of the current collection cycle fed back by the sensor (i.e., the data collected at the first second of the current acquisition cycle, i.e., the middle acquisition data), whose AD value is 0, convert 0 into a four-digit hexadecimal number 0000, and save 0000 into the acquisition array; because the value of the second acquisition data is 0, its corresponding target single-byte message is the preset single-byte message "FF", and the target single-byte message FF is saved into the preset message array;

[0114] 1.3) Receive the third data collected in the current collection cycle fed back by the sensor (i.e., the data collected in the second second, i.e., the middle data collected), whose AD value is 2, convert 0 into a four-digit hexadecimal number 0002, and save 0002 into the collection array; because the third data collected is the first non-0 data collected after the data collected as 0 in the current collection cycle, even if the preset duration has not been reached, the third data collected is also used as the last data collected in the current collection cycle, that is, the target double-byte message of the third data collected is 0002, and the target double-byte message 0002 is saved into the preset message array;

[0115] 1.4) Pack the target double-byte message and the target single-byte message of the current acquisition cycle in the preset message array, and wirelessly transmit the packaged message of the current acquisition cycle to the data acquisition host; receive each acquisition data of the next acquisition cycle to complete the message transmission in the third specific embodiment.

[0116] The sensors of the data acquisition system are networked with the data acquisition host in a one-to-many manner using the LORA communication technology of the Internet of Things. The data acquisition host can use an embedded industrial computer, which is a computer specially designed for industrial environments. It has a compact body structure and can be used in small environments, such as some automation equipment, automated robots, and cash dispensers with small spaces. The embedded industrial computer is equipped with multiple serial ports, each of which is connected to a LORA DTU (Data Transfer Unit, i.e., wireless terminal device), which is also a LORA data transmission radio. The LORA data transmission radio uses LORA modulation technology and carefully adjusts the radio frequency based on many years of experience in wireless communication of the Internet of Things. The measured communication distance is >11.5Km, which perfectly solves the problem of ultra-long-distance communication of small data volumes in complex environments, and provides a strong wireless communication networking guarantee for Internet of Things applications in various industries. The data acquisition system includes multiple sensors, and each sensor is embedded with a single-chip microcomputer, which can be STM32. Each sensor also includes a low-power sensor probe, a LORA module, and the LORA module is used to wirelessly connect to the wireless transmission module 201, and a power supply battery. The LORA module is connected to the serial port of STM32, wherein each LORA module is set with a different address, and each address is used as the sensor address of the data acquisition system. The low-power sensor probe is connected to the ADC port of STM32. Among them, the sensor can be set to a plurality of sensors of different types or the same type, such as a pressure sensor, a temperature sensor, etc. In practical applications, the embedded single-chip microcomputer in the sensor controls the sensor to collect sensor data, and the sensor data is connected to the wireless communication module through the LORA module, and the sensor data is wirelessly transmitted to the LORA DTU connected to the data acquisition host. The LORA DTU transmits the received wireless data to the serial port of the data acquisition host, and then decodes the received message through the system software to generate data acquisition data, and stores it in the database.

[0117] See also Figure 4 As shown, the embodiment of the present application discloses a message transmission device, including:

[0118] The data receiving module 11 is used to receive the current collected data fed back by the preset interface;

[0119] The first execution module 12 is used for converting the current collected data into a target double-byte message if the current collected data is the first collected data or the last collected data in the current collection cycle;

[0120] The second execution module 13 is used to determine the target single-byte message corresponding to the current collection data if the current collection data is the middle collection data of the current collection cycle; wherein the middle collection data is the collection data other than the first collection data and the last collection data in the current collection cycle;

[0121] The message transmission module 14 is used to save the target double-byte message or the target single-byte message into a preset message array, and send the double-byte message or the single-byte message in the preset message array to a corresponding host.

[0122] The beneficial effects of the present application are as follows: the present application receives the current collection data fed back by the preset interface; if the current collection data is the first collection data or the last collection data of the current collection cycle, the current collection data is converted into a target double-byte message; if the current collection data is the middle collection data of the current collection cycle, a target single-byte message corresponding to the current collection data is determined; wherein the middle collection data is the collection data other than the first collection data and the last collection data in the current collection cycle; the target double-byte message or the target single-byte message is saved to a preset message array, and the double-byte message or the single-byte message in the preset message array is sent to the corresponding host. It can be seen that, on the one hand, the present application converts the double-byte message of the intermediate collected data into a single-byte message, which can greatly reduce the length of the data to be transmitted, thereby improving the message transmission efficiency. On the other hand, the first collected data or the last collected data is still a double-byte message. In this way, when the host receives the message data, it can determine the first collected data, the last collected data and the intermediate collected data in the current collection cycle, thereby facilitating the host to recover the received data and ensuring the stability of data transmission.

[0123] Furthermore, an embodiment of the present application also provides an electronic device. Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.

[0124] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Specifically, it may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the message transmission method performed by the electronic device disclosed in any of the aforementioned embodiments.

[0125] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0126] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0127] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222 and data 223, etc. The storage method can be temporary storage or permanent storage.

[0128] Among them, the operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21, which can be Windows, Unix, Linux, etc. In addition to including a computer program that can be used to complete the message transmission method performed by the electronic device disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks. In addition to data transmitted from an external device received by the electronic device, the data 223 can also include data collected by its own input and output interface 25.

[0129] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the message transmission method disclosed above. The specific steps of the method can refer to the corresponding contents disclosed in the above embodiments, and will not be repeated here.

[0130] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0131] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application. The steps of the method or algorithm described in conjunction with the embodiments disclosed herein can be implemented directly with hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable EPROM (Erasable Programmable Read Only Memory), an electrically erasable programmable EEPROM (Electrically Erasable Programmable read only memory), a register, a hard disk, a removable disk, a CD-ROM (CoMP23031586act Disc Read-Only Memory), or any other form of storage medium known in the technical field.

[0132] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0133] The above is a detailed introduction to a message transmission method, device, equipment and medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in the field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A message transmission method, characterized in that: include: Receive the current collected data fed back by the preset interface; If the current collected data is the first collected data or the last collected data in the current collection cycle, converting the current collected data into a target double-byte message; If the current collected data is the middle collected data of the current collection cycle, then determine the target single-byte message corresponding to the current collected data; wherein the middle collected data is the collected data other than the first collected data and the last collected data in the current collection cycle; The target double-byte message or the target single-byte message is saved in a preset message array, and when a preset sending condition is met, the double-byte message and the single-byte message stored in the preset message array are packaged, and the packaged message is sent to the corresponding host.

2. The message transmission method according to claim 1, characterized in that: The step of determining a target single-byte message corresponding to the currently collected data includes: Determine whether the value of the current collected data is 0; If the value of the current collected data is not 0, determining a first difference between the current collected data and the last collected data, and converting the first difference into a target single-byte message; If the value of the currently collected data is 0, a preset single-byte message is determined as a target single-byte message; wherein the preset single-byte message is different from the target single-byte message obtained based on the first difference.

3. The message transmission method according to claim 2, characterized in that: The receiving of the current collected data fed back by the preset interface includes: Receive current collected data fed back by a preset interface, and save the current collected data to a collection array; Accordingly, determining a first difference between the current collected data and the previous collected data includes: The last collected data is obtained from the collection array, and a first difference between the current collected data and the last collected data is determined.

4. The message transmission method according to claim 2, characterized in that: The converting the first difference into a target single-byte message includes: If the first difference is a negative number, converting the absolute value of the first difference into an eight-bit binary first message, setting the highest bit of the first message to 1 to obtain a second message, and then converting the second message into a two-bit hexadecimal target single-byte message; If the first difference is a positive number, the first difference is converted into a two-digit hexadecimal target single-byte message.

5. The message transmission method according to any one of claims 1 to 4, characterized in that: After receiving the current collected data fed back by the preset interface, the method further includes: If the last collected data is 0 and the current collected data is not 0, the current collected data is determined as the last collected data of the current collection cycle.

6. The message transmission method according to any one of claims 1 to 4, characterized in that: After receiving the current collected data fed back by the preset interface, the method further includes: Determine the time difference between the current collection time of the current collection data and the first collection time of the current collection cycle; If the time difference is not less than the preset time length, the current collected data is determined as the last collected data of the current collection cycle.

7. The message transmission method according to any one of claims 1 to 4, characterized in that: After receiving the current collected data fed back by the preset interface, the method further includes: Determine a second difference between the current collected data and a preset reference value, and determine whether an absolute value of the second difference is less than a preset threshold; If the absolute value of the second difference is not less than the preset threshold, the current collected data is determined to be the last collected data of the current collection cycle.

8. The message transmission method according to claim 7, characterized in that: Before determining the second difference between the current collected data and the preset reference value, the method further includes: Determine whether the current collection cycle of the currently collected data is the first collection cycle; If the current collection cycle is the first collection cycle, determining the first collection data of the current collection cycle as the preset reference value; If the current collection cycle is not the first collection cycle, the last collection data of the previous collection cycle is determined as the preset reference value.

9. The message transmission method according to claim 7, characterized in that: After determining the current collected data as the last collected data of the current collection cycle, the method further includes: Generate an emergency warning event, and report the emergency warning event to a corresponding preset warning processing tool so that the preset warning processing tool can process the emergency warning event accordingly.

10. A message transmission device, characterized in that: include: A data receiving module is used to receive the current collected data fed back by the preset interface; A first execution module, configured to convert the current collected data into a target double-byte message if the current collected data is the first collected data or the last collected data in the current collection cycle; The second execution module is used to determine the target single-byte message corresponding to the current collection data if the current collection data is the middle collection data of the current collection cycle; wherein the middle collection data is the collection data other than the first collection data and the last collection data in the current collection cycle; The message transmission module is used to save the target double-byte message or the target single-byte message to a preset message array, and when a preset sending condition is met, the double-byte message and the single-byte message stored in the preset message array are packaged, and the packaged message is sent to the corresponding host.

11. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the message transmission method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the steps of the message transmission method according to any one of claims 1 to 9 are implemented.