Data transmission method and device, computer equipment and medium

By setting data transmission flags and storing untransmitted data in IoT devices, the problem of data being unable to be uploaded in time when the device and the platform are disconnected is solved, and the integrity and accuracy of data transmission are improved.

CN120050343APending Publication Date: 2025-05-27ZHEJIANG CHINT IOT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510181200.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-18
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

When the Internet of Things devices are disconnected from the platform, they cannot upload data in time, resulting in interruption of the platform data and affecting the accuracy and reliability of data transmission.

Method used

By acquiring device data and sending periodically to the data platform, the status of the data transmission flag is set to indicate the transmission of untransmitted data. When the data transmission flag is detected to be an abnormality and the network is abnormal, the untransmitted data is stored in the target area and the data is sent to the platform after the network is restored.

Benefits of technology

It realizes the accurate upload of device data that has not been transmitted in historical cycles under network abnormal conditions, improving the integrity and accuracy of data transmission and ensuring the continuity of platform data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120050343A_ABST
    Figure CN120050343A_ABST
Patent Text Reader

Abstract

The invention provides a data transmission method and device, computer equipment and a medium, and the method comprises the steps: firstly obtaining the equipment data of data source equipment, periodically transmitting the equipment data to a data platform, then setting the state of a data transmission mark according to the data transmission condition of the equipment data which is not transmitted in a historical period in each period, and transmitting the data transmission mark to the data platform; then detecting the state of the data transmission mark in the current period, when detecting that the state of the data transmission mark is abnormal and the data source device or the data platform network is abnormal, storing the device data which is not transmitted to the target area, and finally when the data source device and the data platform network are recovered, storing the device data which is not transmitted to the target area. And sending the untransmitted equipment data to the data platform, and updating the state of the data transmission mark to be normal, the state of the data transmission mark being used for indicating whether the untransmitted equipment data has been successfully transmitted, so that the data transmission method and device can improve the integrity and accuracy of data transmission.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data transmission method, device, computer equipment and readable storage medium. Background Art

[0002] Currently, IoT devices such as sensors, smart meters, and environmental monitoring devices usually upload telemetry data to the platform in a periodic manner to ensure real-time synchronization of data between the device and the platform. The device is connected to the platform through wireless communication technology for data transmission and analysis.

[0003] However, when the device is disconnected from the platform, data cannot be uploaded in time, resulting in platform data interruption. Even if the network is restored, the device can only upload the subsequent data and cannot fill the data gap during the interruption, resulting in incomplete platform data and affecting the accuracy and reliability of data transmission. Summary of the invention

[0004] The present application provides a data transmission method, apparatus, computer equipment and readable storage medium, which can improve the integrity and accuracy of data transmission.

[0005] In a first aspect, the present application provides a data transmission method, the method comprising:

[0006] Acquire device data of the data source device, and periodically send the device data to the data platform;

[0007] According to the data transmission status of each cycle for the device data that has not been transmitted in the historical cycle, the state of the data transmission flag is set; the state of the data transmission flag is used to indicate whether the device data that has not been transmitted has been successfully transmitted, and the state of the data transmission flag is normal, indicating that the device data that has not been transmitted has been successfully transmitted, and the state of the data transmission flag is abnormal, indicating that the device data transmission that has not been transmitted has failed;

[0008] Detecting the state of the data transmission flag in the current cycle, and when detecting that the state of the data transmission flag is abnormal and the data source device or the data platform network is abnormal, storing the untransmitted device data to the target area;

[0009] When the data source device and the data platform network are restored, the untransmitted device data is sent to the data platform, and the status of the data transmission flag is updated to normal.

[0010] Optionally, the method further includes:

[0011] When the data source device or the data platform network is abnormal, performing multiple sending operations on the first device data of the current period to the data platform;

[0012] If the first device data still fails to be sent at the end of the current cycle, the first device data and the timestamp of the device data are backed up in the data buffer.

[0013] Optionally, the data transmission flag includes a first flag, and a state of the first flag is used to indicate whether the first device data in the data buffer has been transmitted to the data platform; and setting the state of the data transmission flag according to the data transmission situation of each cycle includes:

[0014] detecting a state of the first flag, and when detecting that the state of the first flag is abnormal, sending the first device data to the data platform;

[0015] detecting a sending status of the first device data, and when detecting that the first device data is successfully sent, inserting the first device data into the data platform according to a timestamp of the first device data, and setting a status of the first flag to a normal status;

[0016] When it is detected that the first device data fails to be sent, retrying the operation of sending the first device data to the data platform, and if the first device data still fails to be sent at the end of the current cycle, setting the state of the first flag to an abnormal state;

[0017] If the first device data is sent successfully, the state of the first flag is set to a normal state.

[0018] Optionally, the data transmission flag further includes a second flag, and the state of the second flag is used to indicate whether the second device data in the target area has been transmitted to the data platform; and setting the state of the data transmission flag according to the data transmission situation of each cycle also includes:

[0019] detecting a state of the second flag, and when detecting that the state of the second flag is abnormal, sending the second device data to the data platform;

[0020] When it is detected that the second device data fails to be sent, retrying the operation of sending the second device data to the data platform, and if the second device data still fails to be sent at the end of the current cycle, setting the state of the second flag to an abnormal state;

[0021] If the second device data is sent successfully, it is detected whether there is second device data that has not been transmitted to the data platform or an extraction operation on the second device data; if so, the state of the second flag is set to an abnormal state; if not, the state of the second flag is set to a normal state.

[0022] Optionally, after detecting that there is second device data that has not been transmitted to the target area, the method further includes:

[0023] determining a third amount of the second device data that has not been transmitted to the data platform based on a first amount of the total amount of the second device data stored and a second amount of the second device data sent to the data platform;

[0024] determining a storage location in the target area of ​​each second device data that has not been transmitted to the data platform;

[0025] Reading the second device data from the storage location, and performing validity verification on the second device data;

[0026] If the second device data verification passes, the second flag is set to an abnormal state; if the second device data verification fails, whether the storage number of the second device data is greater than the upper limit value of the total storage number is detected;

[0027] If it is detected that the storage number of the second device data is less than or equal to the upper limit value of the total storage number, the storage number of the second device data is increased by one unit in an ascending manner; if it is detected that the storage number of the second device data is greater than the upper limit value of the total storage number, the storage number of the second device data is set to zero.

[0028] Optionally, after the second device data is successfully sent to the data platform, the method further includes:

[0029] Increasing the sending number used to record the successful sending of the second device data by one unit in a number-increasing manner, and detecting whether the sending number of the second device data is greater than the upper limit value of the total number of storages;

[0030] If it is detected that the sending number of the second device data is greater than the upper limit of the total number of storages, the sending number of the second device data is set to zero; if it is detected that the sending number of the second device data is less than or equal to the upper limit of the total number of storages, the sending number of the second device data remains unchanged;

[0031] The fourth number used to represent the total number of successfully sent second device data is increased by one unit in an increasing manner, and the second flag is set to a normal state.

[0032] Optionally, storing the untransmitted device data in a target area includes:

[0033] Obtaining the storage length of the device data;

[0034] Obtaining a storage location serial number of the device data in the target area; each time a device data is stored in the target area, the storage location serial number increases by one unit;

[0035] Determine the storage position of the device data in the target area according to the storage length and storage position sequence number of the device data and the preset starting storage position in the target area;

[0036] The device data is stored in a storage location in the target area.

[0037] In a second aspect, the present application further provides a data transmission device, comprising:

[0038] A first transmission module, used for acquiring device data of the data source device and periodically sending the device data to the data platform;

[0039] A flag setting module is used to set the state of a data transmission flag according to the data transmission status of the device data that has not been transmitted in the historical period in each period; the state of the data transmission flag is used to indicate whether the device data that has not been transmitted has been successfully transmitted, and the state of the data transmission flag is normal, indicating that the device data that has not been transmitted has been successfully transmitted, and the state of the data transmission flag is abnormal, indicating that the device data that has not been transmitted has failed to transmit the data;

[0040] A flag detection module is used to detect the state of the data transmission flag in the current cycle, and when it is detected that the state of the data transmission flag is abnormal and the data source device or the data platform network is abnormal, the untransmitted device data is stored in the target area;

[0041] The second transmission module is used to send the untransmitted device data to the data platform and update the status of the data transmission flag to normal when the network between the data source device and the data platform is restored.

[0042] In a third aspect, the present application also provides a computer device, comprising a processor and a memory; the memory is used to store a computer program; the processor is used to execute the computer program stored in the memory to implement the steps of the data transmission method as described above.

[0043] In a fourth aspect, the present application further provides a computer-readable storage medium storing a computer program, wherein the computer program is loaded by a processor to perform the steps of the data transmission method as described above.

[0044] The embodiment of the present application first obtains a data transmission flag that reflects the data transmission status of each period, and then accurately determines whether there is data that has not been successfully transmitted due to network abnormalities by detecting the status of the data transmission flag, and stores the data that has not been successfully transmitted to the target area. When the network returns to normal, the data in the target area is transmitted to the corresponding position of the data platform, thereby improving the integrity and accuracy of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0046] Figure 1 It is a flowchart of a data transmission method provided in an embodiment of the present application;

[0047] Figure 2 is a schematic diagram of a flow chart of a first flag state setting provided in an embodiment of the present application;

[0048] Figure 3 It is a schematic diagram of the overall data transmission process provided in an embodiment of the present application;

[0049] Figure 4 is a schematic diagram of a process for determining a storage location of device data provided in an embodiment of the present application;

[0050] Figure 5 is a schematic diagram of a flow chart for detecting data transmission and storage conditions of a second device provided in an embodiment of the present application;

[0051] Figure 6 is a schematic diagram of the process of setting the second flag state provided in an embodiment of the present application;

[0052] Figure 7 is an architecture diagram of a data transmission system provided in an embodiment of the present application;

[0053] Figure 8 is an architectural diagram of a data transmission device provided in an embodiment of the present application;

[0054] Fig. 9 It is a schematic diagram of the structure of the computer device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0055] 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 application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0056] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the feature. In the description of this application, "plurality" means two or more, unless otherwise clearly and specifically defined.

[0057] In this application, the word "exemplary" is used to mean "used as an example, illustration or description". Any embodiment described as "exemplary" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. At the same time, it is to be understood that in the specific implementation of this application, when user information, user data and other related data are involved, when the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data shall comply with relevant laws, regulations and standards of relevant countries and regions.

[0058] In order to enable any person skilled in the art to implement and use the present application, the following description is provided. In the following description, details are listed for the purpose of explanation. It should be understood that those of ordinary skill in the art will recognize that the present application can be implemented without using these specific details. In other examples, known structures and processes will not be elaborated in detail to avoid unnecessary details that make the description of the present application obscure. Therefore, the present application is not intended to be limited to the embodiments shown, but is consistent with the widest range of principles and features disclosed in the present application.

[0059] In the prior art, remote telemetry data transmission between devices and platforms has become the basis of many industries and applications. In order to achieve real-time monitoring and data analysis of equipment, the equipment usually uploads the collected data to the platform in a periodic manner. These devices can be sensors, smart meters, environmental monitoring devices, etc., which exchange data with the platform through wireless communication technologies (such as Wi-Fi, 4G, 5G, etc.). At present, data transmission between devices and platforms generally relies on a stable network connection, and data is transmitted to the cloud platform or local server through the network for processing and analysis. Generally speaking, the device sends data periodically, which can ensure the timely update of data and the continuity of platform data even in certain network instability.

[0060] However, when the network connection between the device and the platform is interrupted, the device cannot report the collected data to the platform in time, resulting in the platform being unable to receive data updates in time. This interruption may be caused by wireless signal loss, network device failure, bandwidth limitation or other external factors. After the network is restored, although the device can start uploading data again, due to data loss or failure to upload in time, the platform's data will have breakpoints and cannot reflect the actual operation of the device. Such problems will especially affect the integrity and reliability of data in application scenarios that require high availability and real-time monitoring, and thus affect the platform's decision support and business processing.

[0061] Therefore, based on the data transmission method of the present application, device data that has not been transmitted in the historical period can be accurately uploaded to the data platform, thereby improving the integrity and accuracy of data transmission.

[0062] The present application provides a data transmission method, apparatus, computer device and readable storage medium, which are described in detail below.

[0063] Figure 1 This is a flow chart of a data transmission method in one embodiment of the present application. Figure 2 As shown, the data transmission method can be applied to a data transmission device, which is connected to or built into a data source device, and includes the following steps 101 to 104.

[0064] Step 101: Acquire device data of a data source device, and periodically send the device data to a data platform.

[0065] In the scenario of the present application, the data transmission device can be used to report the device data of the data source device to the data platform completely and accurately. For example, the data source device can be a large motor, temperature sensor, power meter, intelligent distribution box and other equipment, and the device data can be the current, voltage, temperature and other data generated by the above data source devices. The data transmission device can transmit the device data periodically, for example, reporting it periodically per second or per minute.

[0066] Specifically, the data transmission device can communicate with the remote system through the 4G module, using the MQTT protocol, and the MQTT protocol message body uses the JSON format, which is expressed as follows:

[0067] Serial number Device report topic describe 1 / Edge / {DevTyp} / {DevSN} / RTG Periodic reporting 2 / Edge / {DevTyp} / {DevSN} / History Resume historical data transfer

[0068] Wherein, {DevTyp} is the device type, such as ZTWLEA03. {DevSN} is the device serial number, such as 00000000000066. Some exemplary device data can be expressed as:

[0069]

[0070]

[0071] In some embodiments, the method of the present application may further include:

[0072] When the data source device or the data platform network is abnormal, multiple sending operations are performed on the first device data of the current period to the data platform;

[0073] If the first device data still fails to be sent at the end of the current cycle, the first device data and the timestamp of the device data are backed up in the data buffer.

[0074] Specifically, when the data source device or data platform network is abnormal, the first device data of the previous cycle cannot be successfully reported to the data platform. Since these data still have high timeliness and importance, they may have a certain impact on real-time monitoring and analysis, so the system will perform multiple sending operations on them. For example, in the power monitoring scenario, the power data, current and voltage data of the previous cycle are crucial for real-time understanding of the operating status of the power system. Even if there is a problem with the network, these data should be sent successfully within the current cycle as much as possible to ensure that the data platform can obtain relatively the latest information, so as to make accurate analysis and decisions, and avoid misjudgment of the system status due to missing or delayed data.

[0075] In each cycle, you can check the cycle reporting time and flag bit according to the set process. When it is found that the data of the previous cycle was not successfully reported, you can try to send these data multiple times in this cycle. For example, you can check the cycle reporting time at least once a second. If it is found that the data of the previous cycle was not successful and the time of this cycle has expired, you can continue to try to send the backup data of the previous cycle to the remote system in this cycle until the end of this cycle. In this process, the system makes full use of the time period when the network may return to normal, and gives priority to trying to send the data of the previous cycle instead of immediately processing it as historical data. This can improve the real-time nature of the data, reduce the impact of data transmission delays caused by network fluctuations on the system, and ensure that the data platform can obtain near real-time device data as soon as possible.

[0076] If the first device data still fails to be sent at the end of the current cycle, it means that after multiple attempts in this cycle, the data still cannot reach the data platform. At this time, because the timeliness of the data begins to decrease and the real-time reporting opportunity in the current cycle has been missed, it is necessary to back up the data and the timestamp of the device data to the data buffer. The timestamp is used to clarify the time when the data is generated, which is very critical for the subsequent tracing of the order and time nodes of data generation. As a temporary storage area, the data buffer can temporarily store the data that failed to be successfully sent in the previous cycle in this case, and wait for the network to recover before processing. Compared with historical data, the waiting time of the data in the previous cycle in the data buffer is relatively short. Once the network is restored, it can be quickly taken out of the buffer and continue to be sent, thereby realizing breakpoint transmission of data and ensuring data continuity. At the same time, it also provides a complete data chain for subsequent possible data analysis, and the key data of the previous cycle will not be lost even in the case of network abnormalities.

[0077] The data buffer plays an important role in buffering and protecting the first device data of the previous cycle. During network anomalies, a safe temporary storage place can be provided for the first device data to avoid data loss due to failure to send in time. When the network is restored, the system can quickly obtain the data of the previous cycle from the buffer and send it, reducing the cost and time of re-collecting or regenerating data. At the same time, the existence of the data buffer also optimizes the entire data transmission process, allowing the system to process the data of the previous cycle more flexibly when facing network instability. On the premise of ensuring the real-time nature of the data, it reasonably manages the transmission and storage of data, improves the system's adaptability to network anomalies and the overall efficiency of data processing. Compared with the storage and processing of historical data, the data buffer provides a faster recovery and transmission mechanism for the data of the previous cycle, ensuring the effective management and utilization of data under network fluctuations.

[0078] Step 102: according to the data transmission status of each cycle for the device data that has not been transmitted in the historical cycle, the state of the data transmission flag is set.

[0079] The state of the data transmission flag is used to indicate whether the untransmitted device data has been successfully transmitted. If the state of the data transmission flag is normal, it indicates that the untransmitted device data has been successfully transmitted. If the state of the data transmission flag is abnormal, it indicates that the untransmitted device data has failed to be transmitted. The data transmission flag may include a first flag and a second flag. The state of the first flag is used to indicate whether the first device data in the data buffer has been transmitted to the data platform. The state of the second flag is used to indicate whether the second device data in the target area has been transmitted to the data platform.

[0080] Among them, the first flag can also be called "PeriodFlag", which is used to indicate the reporting status of the data of the previous cycle and is a binary variable. When PeriodFlag is 0, the state of the first flag is normal, indicating that the first device data of the previous cycle has been successfully reported and the flag has been cleared, and the transmission of the data of the previous cycle has been successfully completed. At this time, no additional processing will be performed on the cycle data, but the normal cycle data collection and reporting process will continue. When PeriodFlag is 1, the state of the first flag is abnormal, indicating that the first device data of the previous cycle has not been successfully reported to the platform. This may be due to network anomalies and other reasons that cause data transmission to be interrupted. In this case, the system will trigger the corresponding processing flow, such as saving the data of the previous cycle as historical data, and continue to try to send the backup data of the previous cycle during this cycle to ensure the integrity and real-time nature of the data.

[0081] The second flag is used to indicate whether there is historical data before the first device data, that is, the second device data, that needs to be reported and the reporting status of the current historical data. The second flag is also a binary variable with a value of 0 or 1.

[0082] When the second flag is 0, it means that there is no second device data to be reported. When the second flag is 1, it means that there is second device data to be reported. At this time, the system will start the historical data sending process, read the corresponding historical data from the historical record data storage area and send it to the system. After sending the historical data, the flag can be updated according to the sending result.

[0083] In some embodiments, step 102 may include:

[0084] First, detecting a state of a first flag, and when detecting that the state of the first flag is abnormal, sending the first device data to the data platform;

[0085] Next, detecting the sending status of the first device data, and when detecting that the first device data is successfully sent, inserting the first device data into the data platform according to the timestamp of the first device data, and setting the status of the first flag to a normal state;

[0086] Then, when it is detected that the first device data fails to be sent, the operation of sending the first device data to the data platform is retried, and if the first device data still fails to be sent at the end of the current cycle, the state of the first flag is set to an abnormal state;

[0087] Finally, if the first device data is sent successfully, the state of the first flag is set to a normal state.

[0088] like Figure 2As shown, at the beginning of each cycle, the system first detects the state of the first flag. When its state is detected to be abnormal, it means that the first device data of the previous cycle has not been successfully reported. At this time, the first device data of the previous cycle needs to be sent to the data platform. For example, in the power monitoring system, if the power, voltage and other data collected in the previous cycle are not successfully transmitted to the data platform due to network problems, the system will identify this situation based on the state of the first flag, and start the data retransmission mechanism to send these data again to ensure that the data platform can obtain complete monitoring data.

[0089] In some embodiments, after the first device data is sent to the data platform, the data platform will process and confirm the received data. When it is detected that the first device data is sent successfully, the system will accurately insert it into the corresponding position in the data platform according to the timestamp of the first device data. The timestamp records the specific time when the data is generated, which is very important for the data platform to sort, analyze and trace back the data. For example, during the data analysis process, the data arranged in timestamp order can clearly show the changing trend of parameters such as power and voltage in the power system over time. At the same time, the system will set the status of the first flag to normal, indicating that the data of the previous cycle has been successfully reported, and the system can continue the data collection and reporting process of the next cycle without repeating the data of this cycle.

[0090] If it is detected that the first device data fails to be sent, the system will not give up immediately, but will retry the operation of sending the first device data to the data platform to cope with temporary transmission problems that may be caused by network fluctuations, etc., and continue to try to send data in the current cycle, making full use of the time period when the network may return to normal. However, if the first device data still fails to be sent at the end of the current cycle, it means that the data transmission still cannot be completed after multiple attempts in this cycle. At this time, the status of the first flag can be set to an abnormal state, so that at the beginning of the next cycle, the system can recognize that the data of the previous cycle has not been successfully reported, and continue to perform corresponding processing, such as trying to send data again or performing other data backup and storage operations to ensure the integrity and continuity of the data.

[0091] In some embodiments, step 102 may further include:

[0092] First, detecting the state of the second flag, and when detecting that the state of the second flag is abnormal, sending the second device data to the data platform;

[0093] Next, when it is detected that the second device data fails to be sent, the operation of sending the second device data to the data platform is retried, and if the second device data still fails to be sent at the end of the current cycle, the state of the second flag is set to an abnormal state;

[0094] Finally, if the second device data is sent successfully, it is detected whether there is second device data that has not been transmitted to the data platform or an extraction operation on the second device data; if so, the state of the second flag is set to an abnormal state; if not, the state of the second flag is set to a normal state.

[0095] like Figure 3 As shown, if it is detected that the second device data fails to be sent, the operation of sending the second device data to the data platform can be retried. Historical data is equally important for the integrity and continuity of the data, and the sending cannot be easily abandoned. You can continue to try in the current cycle, and use the moments when the network may return to normal and idle to successfully send the historical data as much as possible. For example, when the amount of data is large or the network condition is poor, some historical data may fail to be sent. The retry mechanism can improve the success rate of data transmission and reduce the possibility of data loss.

[0096] If the second device still fails to send data at the end of the current cycle, the state of the second flag can be set to an abnormal state, so that historical data that has not been successfully sent can continue to be identified in subsequent cycles and continue to be processed. At the same time, this processing method is also coordinated with the entire data transmission and management process to ensure that the system can continue to track and process unfinished data transmission tasks. Whether it is periodic data or historical data, it can be properly processed when network conditions permit, ensuring the integrity and accuracy of the data.

[0097] When the second device data is sent successfully, it is possible to further check whether there is any second device data that has not been transmitted to the data platform or whether there is any extraction operation on the second device data, because historical data may be stored and processed in batches, and a successful sending does not mean that all historical data has been processed. For example, the device data of multiple time periods may be stored in the historical data storage area. When a part of the data is sent successfully, it is necessary to check whether there is any remaining data to be sent.

[0098] If it is detected that there is untransmitted second device data or there is still extraction operation, it means that the processing of historical data has not been completed, and the state of the second flag can be set to abnormal state, that is, keep it at 1, so as to continue the subsequent historical data transmission and processing process. If there is no untransmitted data and the extraction operation is completed, it means that all historical data has been successfully sent to the data platform, and the state of the second flag can be set to normal state, that is, set to 0, indicating that the historical data reporting task has been successfully completed, and other operations can be continued according to the actual situation, such as waiting for new periodic data collection or performing other system maintenance tasks, etc., to ensure the orderliness and accuracy of the entire data transmission and processing process.

[0099] In some embodiments, after detecting that there is second device data that has not been transmitted to the target area, the method of the present application further includes:

[0100] First, according to a first number of the total number of second device data storages recorded and a second number of second device data sent to the data platform, a third number of second device data not transmitted to the data platform is determined;

[0101] Next, determining a storage location in the target area of ​​each second device data that has not been transmitted to the data platform;

[0102] Then, the second device data is read from the storage location, and the validity of the second device data is verified;

[0103] Then, if the second device data verification passes, the second flag is set to an abnormal state; if the second device data verification fails, whether the storage number of the second device data is greater than the upper limit value of the total storage number is detected;

[0104] Finally, if it is detected that the storage number of the second device data is less than or equal to the upper limit value of the total storage number, the storage number of the second device data is increased by one unit in an ascending manner; if it is detected that the storage number of the second device data is greater than the upper limit value of the total storage number, the storage number of the second device data is set to zero.

[0105] First of all, it should be noted that the target area for storing the second device data can be divided into two parts, including historical data storage information recording variables and historical record data storage area, wherein the storage information of the second device data may include the following variables:

[0106] RecordLen: data record length, a constant;

[0107] TotalMax: the maximum number of records, which is a constant;

[0108] StartAddr: the starting storage location, which is a constant;

[0109] RecordLen: data length, which is the value of C_MeasureData_LEN and is a constant;

[0110] CurrentNum: current storage location, a variable, initialized to 0;

[0111] TotalNum: total storage quantity, a variable, initialized to 0;

[0112] HistoryLastNum: The sending number of the second device data, that is, the location of the last historical record transmission, is the first variable and is initialized to 0;

[0113] HistorySaveTotal: The total number of storages of the second device data, that is, the total number of historical records stored. Each time the periodic data with a timestamp is saved to the target area, the change amount is increased by 1. The variable is initialized to 0.

[0114] HistorySendTotal: The total number of successfully reported data from the second device, that is, the total number of historical records reported. The change amount is increased by 1 each time the historical periodic data is successfully reported. The variable is initialized to 0.

[0115] like Figure 5 As shown, the first number can be HistorySaveTotal, the second number can be HistorySendTotal, and the third number can be V. The first number records the total number of historical data saved, the second number indicates the number of historical data that has been successfully sent, and the third number obtained by subtracting the two indicates the number of historical data that has not yet been sent.

[0116] In some embodiments, the historical record data storage area can store historical data from the starting storage position StartAddr to the continuous position of StartAddr+(TotalMax*RecordLen). The storage position of each untransmitted second device data in this area can be calculated by this formula, that is, reading data from the storage address (StartAddr(starting storage position+RecordLen(data record length)*(HistoryLastNum)) corresponding to the position variable HistoryLastNum where the historical record needs to be sent currently. His storyLastNum is used as an index variable of the storage position. Through calculation with the starting storage position StartAddr and the data length RecordLen, the storage position of each untransmitted data in the target area can be accurately found. For example, the target area can be a flash memory, thereby ensuring the orderly storage and reading of data, facilitating the system to quickly locate and process the untransmitted historical data, and improving the efficiency of data transmission.

[0117] After reading the second device data from the determined storage location, the validity check of the second device data can be performed to ensure the accuracy and reliability of the data sent to the data platform. For example, a CRC check can be performed on the second device data to check the integrity of the data to prevent data damage or errors during storage or transmission. By performing a validity check on the second device data, the correct data can be screened out for transmission, improving the accuracy of data transmission, and further processing can be performed on the data that fails the check to ensure the integrity and reliability of the data.

[0118] If the data verification of the second device passes, it means that the data is complete and correct and can be prepared to be sent to the data platform. At this time, the second flag is set to an abnormal state, that is, set to 1, indicating that there is historical data that can be sent, and the subsequent data sending process can continue, and the verified data is sent to the data platform to ensure that the data can be transmitted in a timely manner and to ensure the continuity and integrity of the data.

[0119] If the second device data verification fails, the system needs to further detect whether the storage number HistoryLastNum of the second device data is greater than the upper limit value TotalMax of the total storage, and handle possible data errors or storage anomalies. If HistoryLastNum is less than or equal to TotalMax, it means that the storage number is within the normal range, and the storage number is increased by one unit in an incremental manner, that is, try to read the data at the next storage location. Since some small errors occurred in the current data during the storage process, re-verification is performed by reading the next data to find the correct data for sending.

[0120] Correspondingly, if it is detected that HistoryLastNum is greater than TotalMax, the storage number can be set to zero, indicating that the entire storage area has been traversed and it is necessary to start looking for the correct data from the starting position again to ensure that valid historical data is cyclically searched in the storage area to avoid failure of the entire historical data transmission due to local data errors, and to ensure data integrity and recoverability. This processing method enables the system to flexibly adjust the reading position and continue to find the correct data for transmission when the data verification fails, improving the system's ability to handle data errors and the reliability of data transmission.

[0121] In some embodiments, after the second device data is successfully sent to the data platform, the method of the present application further includes:

[0122] First, the sending number used to record the successful sending of the second device data is increased by one unit in a number-increasing manner, and it is detected whether the sending number of the second device data is greater than the upper limit value of the total number of storage;

[0123] Next, if it is detected that the sending number of the second device data is greater than the upper limit of the total number of storages, the sending number of the second device data is set to zero; if it is detected that the sending number of the second device data is less than or equal to the upper limit of the total number of storages, the sending number of the second device data remains unchanged;

[0124] Finally, the fourth number used to represent the total number of successfully sent second device data is increased by one unit in an increasing manner, and the second flag is set to a normal state.

[0125] like Figure 6 As shown, after successfully sending a second device data, the sending number HistoryLastNum used to record the successful sending of the second device data can be increased by one unit in an ascending manner to monitor the sending progress of the second device data, ensure that the second device data is sent in sequence, and accurately record the location of the data that should be sent next time. For example, assuming that the second device data of a historical cycle is successfully sent, and its corresponding sending number HistoryLastNum is 5, then HistoryLastNum can be increased by one unit to 6, indicating that the system will try to send the second device data numbered 6 next time, thereby ensuring the orderliness and consistency of the sending of the second device data.

[0126] In some embodiments, when it is detected that the sending number of the second device data is greater than the upper limit value TotalMax of the total storage, the sending number can be set to zero, and the second device data is stored in a circular manner in the storage area. When the sending number reaches the upper limit, it can return to the starting position to continue sending data to achieve a complete traversal of the historical data in the entire storage area. For example, if TotalMax is 100, when HistoryLastNum increases to 101, it is set to 0, and the system can continue to search and send the second device data from the starting position of the storage area to ensure that no data is missed, and at the same time, the storage area can be fully utilized to achieve circular storage and transmission of data.

[0127] If it is detected that the sending number of the second device data is less than or equal to the upper limit value of the total storage number, the sending number remains unchanged. In the normal sending order, as long as the number does not exceed the upper limit, the next second device data can be sent according to the incremented number without special processing, thereby ensuring the stability and continuity of the data sending order.

[0128] In some embodiments, the fourth number HistorySendTotal used to represent the total number of second device data successfully sent can be increased by one unit in an incremental manner. HistorySendTotal is used to record the number of historical data that have been successfully sent to the data platform. This number is increased each time a second device data is successfully sent. The system can clearly understand the scale of historical data that has been sent through HistorySendTotal, which is convenient for data statistics and monitoring of transmission progress. For example, in a long-running data transmission process, by checking the value of HistorySendTotal, the system administrator can intuitively know how many second device data have been successfully transmitted, which helps to evaluate the efficiency and integrity of data transmission.

[0129] After updating HistorySendTotal, the second flag can be set to the normal state, that is, set to 0, indicating that there is no more second device data that needs to be sent immediately, the system has completed a round of second device data sending tasks, and all sent data has successfully arrived at the data platform. The state change of the second flag is very important for the control of the entire data transmission process. It can guide the system to decide whether to continue sending the second device data or switch to other data processing tasks according to the flag status in subsequent operations, ensuring that the system's operating logic is clear and orderly, and improving the overall performance of the system and data processing efficiency.

[0130] Step 103: Detect the state of the data transmission flag in the current cycle. When it is detected that the state of the data transmission flag is abnormal and the data source device or the data platform network is abnormal, store the untransmitted device data to the target area.

[0131] As an example, assume that the periodic data at 18:00:00 on October 5, 2024 was not reported due to network problems. At 18:05:00 on October 5, 2024, the network has returned to normal, and the periodic data is reported normally. After the periodic data is reported, the historical data at 18:00:00 on October 5, 2024 will be reported. The format of the periodic data is as follows.

[0132] Assuming there are 83 data items, the device data can be divided into multiple frames for sending. If the Seq in the message body is the same, the periodic data is reported at the same time. For example, the first frame of device data is as follows.

[0133] theme:

[0134]

[0135]

[0136] The second frame of device data is as follows:

[0137] Frame 2

[0138] theme:

[0139]

[0140] In some embodiments, step 103 may include:

[0141] First, obtain the storage length of the device data;

[0142] Next, the storage location number of the device data in the target area is obtained; each time a device data is stored in the target area, the storage location number increases by one unit;

[0143] Then, according to the storage length and storage position sequence number of the device data and the preset starting storage position in the target area, the storage position of the device data in the target area is determined;

[0144] Finally, the device data is stored in a storage location in the target area.

[0145] The storage location of the device data in the target area can be determined by the formula StartAddr+RecordLen*(CurrentNum-1) based on the storage length RecordLen of the device data, the storage location sequence CurrentNum, and the preset starting storage location StartAddr in the target area. Based on the storage structure and data storage order of the target area, StartAddr is the starting storage location and the reference point for all device data storage. RecordLen*(CurrentNum-1) calculates the offset of the current device data relative to the starting location. By adding the offset to the starting location, the actual storage location of the device data in the target area can be accurately obtained. For example, if StartAddr is 0x1000, RecordLen is 100 bytes, and CurrentNum is 3, then the calculated storage location is 0x1000+100*(3-1)=0x1200, that is, the device data will be stored in a 100-byte space starting from the address 0x1200, ensuring the accurate placement of the data in the storage area and facilitating data storage and reading operations.

[0146] For another example, the record data length is set to 348 bytes, but 360 bytes of space are actually used to store data, that is, RecordLen is 360 bytes. The data reporting cycle is 5 minutes, and the maximum number of records TotalMax is set to 10,000. The sector size of the storage medium is 4k bytes. After calculation, the minimum storable record length is 9,988. Assuming that the calculation is based on a 5-minute cycle, these records can be stored for approximately 34.68 days, which means that in the event of a network anomaly, up to 34.68 days of device data can be stored, and historical data breakpoints can be reported after the network is restored. The storage space originally occupied by 10,000 records is 3515.625kB bytes of space, but because they must be aligned according to 4kB bytes, the final space required is 3516kB bytes of space.

[0147] like Figure 4As shown, in some embodiments, the device data can be stored in the storage location of the calculated target area to complete the data storage process, and the data collected by the device can be accurately written into a storage medium such as a Flash memory according to predetermined rules and locations to ensure that the data can be stored safely and orderly. When these data are needed in the future, the system can read the data quickly and accurately according to the storage location information. Whether it is used for data reporting, analysis or other processing operations, it depends on the correct storage of the data. For example, in the data reporting process, when historical data needs to be sent, the system can quickly find the corresponding data according to the storage location information and read and send it, which ensures the timeliness and accuracy of data transmission, and also provides a basic guarantee for the long-term storage and management of data, so that the entire system can operate stably and effectively process various device data.

[0148] Step 104: When the data source device and the data platform network are restored, the untransmitted device data is sent to the data platform, and the status of the data transmission flag is updated to normal.

[0149] It can be understood that when the network between the data source device and the data platform returns to normal, it is possible to detect whether there is any untransmitted device data, including the first device data that was not successfully sent in the previous cycle and the part of the historical data that has not yet been transmitted to the data platform. Specifically, it is possible to determine which data needs to perform a breakpoint sending operation based on previously recorded data transmission status information, such as the status of the first flag and the second flag, and the relevant records in the data storage area. For example, if the first flag is in an abnormal state, that is, Period Flag = 1, indicating that the data in the previous cycle was not successfully sent, the system can prepare the device data of the previous cycle to be sent to the data platform. For the second device data, if the second flag is in an abnormal state and it is determined by calculation that there is a number of unsent historical data, the corresponding historical data sending process can be started.

[0150] It can be understood that if the data of the first device in the previous cycle is sent successfully, the system can update the status of the first flag to normal, indicating that the data of the previous cycle has been successfully transmitted to the data platform, and the system can continue to collect and report data for the next cycle without repeating the data of the cycle. For example, in a real-time monitoring system, after the monitoring data of the previous cycle is successfully sent, the first flag is updated to 0, and the system will normally collect temperature, power and other data for the next cycle, and report according to the process to ensure the real-time and continuity of the data.

[0151] In a possible example, in order to better implement the data transmission method in the embodiment of the present application, a data transmission system is also provided in the embodiment of the present application on top of the data transmission method.

[0152] like Figure 7 As shown, the data transmission system may include a microcontroller unit MCU, a key input module, a four-way temperature signal sampling module, a metering module, a three-phase current signal sampling module, a three-phase voltage signal sampling module, a residual current sampling module, a display module, a 4G module, a flash memory, and an EEPROM memory.

[0153] Specifically, the key input module can be used to receive user operation instructions, such as setting parameters, querying data, etc., and convert the user's key operation into an electrical signal and transmit it to the micro control unit.

[0154] The four-channel temperature signal sampling module can collect four-channel temperature signals from the data source device and convert them into voltage signal output. These temperature signals may come from the inside of the device or the external environment, and are used to monitor temperature changes, such as device operating temperature, ambient temperature, etc.

[0155] The metering module is equipped with a 7-channel dedicated metering chip, of which 4 current sampling channels are used to collect three-phase current signals and residual current signals, and 3 voltage sampling channels are used to collect voltage signals. It can accurately measure parameters such as voltage and current, and calculate power signals, electric energy data, etc. It can also provide waveform data to provide basic data for subsequent data analysis.

[0156] Three-phase current signal sampling and three-phase voltage signal sampling are responsible for collecting current and voltage signals in three-phase circuits respectively. These signals are key parameters for monitoring the operating status of power systems and are of great significance for analyzing power quality, energy consumption and other aspects.

[0157] One residual current sampling channel is mainly used to monitor the residual current in the circuit, which is very important for electrical safety monitoring and can detect safety hazards such as leakage in time.

[0158] The display module can display the system's operating status, collected data and other information to the user in an intuitive manner according to the control instructions of the microcontroller unit, making it convenient for the user to understand the working conditions and data information of the equipment.

[0159] The 4G module realizes wireless communication between the device and the external data platform. It is responsible for sending the collected data to the data platform. It can also receive instructions or configuration information from the platform to ensure remote transmission and interaction of data.

[0160] The flash memory can be a Flash memory used to store various data during the operation of the device, including historical data, configuration information, etc. It is non-volatile, and the stored data will not be lost even if the device is powered off, providing a guarantee for the long-term preservation of data.

[0161] EEPROM memory is usually used to store some small-capacity data that needs to be read and written frequently, such as device configuration parameters, calibration data, etc. Its characteristics are relatively fast reading and writing speed, and data can be modified and updated during system operation.

[0162] In some embodiments, the microcontroller unit may include an ADC sampling module and a clock module. The ADC sampling module can collect the voltage signals output by the four-channel temperature signal sampling module and convert them into digital temperature signals. This process involves the conversion of analog signals to digital signals and temperature calculation based on the characteristics of the temperature sensor to ensure accurate acquisition of temperature data and provide data support for equipment operation status monitoring and environmental temperature monitoring.

[0163] The clock module can provide accurate clock signals for the microcontroller unit, which is crucial for system time synchronization, data acquisition cycle control, and scheduled task execution. For example, when collecting and reporting data at a fixed cycle, the clock signal ensures that the time interval of each cycle is accurate and consistent, ensuring the timeliness and accuracy of the data.

[0164] In some embodiments, the microcontroller unit is responsible for detecting the signal of the key input module. When the user presses the key, the microcontroller unit can respond in time and perform corresponding operations, such as switching display interfaces, adjusting parameter settings, etc. At the same time, the microcontroller unit controls the display module to display relevant information, such as real-time data, historical data query results, device status, etc., according to the operating status of the system and user needs, to achieve effective interaction between the user and the device.

[0165] The microcontroller unit interacts with the 4G module, encapsulates and sends the collected data according to a predetermined communication protocol (such as the MQTT protocol), ensuring that the data can be accurately and timely transmitted to the data platform. At the same time, the microcontroller unit communicates with the metering module to obtain rich power parameter information such as voltage signals, current signals, power signals, waveform data, and electric energy data measured by the metering module. These data are important bases for analyzing the operation status of the power system and energy consumption management.

[0166] The microcontroller unit conducts in-depth analysis of the waveform data obtained from the metering module, calculates the harmonic data and fundamental phase angle data through a specific algorithm, and then obtains the voltage and current imbalance data, including positive sequence, negative sequence, neutral line and imbalance data. These analysis results are of great significance for evaluating power quality and discovering potential problems in the power system. In addition, the microcontroller unit is also responsible for statistics on demand and rate power data, providing data support for power billing, energy consumption analysis, etc., to help users better manage power resources and costs.

[0167] In a possible example, in order to better implement the data transmission method in the embodiment of the present application, in addition to the data transmission method, the embodiment of the present application further provides a data transmission device 200, such as Figure 8 As shown, the data transmission device 200 includes:

[0168] The first transmission module 201 is used to obtain device data of a data source device and periodically send the device data to the data platform;

[0169] The flag setting module 202 is used to set the state of the data transmission flag according to the data transmission status of the device data that has not been transmitted in the historical period in each period; the state of the data transmission flag is used to indicate whether the untransmitted device data has been successfully transmitted;

[0170] The flag detection module 203 is used to detect the state of the data transmission flag in the current cycle. When it is detected that the state of the data transmission flag is abnormal and the data source device or the data platform network is abnormal, the untransmitted device data is stored in the target area;

[0171] The second transmission module 204 is used to send the untransmitted device data to the data platform and update the status of the data transmission flag to normal when the data source device and the data platform network are restored.

[0172] The present application also provides a computer device. Fig. 9 , Fig. 9 This is a basic structural block diagram of the computer device in this embodiment.

[0173] The computer device includes a memory 310 and a processor 320 that are connected to each other through a system bus. It should be noted that the figure only shows a computer device with components 310-320, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Sign alProcessor, DSP), embedded devices, etc.

[0174] Computer devices can be computing devices such as desktop computers, notebooks, PDAs, and cloud servers. Computer devices can interact with users through keyboards, mice, remote controls, touch pads, or voice control devices.

[0175] The memory 310 includes at least one type of readable storage medium, and the readable storage medium includes a non-volatile memory (non-volatile memory) or a volatile memory, for example, a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc., and the RAM may include a static RAM or a dynamic RAM. In some embodiments, the memory 310 may be an internal storage unit of a computer device, for example, a hard disk or a memory of the computer device. In other embodiments, the memory 310 may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMediaCard, SMC), a secure digital (SecureDigital, SD) card or a flash card (FlashCard) equipped on the computer device. Of course, the memory 310 may also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory 310 is generally used to store the operating system and various application software installed on the computer device, such as the program code of the above method. In addition, the memory 310 may also be used to temporarily store various types of data that have been output or are to be output. In some embodiments, the memory 310 may also be a register.

[0176] The processor 320 is generally used to perform the overall operation of the computer device. In this embodiment, the memory 310 is used to store program codes or instructions, the program code includes computer operation instructions, and the processor 320 is used to execute the program codes or instructions stored in the memory 310 or process data, such as running the program code of the above method.

[0177] In this article, the bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus system can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0178] Another embodiment of the present application also provides a computer-readable medium, which may be a computer-readable signal medium or a computer-readable medium. A processor in a computer reads a computer-readable program code stored in the computer-readable medium, so that the processor can execute the functional actions specified in each step or a combination of steps in the above method; and generate a device for implementing the functional actions specified in each block or a combination of blocks in the block diagram.

[0179] Computer-readable media include but are not limited to electronic, magnetic, optical, electromagnetic, infrared memory or semiconductor systems, devices or apparatuses, or any appropriate combination of the foregoing, the memory is used to store program codes or instructions, the program codes include computer operating instructions, and the processor is used to execute the program codes or instructions of the above methods stored in the memory.

[0180] For the definitions of memory and processor, please refer to the description of the aforementioned computer device embodiment and will not be repeated here.

[0181] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0182] Each functional unit or module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0183] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.

[0184] In the claims, any reference symbols placed between brackets shall not be construed as limiting the claims. The word "comprising" described in the present application does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application can be implemented with the aid of hardware comprising several different elements and with the aid of a suitably programmed computer. In a unit claim that lists a number of devices, several units of these devices may be embodied by the same hardware item. The use of first, second, and third, etc. does not indicate any order, and these words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.

[0185] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A data transmission method, characterized in that: Applied to a data transmission device, the data transmission device is connected to or built into a data source device, and the method includes: Acquire device data of the data source device, and periodically send the device data to the data platform; The state of the data transmission flag is set according to the data transmission status of the device data that has not been transmitted in the historical cycle in each cycle; the state of the data transmission flag is used to indicate whether the device data that has not been transmitted has been successfully transmitted, and the state of the data transmission flag is normal, indicating that the device data that has not been transmitted has been successfully transmitted, and the state of the data transmission flag is abnormal, indicating that the device data transmission that has not been transmitted has failed; Detecting the state of the data transmission flag in the current cycle, and when detecting that the state of the data transmission flag is abnormal and the data source device or the data platform network is abnormal, storing the untransmitted device data to the target area; When the data source device and the data platform network are restored, the untransmitted device data is sent to the data platform, and the status of the data transmission flag is updated to normal.

2. The data transmission method according to claim 1, characterized in that: The method further comprises: When the data source device or the data platform network is abnormal, performing multiple sending operations on the first device data of the current period to the data platform; If the first device data still fails to be sent at the end of the current cycle, the first device data and the timestamp of the device data are backed up in the data buffer.

3. The data transmission method according to claim 2, characterized in that: The data transmission flag includes a first flag, and the state of the first flag is used to indicate whether the first device data in the data buffer has been transmitted to the data platform; The step of setting the state of the data transmission flag according to the data transmission situation of each cycle includes: detecting a state of the first flag, and when detecting that the state of the first flag is abnormal, sending the first device data to the data platform; detecting a sending status of the first device data, and when detecting that the first device data is successfully sent, inserting the first device data into the data platform according to a timestamp of the first device data, and setting a status of the first flag to a normal status; When it is detected that the first device data fails to be sent, retrying the operation of sending the first device data to the data platform, and if the first device data still fails to be sent at the end of the current cycle, setting the state of the first flag to an abnormal state; If the first device data is sent successfully, the state of the first flag is set to a normal state.

4. The data transmission method according to claim 3, characterized in that: The data transmission flag further includes a second flag, the state of which is used to indicate whether the second device data in the target area has been transmitted to the data platform; The step of setting the state of the data transmission flag according to the data transmission situation of each cycle also includes: detecting a state of the second flag, and when detecting that the state of the second flag is abnormal, sending the second device data to the data platform; When it is detected that the second device data fails to be sent, retrying the operation of sending the second device data to the data platform, and if the second device data still fails to be sent at the end of the current cycle, setting the state of the second flag to an abnormal state; If the second device data is sent successfully, it is detected whether there is second device data that has not been transmitted to the data platform or an extraction operation on the second device data; if so, the state of the second flag is set to an abnormal state; if not, the state of the second flag is set to a normal state.

5. The data transmission method according to claim 4, characterized in that: After detecting that there is second device data that has not been transmitted to the target area, the method further includes: determining a third amount of the second device data that has not been transmitted to the data platform based on a first amount of the total amount of the second device data stored and a second amount of the second device data sent to the data platform; determining a storage location in the target area of ​​each second device data that has not been transmitted to the data platform; Reading the second device data from the storage location, and performing validity verification on the second device data; If the second device data verification passes, the second flag is set to an abnormal state; if the second device data verification fails, whether the storage number of the second device data is greater than the upper limit value of the total storage number is detected; If it is detected that the storage number of the second device data is less than or equal to the upper limit value of the total storage number, the storage number of the second device data is increased by one unit in an ascending manner; if it is detected that the storage number of the second device data is greater than the upper limit value of the total storage number, the storage number of the second device data is set to zero.

6. The data transmission method according to claim 4, characterized in that: After the second device data is successfully sent to the data platform, the method further includes: Increasing the sending number used to record the successful sending of the second device data by one unit in a number-increasing manner, and detecting whether the sending number of the second device data is greater than the upper limit value of the total number of storages; If it is detected that the sending number of the second device data is greater than the upper limit of the total number of storages, the sending number of the second device data is set to zero; if it is detected that the sending number of the second device data is less than or equal to the upper limit of the total number of storages, the sending number of the second device data remains unchanged; The fourth number used to represent the total number of successfully sent second device data is increased by one unit in an increasing manner, and the second flag is set to a normal state.

7. The data transmission method according to claim 1, characterized in that: The storing the untransmitted device data to the target area includes: Obtaining the storage length of the device data; Obtaining a storage location serial number of the device data in the target area; each time a device data is stored in the target area, the storage location serial number increases by one unit; Determine the storage position of the device data in the target area according to the storage length and storage position sequence number of the device data and the preset starting storage position in the target area; The device data is stored in a storage location in the target area.

8. A data transmission device, characterized in that: include: A first transmission module, used for acquiring device data of the data source device and periodically sending the device data to the data platform; A flag setting module is used to set the state of a data transmission flag according to the data transmission status of the device data that has not been transmitted in the historical period in each period; the state of the data transmission flag is used to indicate whether the device data that has not been transmitted has been successfully transmitted, and the state of the data transmission flag is normal, indicating that the device data that has not been transmitted has been successfully transmitted, and the state of the data transmission flag is abnormal, indicating that the device data that has not been transmitted has failed to transmit the data; A flag detection module is used to detect the state of the data transmission flag in the current cycle, and when it is detected that the state of the data transmission flag is abnormal and the data source device or the data platform network is abnormal, the untransmitted device data is stored in the target area; The second transmission module is used to send the untransmitted device data to the data platform and update the status of the data transmission flag to normal when the network between the data source device and the data platform is restored.

9. A computer device, characterized in that: include: Processor and memory; The memory is used to store computer programs; The processor is used to execute the computer program stored in the memory to implement the steps of the data transmission method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: A computer program is stored, and the computer program is loaded by a processor to execute the steps of the data transmission method according to any one of claims 1 to 7.