Data Processing Method, Apparatus, Device, Storage Medium and Program Product

By setting the domain to be calculated in the edge gateway and calculating the data according to preset rules, the performance problem of edge gateways when processing IoT device data is solved, and the effect of reducing computing frequency and saving resources is achieved.

CN119645668BActive Publication Date: 2025-06-13SHANGHAI ENVISION INNOVATION INTELLIGENT TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510176688.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-18
Publication Date
2025-06-13
Estimated Expiration
2045-02-18

AI Technical Summary

Technical Problem

When deploying edge gateways on the edge side of IoT devices, frequent data processing requires high hardware requirements on edge gateways, especially when the hardware level is low, which can easily cause performance problems.

Method used

By setting a domain to be calculated in the edge gateway, after receiving the data group sent by the Internet of Things device, it compares the data identification of the device data in the data group with the data identification of the device data in the domain to be calculated, and performs calculations on the data data in the domain to be calculated according to the preset calculation rules to reduce the calculation frequency.

Benefits of technology

On the premise of ensuring real-time and accuracy of computing, the computing frequency of edge gateways is reduced, resource consumption is saved, and the equipment performance of edge gateways is ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119645668B_ABST
    Figure CN119645668B_ABST
Patent Text Reader

Abstract

This application relates to a data processing method, apparatus, device, storage medium, and program product, and pertains to the field of edge computing technology. The method is executed by an edge gateway in an Internet of Things system, and includes: receiving a data group sent by a first Internet of Things device; traversing at least one piece of device data in the data group in the order of timestamps from earliest to latest; when traversing the first device data in the data group and there is no device data in the to-be-computed domain of the edge gateway that has the same data identifier as the first device data but a different timestamp, adding the first device data to the to-be-computed domain; when traversing the second device data in the data group and there is device data in the to-be-computed domain of the edge gateway that has the same data identifier as the second device data but a different timestamp, performing calculations on each piece of device data in the to-be-computed domain according to a preset calculation rule. This solution can reduce the calculation frequency of the edge gateway.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of edge computing technology, and in particular, to a data processing method, apparatus, device, storage medium, and program product. Background Art

[0002] With the development of Internet of Things technology, more and more devices are connected to the network, and the data of a large number of Internet of Things devices is uploaded to the cloud for processing, which greatly increases the burden of cloud data processing.

[0003] In the related art, an edge gateway can be deployed on the edge side of Internet of Things devices. The Internet of Things devices upload all the data collected by themselves to the edge gateway, and the edge gateway processes the data collected by the Internet of Things devices, and then uploads the processed data to the cloud device.

[0004] However, every time an Internet of Things device uploads data, the edge gateway will trigger a data processing. Frequent data processing requires higher hardware requirements for the edge gateway. If the hardware level of the edge gateway is low, performance problems are likely to occur. Summary of the Invention

[0005] The present application provides a data processing method, apparatus, device, storage medium, and program product. Without affecting the real-time performance of computing, the present solution can reduce the computing frequency of the edge gateway; the technical solution is as follows.

[0006] According to one aspect of the present application, a data processing method is provided, and the method includes:

[0007] Receiving a data group sent by a first Internet of Things device, where the data group includes at least one piece of device data, and the device data has a data identifier and a timestamp;

[0008] Traversing at least one piece of the device data in the data group in the order of the timestamp from first to last;

[0009] When the first device data in the data group is traversed and there is no device data in the to-be-calculated domain of the edge gateway that has the same data identifier as the first device data but a different timestamp, adding the first device data to the to-be-calculated domain;

[0010] When the second device data in the data group is traversed and there is device data in the to-be-calculated domain of the edge gateway that has the same data identifier as the second device data but a different timestamp, performing calculations on each piece of device data in the to-be-calculated domain according to a preset calculation rule.

[0011] According to one aspect of the present application, a data processing apparatus is provided, and the apparatus includes:

[0012] A receiving module, configured to receive a data group sent by a first Internet of Things device, where the data group includes at least one piece of device data; the device data has a data identifier and a timestamp;

[0013] A traversing module, configured to traverse at least one piece of the device data in the data group in the order of the timestamps from the earliest to the latest;

[0014] An adding module, configured to add the first device data to the to-be-calculated domain when the first device data in the data group is traversed and there is no device data in the to-be-calculated domain of the edge gateway that has the same data identifier as the first device data but a different timestamp;

[0015] A calculating module, configured to perform calculations on each piece of device data in the to-be-calculated domain according to a preset calculation rule when the second device data in the data group is traversed and there is device data in the to-be-calculated domain of the edge gateway that has the same data identifier as the second device data but a different timestamp.

[0016] In some embodiments, the calculation rule includes data identifiers of at least two pieces of the device data;

[0017] The calculating module, configured to traverse at least two pieces of the device data in the to-be-calculated domain in the order of the timestamps from the latest to the earliest when the second device data in the data group is traversed and there is device data in the to-be-calculated domain of the edge gateway that has the same data identifier as the second device data but a different timestamp;

[0018] The calculating module, configured to associate the first calculation rule with the third device data when the third device data in the to-be-calculated domain is traversed, the data identifier of the third device data corresponds to a first calculation rule, and there is no device data in the to-be-calculated domain that has been associated with the first calculation rule;

[0019] The calculating module, configured to end the traversal of the third device data when the third device data in the to-be-calculated domain is traversed, the data identifier of the third device data corresponds to a first calculation rule, and there is device data in the to-be-calculated domain that has been associated with the first calculation rule;

[0020] The calculating module, configured to perform calculations on each piece of device data in the to-be-calculated domain according to a preset calculation rule when the traversal of at least two pieces of the device data in the to-be-calculated domain ends.

[0021] In some embodiments, the calculation module is configured to traverse at least two pieces of the device data in the to-be-calculated domain in the order of the timestamps from the earliest to the latest when the traversal of at least two pieces of the device data in the to-be-calculated domain ends;

[0022] The calculation module is configured to add the fourth device data to the real-time library when the fourth device data in the to-be-calculated domain is traversed and the fourth device data is not associated with the calculation rule;

[0023] The calculation module is configured to add the fifth device data to the real-time library when the fifth device data is traversed and the fifth device data is already associated with the second calculation rule; query at least two pieces of device data corresponding to the second calculation rule from the real-time library; perform a calculation on at least two pieces of device data corresponding to the second calculation rule according to the second calculation rule to obtain first calculation data; set the timestamp of the fifth device data to the timestamp of the first calculation data; add the first calculation data to the real-time library.

[0024] In some embodiments, the calculation module is configured to query at least one candidate device data corresponding to the first data identifier in the real-time library; the first data identifier is any one of the data identifiers included in the second calculation rule;

[0025] The calculation module is configured to obtain, as the device data corresponding to the first data identifier among at least two pieces of device data corresponding to the second calculation rule, the candidate device data with the latest corresponding timestamp among at least one candidate device data.

[0026] In some embodiments, the device further includes: a clearing module configured to clear the to-be-calculated domain when the traversal of at least two pieces of the device data in the to-be-calculated domain ends;

[0027] The device further includes: an updating module configured to move the second device data and other device data in the data group whose timestamps are after the timestamp of the second device data to the to-be-calculated domain.

[0028] In some embodiments, a timer is set in the edge gateway; the device further includes: a timing module configured to perform a calculation on each device data in the to-be-calculated domain when the timer times out;

[0029] The timing module is configured to reset the timer after each calculation on each device data in the to-be-calculated domain is completed.

[0030] According to another aspect of the present application, a computer device is provided. The computer device includes a processor and a memory. At least one computer instruction is stored in the memory, and the at least one computer instruction is loaded and executed by the processor to implement the data processing method described in the above aspect.

[0031] According to another aspect of the present application, a computer-readable storage medium is provided. At least one computer instruction is stored in the readable storage medium, and the at least one computer instruction is loaded and executed by a processor to implement the data processing method described in the above aspect.

[0032] According to another aspect of the present application, a computer program product is provided. The computer program product includes computer instructions. The computer instructions are stored in a computer-readable storage medium, and a processor reads and executes the computer instructions from the computer-readable storage medium to implement the data processing method described in the above aspect.

[0033] The technical solutions provided by the embodiments of the present application may include the following beneficial effects:

[0034] A to-be-calculated domain can be set in the edge gateway. After receiving the data group sent by the Internet of Things device, the edge gateway can compare the data identifiers of the device data in the data group with the data identifiers of the device data in the to-be-calculated domain. When the data identifier of the second device data in the data group is the same as the data identifier of a certain device data in the to-be-calculated domain, the device data in the data group whose timestamp is earlier than the timestamp of the second device data is added to the to-be-calculated domain, and calculations are performed on each device data in the to-be-calculated domain; that is to say, the edge gateway can store the device data in the data group sent by the Internet of Things device into the to-be-calculated domain in the order of timestamps from earliest to latest. When it is detected that the Internet of Things device sends a data identifier that is the same as the data identifier of the device data in the to-be-calculated domain, a calculation is performed on the device data in the current to-be-calculated domain, avoiding the situation where two device data in the to-be-calculated domain correspond to the same data identifier. Therefore, on the premise of ensuring the real-time and accuracy of the calculation, this solution can reduce the calculation frequency of the edge gateway to save the resource consumption of the edge gateway and ensure the device performance of the edge gateway. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0036] Figure 1 is a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application;

[0037] Figure 2 is a flowchart of a data processing method provided by an exemplary embodiment of the present application;

[0038] Figure 3 is a flowchart of a data processing method provided by another exemplary embodiment of the present application;

[0039] Figure 4 is an implementation flowchart of a data processing method provided by an exemplary embodiment of the present application;

[0040] Figure 5 is a schematic diagram of a data processing method provided by an exemplary embodiment of the present application;

[0041] Figure 6 is a schematic diagram of traversing device data provided in Embodiment 1 of the present application;

[0042] Figure 7 is a schematic diagram of traversing device data provided in Embodiment 2 of the present application;

[0043] Figure 8 is a block diagram of a data processing device shown by an exemplary embodiment of the present application;

[0044] Figure 9 is a structural block diagram of a computer device provided by an exemplary embodiment of the present application.

[0045] The accompanying drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. Detailed Embodiments

[0046] To make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail in conjunction with the accompanying drawings.

[0047] Here, the exemplary embodiments will be described in detail, and the examples are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0048] The terms used in this disclosure are for the purpose of describing particular embodiments only and are not intended to limit the disclosure. The singular forms "a", "the", and "said" used in this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.

[0049] It should be understood that although terms such as first and second may be used in this disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of this disclosure, the first parameter may also be referred to as the second parameter, and similarly, the second parameter may also be referred to as the first parameter. Depending on the context, the word "if" as used herein may be interpreted as "when" or "while" or "in response to determining".

[0050] The following introduces the noun interpretations related to this application.

[0051] 1) Internet of Things (IoT): It is a network that enables all ordinary objects with independent functions to achieve interconnection and interoperability based on information carriers such as traditional communication networks and the Internet. The Internet of Things combines information technologies such as sensors, smart devices, cloud computing, big data, and artificial intelligence to achieve the interconnection of all things.

[0052] The Internet of Things system consists of four main parts: the perception layer, the network layer, the platform layer (or data layer), and the application layer. Among them, the perception layer is the foundation of the Internet of Things system and is responsible for data collection; the network layer is responsible for transmitting the data collected by the perception layer to the platform layer or the application layer; the platform layer (or data layer) is the core of the Internet of Things system and is responsible for data storage, processing, and analysis; the application layer is the user interface of the Internet of Things system and is responsible for presenting the data processed by the platform layer to users in an easy-to-understand and use manner.

[0053] 2) Edge Computing: On the network edge side close to the data source, through a distributed open platform that integrates network, computing, storage, and application core capabilities, it provides edge intelligent services nearby to meet the key needs of industry digitization in aspects such as agile connection, real-time services, data optimization, application intelligence, security, and privacy protection.

[0054] Please refer to Figure 1 , which shows a schematic diagram of the implementation environment provided by an exemplary embodiment of this application. The implementation environment may include: an Internet of Things device 10, an edge gateway 20, and a cloud device 30.

[0055] With the rapid development of Internet of Things technology, all industries are attempting digital transformation, connecting more and more devices to the network, which means that a huge amount of data from Internet of Things devices 10 is uploaded to the cloud, greatly increasing the processing burden on cloud device 30. The emergence of edge computing solves the problem of difficult cloud processing of data from a huge number of Internet of Things devices 10.

[0056] Specifically, the edge gateway 20 operates on the edge side of the Internet of Things (IoT) device 10 and receives the data sent from the IoT device 10 to the edge gateway 20. After calculating and processing this data, the edge gateway 20 sends the processed data to the cloud device 30.

[0057] The IoT device 10 is a bottom-layer device of the Internet of Things with the ability to collect and report data. It is located in the perception layer of the Internet of Things system and can send the collected device data to the edge gateway 20. Among them, the IoT device 10 includes various sensors and intelligent terminal devices, such as temperature and humidity sensors, light sensors, accelerometers, particle counters, RFID readers, RFID tags, wearable devices, Bluetooth devices, etc. It also includes other types of IoT devices 10, which are not limited in this application.

[0058] In different application scenarios, there are corresponding different IoT devices 10. For example, in the application scenario of the power Internet of Things, the IoT device 10 includes transformers, electric meters, charging piles, temperature controllers, low-voltage main switches, fans, etc. Another example is that in the smart home application scenario, the IoT device 10 includes monitors, smartphones, smart TVs, smart doorbells, smart lights, etc. For another example, in the intelligent transportation application scenario, the IoT device 10 includes traffic lights, power distribution facilities, intelligent vehicles, road cameras, etc.

[0059] The edge gateway 20 is an Internet of Things gateway with edge computing capabilities. It is located in the network layer of the Internet of Things system, connects the IoT device 10 and the cloud device 30, and can realize the analysis and processing of massive IoT device data, as well as send the analyzed and processed data to the cloud device 30. Among them, the edge gateway 20 supports multiple network protocols and can flexibly access various IoT devices 10. For example, the network protocol can be the RS-485 protocol, or the Radio Frequency Identification (RFID) protocol, or the Near Field Communication (NFC) protocol, or other network protocols, which are not limited in this application.

[0060] Optionally, the data or information is transmitted between the cloud device 30 and the edge gateway 20 through the following network protocols: Message Queuing Telemetry Transport (MQTT) protocol, Hypertext Transfer Protocol (HTTP), Constrained Application Protocol (CoAP), or other network protocols, which are not limited in this application.

[0061] The cloud device 30 is a cloud computing platform with the capabilities of data storage, processing, and analysis. It is located in the platform layer of the Internet of Things system and can extract valuable information through technologies such as data mining and machine learning to enable visualization management in the application layer.

[0062] Among them, an edge gateway 20 can receive device data sent by at least one Internet of Things device 10.

[0063] In a data processing solution involved in this application, every time the Internet of Things device 10 uploads data, the edge gateway 20 will trigger a data processing. In the edge computing scenario with relatively low hardware level, performance problems are likely to occur. Based on this, subsequent embodiments of this application provide a new data processing method that can reduce the computing frequency of the edge gateway 20.

[0064] Please refer to Figure 2 , which shows a flowchart of the data processing method provided by an exemplary embodiment of this application. This method is executed by the Figure 1 shown edge gateway 20. As Figure 2 shown, this method may include step 210, step 220, step 230, and step 240.

[0065] Step 210: Receive a data group sent by a first Internet of Things device. The data group contains at least one piece of device data; the device data has a data identifier and a timestamp.

[0066] In the Internet of Things system, one edge gateway 20 corresponds to at least one Internet of Things device 10. That is to say, the edge gateway 20 can receive data groups sent by at least one Internet of Things device 10. In the case where one edge gateway 20 is connected to at least two Internet of Things devices 10, the first Internet of Things device is one of the at least two Internet of Things devices 10.

[0067] In the embodiments of this application, the Internet of Things devices 10 (including the above-mentioned first Internet of Things device) in the Internet of Things system contain one or more data collection points. Each data collection point regularly or irregularly collects its own device data, and the Internet of Things device 10 regularly or irregularly reports the device data collected by each data collection point to the edge gateway 20; optionally, the data identifier of the above-mentioned device data is used to indicate the data collection point corresponding to the device data; that is to say, for the same data collection point, the device data collected at different times has the same data identifier and different timestamps.

[0068] Among them, the above device data is the sensor readings in the first Internet of Things device or the data values generated by other devices. The above data identifier is an identifier used to identify the device data; for example, the data identifier is a device ID, number, or other identifier. The above timestamp is used to record the time when the device data is generated; for example, the timestamp is a value accurate to milliseconds.

[0069] Exemplarily, the first Internet of Things device collects at least one piece of device data, and adds a corresponding data identifier and timestamp to the device data; then, the collected device data is encapsulated into a data group conforming to the network protocol format, and the data group is sent to the edge gateway 20 through the network protocol.

[0070] Specifically, taking the first Internet of Things device as a fan for wind power generation as an example, the data group sent by the fan includes the following device data: wind speed, noise intensity, vibration intensity, etc. Among them, the wind speed corresponds to the measured value of the wind speed sensor, the data identifier of the wind speed is the device number of the wind speed sensor (such as FG1), and the timestamp of the wind speed is the measurement moment corresponding to the measured value of the wind speed sensor; the noise intensity corresponds to the measured value measured by the sound level meter, the data identifier of the noise intensity is the device number of the sound level meter (such as SJ1), and the timestamp of the noise intensity is the measurement moment corresponding to the measured value measured by the sound level meter; the vibration intensity corresponds to the measured value of the vibration sensor, the data identifier of the vibration intensity is the device number of the vibration sensor (such as ZG1), and the timestamp of the vibration intensity is the measurement moment corresponding to the measured value of the vibration sensor.

[0071] In the embodiment of the present application, after the edge gateway 20 receives the data group sent by the first Internet of Things device, it parses the data group to obtain the device data, as well as the data identifier and timestamp corresponding to the device data.

[0072] Optionally, the edge gateway 20 corresponds to at least one Internet of Things device 10, and at different times, sends a data group containing at least one piece of device data to the edge gateway 20. The data identifiers of the device data in the data group two sent at the next moment are the same as, different from, or partially the same as the data identifiers of the device data in the data group one sent at the previous moment.

[0073] Step 220: Traverse at least one piece of device data in the data group in the order of the timestamps from the earliest to the latest.

[0074] In the embodiment of the present application, the edge gateway 20 traverses the data identifiers corresponding to at least one piece of device data in the data group according to the timestamps corresponding to the device data, and manages the at least one piece of device data in the data group in an orderly manner, which can ensure the timeliness and consistency of the device data, so as to facilitate subsequent analysis and processing.

[0075] Exemplarily, an input domain is set in the edge gateway 20 for storing at least one piece of device data sent by the first Internet of Things device received at the current moment. Accordingly, the edge gateway 20 stores at least one piece of device data sent by the first Internet of Things device in the input domain in the order of the timestamps from the earliest to the latest. After that, the edge gateway 20 starts traversing from the device data with the earliest timestamp.

[0076] Step 230: When traversing to the first device data in the data group and there is no device data in the to-be-calculated domain of the edge gateway 20 that has the same data identifier as the first device data but a different timestamp, add the first device data to the to-be-calculated domain.

[0077] That is to say, when the edge gateway 20 traverses to the first device data in the data group that meets the specified condition, add the device data to the to-be-calculated domain. The specified condition is that the data identifier of the first device data is the same as the data identifier of a certain device data in the to-be-calculated domain.

[0078] Among them, the to-be-calculated domain of the edge gateway 20 is where the edge gateway 20 stores at least one piece of device data in the data group sent by the first Internet of Things device or other Internet of Things devices 10 received before the current moment.

[0079] Step 240: When traversing to the second device data in the data group and there is device data in the to-be-calculated domain of the edge gateway 20 that has the same data identifier as the second device data but a different timestamp, perform calculations on each device data in the to-be-calculated domain according to a preset calculation rule.

[0080] That is to say, when the edge gateway 20 traverses to the device data in the data group that does not meet the specified condition, stop traversing and start performing calculations on each device data in the to-be-calculated domain.

[0081] Among them, taking the data identifier of the second device data as number n as an example, the existence of device data in the to-be-calculated domain of the above-mentioned edge gateway 20 that has the same data identifier as the second device data but a different timestamp means that there is already device data with the data identifier of number n stored in the to-be-calculated domain. That is to say, before the first Internet of Things device sends the data group containing the second device data, it has already sent a data group containing device data with number n, and the previously sent device data with number n has not been calculated yet; at this time, if the newly received device data with number n is directly put into the to-be-calculated domain, there will be two or more device data with the same number during subsequent calculations, resulting in calculation errors. To ensure the real-time nature of the calculation and avoid errors during subsequent calculations, at this time, before putting the newly received device data with number n into the to-be-calculated domain, perform calculations on each device data in the to-be-calculated domain first.

[0082] In some embodiments, before the above step 220, the edge gateway 20 may query whether device data is stored in the current domain to be calculated. When there is at least one piece of device data stored in the current domain to be calculated, steps 220 to 240 are executed. When there is no stored device data in the current domain to be calculated, the edge gateway 20 adds at least one piece of device data in the data group received in step 210 to the domain to be calculated.

[0083] In summary, in the solution shown in the embodiments of the present application, a domain to be calculated can be set in the edge gateway 20. After receiving the data group sent by the Internet of Things device 10, the edge gateway 20 can compare the data identifiers of the device data in the data group with the data identifiers of the device data in the domain to be calculated. When the data identifier of the second device data in the data group is the same as the data identifier of a certain device data in the domain to be calculated, the device data in the data group with a timestamp earlier than the timestamp of the second device data is added to the domain to be calculated, and calculations are performed on each device data in the domain to be calculated; that is, the edge gateway 20 can store the device data in the data group sent by the Internet of Things device 10 in the domain to be calculated in the order of the timestamps from earliest to latest. When it is detected that the Internet of Things device 10 has sent a data identifier that is the same as the data identifier of the device data in the domain to be calculated, a calculation is performed on the device data in the current domain to be calculated, avoiding the situation where two device data in the domain to be calculated correspond to the same data identifier. Therefore, on the premise of ensuring the real-time and accurate calculation, this solution can reduce the calculation frequency of the edge gateway 20 to save the resource consumption of the edge gateway 20 and ensure the device performance of the edge gateway 20.

[0084] Based on the above Figure 2 In a possible implementation of the solution in the shown embodiment, the calculation rule includes the data identifiers of at least two pieces of device data.

[0085] Among them, the edge gateway 20 pre-stores calculation rules related to at least one corresponding Internet of Things device 10.

[0086] For example, based on the above example where the first Internet of Things device is a wind turbine for wind power generation, the calculation rules are: output value a = FG1 + SJ1, or: output value b = SJ1 × ZG1 - FG1. When the edge gateway 20 performs calculations, the device data corresponding to the data identifier is substituted into the calculation rule for calculation.

[0087] Optionally, after the cloud device 30 establishes the calculation rules, it screens the calculation rules related to the edge gateway 20 and sends the calculation rules to the edge gateway 20; correspondingly, the edge gateway 20 receives and stores the calculation rules sent by the cloud device 30.

[0088] The above step 240 can be implemented as step 240a, step 240b, step 240c, and step 240d.

[0089] Step 240a: When traversing the second device data in the data group and there is device data in the calculation domain of the edge gateway 20 that has the same data identifier as the second device data but a different timestamp, traverse at least two pieces of device data in the calculation domain in the order from the latest to the earliest timestamp.

[0090] In the embodiment of the present application, the edge gateway 20 traverses the data identifiers corresponding to at least two pieces of device data in the calculation domain according to the timestamps corresponding to the device data, and manages the at least two pieces of device data in the calculation domain in an orderly manner, which can ensure the timing and consistency of the device data, facilitating subsequent analysis and processing.

[0091] Exemplarily, the edge gateway 20 starts traversing from the device data with the latest timestamp and queries whether there is a calculation rule corresponding to the data identifier of the current device data.

[0092] Step 240b: When traversing the third device data in the calculation domain, and the data identifier of the third device data corresponds to a first calculation rule, and there is no device data in the calculation domain that has been associated with the first calculation rule, associate the first calculation rule with the third device data.

[0093] Among them, the data identifier of the above third device data corresponding to a first calculation rule means that the first calculation rule contains the data identifier of the third device data; there is no device data in the above calculation domain that has been associated with the first calculation rule means that the first calculation rule has not been associated with a certain device data in the calculation domain; at this time, the edge gateway 20 associates the first calculation rule with the third device data for subsequent calculation.

[0094] Step 240c: When traversing the third device data, and the data identifier of the third device data corresponds to a first calculation rule, and there is device data in the calculation domain that has been associated with the first calculation rule, end the traversal of the third device data.

[0095] Among them, there is device data in the above calculation domain that has been associated with the first calculation rule means that the first calculation rule has been associated with a certain device data in the calculation domain; at this time, the edge gateway 20 ends the traversal of the third device data and continues to traverse the next device data.

[0096] Step 240d: When the traversal of at least two pieces of device data in the calculation domain ends, perform calculations on each piece of device data in the calculation domain according to a preset calculation rule.

[0097] After querying the calculation rules corresponding to at least two pieces of device data in the to-be-calculated domain, the edge gateway 20 performs calculations on at least two pieces of device data in the to-be-calculated domain according to calculation rules such as the first calculation rule, and obtains the output result corresponding to each calculation rule.

[0098] Since the calculation rules contain data identifiers of at least two pieces of device data, in the embodiments of the present application, through the orderly management of at least two pieces of device data in the to-be-calculated domain, duplicate calculation rules can be filtered out before performing calculations on each piece of device data in the to-be-calculated domain, avoiding duplicate calculations of the same calculation rule, saving the resource consumption of the edge gateway 20, and improving the calculation efficiency of the edge gateway 20.

[0099] Based on the solutions shown in the above embodiments of the present application, in a possible implementation solution, the above step 240d may be implemented as step 240d1, step 240d2, and step 240d3.

[0100] Step 240d1: When the traversal of at least two pieces of device data in the to-be-calculated domain ends, traverse at least two pieces of device data in the to-be-calculated domain in the order of time stamps from earliest to latest.

[0101] In the embodiments of the present application, the edge gateway 20 traverses the calculation rules corresponding to at least two pieces of device data in the to-be-calculated domain according to the time stamps corresponding to the device data, and performs orderly management on at least two pieces of device data in the to-be-calculated domain, which can ensure the timing and consistency of the device data for subsequent analysis and processing.

[0102] Step 240d2: When the fourth device data in the to-be-calculated domain is traversed and the fourth device data is not associated with a calculation rule, add the fourth device data to the real-time library.

[0103] Among them, the above real-time library is a piece of memory opened by the edge gateway 20 in the process, and is used to store the device data in the data group sent by the Internet of Things device 10, as well as the calculation data of the edge gateway 20.

[0104] Optionally, the edge gateway 20 sends the device data and calculation data in the real-time library to the cloud device 30 in real time, or the edge gateway 20 sends the device data and calculation data in the real-time library to the cloud device 30 according to a specified period, so that the cloud device 30 can process and apply the device data and calculation data.

[0105] Among them, the above fourth device data is not associated with a calculation rule, which may be that the fourth device data does not have a calculation rule; it may also be that the calculation rule of the fourth device data is associated with the device data with a later time stamp. To avoid duplicate calculations, at this time, the edge gateway 20 does not perform calculations on the fourth device data and adds the fourth device data to the real-time library.

[0106] Step 240d3: When the fifth device data is traversed and the fifth device data is already associated with the second calculation rule, add the fifth device data to the real-time library; query at least two pieces of device data corresponding to the second calculation rule from the real-time library; perform calculations on at least two pieces of device data corresponding to the second calculation rule according to the second calculation rule to obtain the first calculation data; set the time stamp of the fifth device data to the time stamp of the first calculation data; add the first calculation data to the real-time library.

[0107] Among them, the above-mentioned fifth device data being already associated with the second calculation rule means that the fifth device data corresponds to the second calculation rule. Since the second calculation rule also includes data identifiers of at least one other piece of device data, before performing calculations according to the second calculation rule, the edge gateway 20 can query the device data corresponding to other device identifiers in the second calculation rule.

[0108] Since in the process of associating the calculation rules above, that is, in the above steps 240a and 240b, the edge gateway 20 traverses at least two pieces of device data in the to-be-calculated domain in the order of time stamps from the latest to the earliest, while in the process of performing calculations, the edge gateway 20 traverses at least two pieces of device data in the to-be-calculated domain in the order of time stamps from the earliest to the latest. Therefore, the time stamps of the device data corresponding to other device identifiers in the second calculation rule are earlier than the time stamp of the fifth device data, and the corresponding device data has been stored in the real-time library. That is to say, the time stamp of the fifth device data is the latest time stamp among the time stamps of at least two pieces of device data corresponding to the second calculation rule, and the edge gateway 20 can query the device data corresponding to other device identifiers in the second calculation rule in the real-time library.

[0109] After querying the device data corresponding to other device identifiers in the second calculation rule, the edge gateway 20 substitutes the fifth device data and the device data corresponding to other device identifiers into the second calculation rule to obtain the first calculation data. Then, the edge gateway 20 determines the time stamp of the fifth device data as the time stamp of the first calculation data and adds the first calculation data to the real-time library.

[0110] In the embodiment of the present application, after querying the relevant calculation rules in the order of time stamps from the latest to the earliest, the edge gateway 20 can perform calculations on each piece of device data in the to-be-calculated domain according to the queried calculation rules in the order of time stamps from the earliest to the latest, which can not only avoid repeated calculations for the same calculation rule, but also add device data and calculation data to the real-time library according to time stamps. On the premise of ensuring the timeliness of the data in the real-time library, it realizes edge calculation and data storage into the library simultaneously, thereby improving the calculation efficiency of the edge gateway 20.

[0111] Based on the solutions shown in the above embodiments of the present application, in a possible implementation, querying at least two pieces of device data corresponding to the second calculation rule from the real-time library in step 240d3 can be implemented as follows:

[0112] Query at least one candidate device data corresponding to the first data identifier in the real-time library; the first data identifier is any one of the data identifiers included in the second calculation rule;

[0113] Among at least one candidate device data, obtain the candidate device data with the latest timestamp as the device data corresponding to the first data identifier among at least two pieces of device data corresponding to the second calculation rule.

[0114] In the embodiments of the present application, the edge gateway 20 obtains at least one data identifier included in the second calculation rule according to the second calculation rule; then, the edge gateway 20 queries the device data corresponding to the at least one data identifier in the real-time library.

[0115] Among them, since the real-time library stores the device data in the data groups sent by the first Internet of Things device and other Internet of Things devices 10 before, therefore, one data identifier may correspond to only one candidate device data in the real-time library, or may correspond to at least two candidate device data with different timestamps.

[0116] Correspondingly, when a certain data identifier in the second calculation rule corresponds to at least two candidate device data, the edge gateway 20 determines the candidate device data with the latest timestamp as the device data corresponding to the data identifier.

[0117] Among them, the candidate device data with the latest timestamp refers to that the candidate device data is the latest device data among at least two candidate device data corresponding to the data identifier. By querying the latest device data in the real-time library in the embodiments of the present application, it is possible to avoid calculating the historical device data of the same data identifier, improve the accuracy of the edge gateway 20 in selecting the device data participating in the rule calculation, and further improve the calculation efficiency of the edge gateway 20, avoid unnecessary calculation processes, and save the resource consumption of the edge gateway 20.

[0118] Based on the solutions shown in the above embodiments, in a possible implementation, the above method further includes:

[0119] When the traversal of at least two pieces of device data in the domain to be calculated ends, clear the domain to be calculated;

[0120] Move the second device data and other device data in the data group whose timestamps are after the timestamp of the second device data to the domain to be calculated.

[0121] Among them, when the traversal of at least two pieces of device data in the above-mentioned domain to be calculated ends, it means that each piece of device data in the domain to be calculated has been added to the real-time library. At this time, in order to save the storage space of the domain to be calculated and to avoid the appearance of different device data with the same data identifier in the domain to be calculated during the subsequent addition of new device data to the domain to be calculated, the edge gateway 20 clears each piece of device data in the domain to be calculated.

[0122] Among them, the above-mentioned second device data and other device data in the data group whose timestamps are after the timestamp of the second device data refer to the device data that has not been added to the domain to be calculated in steps 220 and 230.

[0123] In the embodiment of the present application, the edge gateway 20 clears the domain to be calculated and moves the second device data and other device data in the data group whose timestamps are after the timestamp of the second device data into the domain to be calculated, which can realize the orderly management of the device data sent by the Internet of Things device 10, and perform the calculation processing of the device data on the premise of ensuring the timeliness of the device data.

[0124] Based on the solutions shown in the above embodiments, a timer is provided in the edge gateway 20.

[0125] Among them, the above-mentioned timer is a hardware component or a software component, which is used to trigger a calculation of each piece of device data in the domain to be calculated after a preset time interval.

[0126] Exemplarily, when adding device data to the domain to be calculated, the edge gateway 20 starts the above-mentioned timer, which can record the storage time of the device data in the domain to be calculated.

[0127] Please refer to Figure 3 , which shows a flowchart of a data processing method provided by another exemplary embodiment of the present application. As Figure 3 shown, the above method further includes step 250 and step 260.

[0128] Step 250: When the timer times out, perform a calculation on each piece of device data in the domain to be calculated.

[0129] Based on the above step 240, the embodiment of the present application shows another trigger condition for the edge gateway 20 to perform a calculation on each piece of device data in the domain to be calculated, that is, the timer times out.

[0130] Among them, the above-mentioned timer timeout means that the timer reaches a preset time interval.

[0131] Optionally, the preset time interval of the timer is 100 ms, 150 ms, 200 ms, 300 ms or other time intervals, and the embodiment of the present application does not limit this.

[0132] Among them, the execution process of performing calculations on each device data in the domain to be calculated is the same as the execution process of performing calculations on each device data in the domain to be calculated in step 240 above, and the present application will not elaborate here.

[0133] Step 260: After each calculation of each device data in the domain to be calculated is completed, reset the timer.

[0134] Among them, the above-mentioned resetting of the timer refers to the edge gateway 20 resetting the time interval of the timer to make the timer start timing again.

[0135] Since after the calculation of each device data in the domain to be calculated is completed, the edge gateway 20 clears the domain to be calculated, therefore, in order to re-record the interval duration of the calculation of each device data in the domain to be calculated, the edge gateway 20 resets the timer.

[0136] By setting the timer, the embodiment of the present application controls the interval duration of performing calculations on each device data in the domain to be calculated within a reasonable range, avoiding affecting the real-time performance of the calculation.

[0137] Based on the solutions shown in the above-mentioned various embodiments of the present application, please refer to Figure 4 , which shows the implementation flowchart of the data processing method provided by an exemplary embodiment of the present application. As Figure 4 shown, the edge gateway 20 is provided with a domain to be calculated and a timer, and at least one device data in the data group sent by the Internet of Things device 10 to the edge gateway 20 is stored in the domain to be calculated. Figure 4 The steps in are executed by the edge gateway 20, and specifically include the following steps.

[0138] Step 401: Determine whether the timer has timed out.

[0139] If so, execute step 406; otherwise, execute step 402.

[0140] Step 402: Receive the data group sent by the first Internet of Things device and store it in the input domain.

[0141] Among them, the data group contains at least one device data; the device data has a data identifier and a timestamp.

[0142] Step 403: Traverse at least one device data in the input domain in the order of the timestamp from the earliest to the latest.

[0143] Step 404: Determine whether the device data traversed is the same in data identifier but different in timestamp from the device data in the domain to be calculated.

[0144] If so, execute step 406; otherwise, execute step 405.

[0145] Step 405: Add the traversed device data to the domain to be calculated. Then, continue to traverse the next device data.

[0146] Step 406: In the case of timer timeout, traverse at least two pieces of device data in the domain to be calculated in the order from the latest to the earliest timestamp.

[0147] Step 407: Determine whether the traversed device data corresponds to a first calculation rule.

[0148] If so, execute Step 408; otherwise, continue to traverse the next device data.

[0149] Step 408: Determine whether there is device data associated with the first calculation rule in the domain to be calculated. If so, continue to traverse the next device data; otherwise, execute Step 409.

[0150] Step 409: Associate the first calculation rule with the traversed device data.

[0151] Step 410: Determine whether the traversal is over.

[0152] If so, execute Step 411; otherwise, continue to traverse.

[0153] Step 411: Traverse at least two pieces of device data in the domain to be calculated in the order from the earliest to the latest timestamp.

[0154] Step 412: Add the traversed device data to the real-time library.

[0155] Step 413: Determine whether the traversed device data is associated with a calculation rule.

[0156] If so, execute Step 414; otherwise, execute Step 412 to continue traversing.

[0157] Step 414: Obtain the first calculation data, and set the timestamp of the traversed device data as the timestamp of the first calculation data.

[0158] Step 415: Add the first calculation data to the real-time library.

[0159] Among them, the execution manners of Steps 401 to 415 are the same as those of the above various embodiments of the present application, and will not be elaborated here.

[0160] Please refer to Figure 5 which shows a schematic diagram of the data processing method provided by an exemplary embodiment of the present application. As Figure 5As shown, the Internet of Things devices 10 connected to the edge gateway 20 are Internet of Things device A, Internet of Things device B, Internet of Things device C, and other Internet of Things devices 10 (not shown in the figure).

[0161] Among them, the edge gateway 20 establishes an MQTT connection with the configuration center in the cloud. After the configuration center in the cloud builds the calculation rules, it packages all the configuration information related to the edge gateway 20 through the MQTT connection and sends it to the edge gateway 20; correspondingly, the edge gateway 20 receives the resource package sent by the cloud through the MQTT connection and extracts the calculation rules after parsing the resource package.

[0162] Internet of Things device A, Internet of Things device B, and Internet of Things device C can respectively send data groups containing at least one device data to the edge gateway 20 at different times. Exemplarily, the data group sent by Internet of Things device A contains three device data, namely a_in1(X 1 ms), a_in2(X 2 ms), a_in3(X 3 ms), where a_in1, a_in2, and a_in3 respectively correspond to the data identifiers of the three device data, and X 1 ms, X 2 ms, X 3 ms respectively correspond to the timestamps of the three device data. The data group sent by Internet of Things device B contains three device data, namely b_in1(Y 1 ms), b_in2(Y 2 ms), b_in3(Y 3 ms). The data group sent by Internet of Things device C contains three device data, namely c_in1(Z 1 ms), c_in2(Z 2 ms), c_in3(Z 3 ms).

[0163] In the embodiment of the present application, after the edge gateway 20 receives the data group sent by Internet of Things device A, Internet of Things device B, Internet of Things device C, or other Internet of Things devices 10, it will first perform packet aggregation.

[0164] Specifically, the edge gateway 20 stores at least one device data in the data group received in the input domain. Since different Internet of Things devices 10 can send data groups to the edge gateway 20 at different times, the device data received by the edge gateway 20 is usually out of order. Correspondingly, the edge gateway 20 traverses each device data in the input domain in the order of the timestamps from the earliest to the latest in the input domain.

[0165] Secondly, during the packet aggregation process, if the edge gateway 20 discovers device data (i.e., duplicate points) with the same data identifier but different timestamps in the input domain and the domain to be calculated, such as device data one (i.e., the above-mentioned second device data), it will immediately trigger the edge gateway 20 to calculate each device data in the domain to be calculated and reset the packet aggregation timer.

[0166] Specifically, the edge gateway 20 extracts the device data in the input domain whose timestamp is earlier than that of device data one and orderly moves this device data to the domain to be calculated; then, the edge gateway 20 executes calculations on each device data in the domain to be calculated according to the calculation rules sent by the cloud.

[0167] In addition, during the packet aggregation process, if the packet aggregation timer times out, it will trigger the edge gateway 20 to calculate each device data in the domain to be calculated.

[0168] In addition, in the case where no duplicate points are found within a packet aggregation period but the packet aggregation timer times out, it will also trigger the edge gateway 20 to calculate each device data in the domain to be calculated.

[0169] During the process of the edge gateway 20 calculating each device data in the domain to be calculated, to avoid repeated calculations, first, through merge sort, each device data in the domain to be calculated is merged into a total ordered device data, and then traversed in reverse order according to the timestamps of the device data to find all the required calculation rules.

[0170] To ensure the orderly output of device data to the real-time library, traverse according to the timestamp order of the device data, and adopt the method of calculating and storing into the library at the same time to ensure that the device data and the calculation data obtained from the calculation rules are stored into the library in the order of timestamps.

[0171] Embodiment 1

[0172] The IoT device A sends the first data group one to the edge gateway 20 at the moment of 110 ms. This data group one contains device data a_in1 (100 ms), device data a_in2 (105 ms), and device data a_in3 (110 ms). At this time, there is no other device data stored in the domain to be calculated, so each device data in the data group one is directly put into the domain to be calculated. When the packet aggregation timer times out and the edge gateway 20 does not receive other data groups, the edge gateway 20 arranges all the device data in the domain to be calculated into a queue in ascending order according to the timestamps and traverses from the tail of the queue forward to obtain the corresponding calculation rules. Among them, calculation rule one: a_out1 = a_in1 + a_in2.

[0173] Please refer to Figure 6 , which shows a schematic diagram of traversing device data provided by Embodiment 1 of the present application. AsFigure 6 As shown in the figure, first, the edge gateway 20 traverses a_in3 (110 ms) and finds that there is no corresponding calculation rule, so it is ignored. The edge gateway 20 traverses to a_in2 (105 ms) and finds a corresponding calculation rule 1, and hangs the calculation rule 1 after the point a_in2 (105 ms). The edge gateway 20 traverses to a_in1 (100 ms) and finds a corresponding calculation rule 1, but at this time the calculation rule 1 already exists, so it is ignored.

[0174] Secondly, after the edge gateway 20 obtains the calculation rule, it traverses all device data from the head of the queue and executes the calculation. The entire calculation process is as follows:

[0175] a_in1 (100 ms) is put into the real-time database;

[0176] a_in2 (105 ms) is put into the real-time database;

[0177] According to calculation rule 1, retrieve the latest device data section a_in1 (100 ms) and a_in2 (105 ms) from the real-time database, obtain the calculation data a_out1, stamp it with the time stamp 105 ms, and put a_out1 (105 ms) into the real-time database;

[0178] a_in3 (110 ms) is put into the real-time database.

[0179] After the above calculation process is completed, the edge gateway 20 clears each device data in the domain to be calculated and resets the packet aggregation timer.

[0180] At this time, the device data a_in1 (100 ms), a_in2 (105 ms), a_out1 (105 ms), and a_in3 (110 ms) already exist in the real-time database.

[0181] Subsequently, the Internet of Things device A sends the first data group 2 to the edge gateway 20 at the moment of 500 ms. This data group 2 contains the device data a_in1 (500 ms), the device data a_in2 (505 ms), and the device data a_in3 (510 ms). At this time, there is no other device data stored in the domain to be calculated, so the device data in the data group 2 is directly put into the domain to be calculated. When the packet aggregation timer times out and the edge gateway 20 does not receive other data groups, the edge gateway 20 arranges all the device data in the domain to be calculated into a queue in ascending order of time stamp, traverses from the tail of the queue forward, and obtains the corresponding calculation rule. Among them, calculation rule 1: a_out1 = a_in1 + a_in2.

[0182] First, the edge gateway 20 traverses a_in3 (510ms) and finds no corresponding calculation rule, so it is ignored. The edge gateway 20 traverses to a_in2 (505ms) and finds the corresponding calculation rule 1, and hangs the calculation rule 1 after the point a_in2 (505ms). The edge gateway 20 traverses to a_in1 (500ms) and finds the corresponding calculation rule 1, but at this time the calculation rule 1 already exists, so it is ignored.

[0183] Secondly, after the edge gateway 20 obtains the calculation rule, it traverses all device data from the head of the queue and performs calculations. The entire calculation process is as follows:

[0184] a_in1 (500ms) is put into the real-time database;

[0185] a_in2 (505ms) is put into the real-time database;

[0186] According to calculation rule 1, retrieve the latest device data section a_in1 (500ms) and a_in2 (505ms) from the real-time database to obtain the calculation data a_out1, stamp the time 505ms, and put a_out1 (505ms) into the real-time database;

[0187] a_in3 (510ms) is put into the real-time database.

[0188] After the above calculation process is completed, the edge gateway 20 clears each device data in the domain to be calculated and resets the packet aggregation timer.

[0189] At this time, the device data a_in1 (100ms), a_in2 (105ms), a_out1 (105ms), a_in3 (110ms), a_in1 (500ms), a_in2 (505ms), a_out1 (505ms), and a_in3 (510ms) already exist in the real-time database.

[0190] Embodiment 2

[0191] The device data c_in3 (100ms) already exists in the real-time database. At this time, the Internet of Things device A collects and uploads a data group 3, which includes the device data a_in2 (105ms), the device data a_in3 (115ms), the device data a_in1 (200ms), the device data a_in2 (205ms), and the device data a_in3 (210ms). At the same time, in the domain to be calculated, there is already a_in1 (100ms) of the Internet of Things device A, b_in1 (110ms), b_in2 (120ms), b_in3 (130ms) of the Internet of Things device B, and c_in1 (125ms), c_in2 (135ms) of the Internet of Things device C.

[0192] Please refer to Figure 7 , which shows a schematic diagram of traversing device data provided in the second embodiment of the present application. As Figure 7 shown, first, the device data traverses a_in2 (105 ms) and a_in3 (115 ms), and finds that there is no corresponding calculation rule, so it is ignored; when the edge gateway 20 traverses to a_in1 (200 ms), it finds that there is already device data a_in1 (100 ms) with the same data identifier in the to-be-calculated domain. Then, the device data a_in2 (105 ms) and a_in3 (115 ms) before a_in1 (200 ms) are put into the to-be-calculated domain and a calculation is performed once, and the device data a_in2 (205 ms) and a_in3 (210 ms) after a_in1 (200 ms) are suspended and stored in the input domain, waiting for the next traversal.

[0193] Secondly, all the device data in the to-be-calculated domain is arranged in a queue in ascending order of time stamps. The time complexity of this step is O(n log(k)), where k represents the number of devices participating in the calculation. The edge gateway 20 traverses from the tail of the queue forward to obtain the corresponding calculation rules. Among them, calculation rule two: b_out1 = a_in3 + b_in1; calculation rule three: b_out2 = a_in1 * b_in2; calculation rule four: c_out1 = a_in2 + b_in3 + c_in2 - c_in3; calculation rule five: c_out2 = c_in1 / c_in2.

[0194] Then, when the edge gateway 20 traverses to c_in2 (135 ms), it finds that there are corresponding calculation rules four and five, and hangs calculation rules four and five after point c_in2 (135 ms); when traversing to b_in3 (130 ms), it finds that there is a corresponding calculation rule four, but at this time calculation rule four already exists, so it is ignored; when the edge gateway 20 traverses to c_in1 (125 ms), it finds that there is a corresponding calculation rule five, but at this time calculation rule five already exists, so it is ignored; when the edge gateway 20 traverses to b_in2 (120 ms), it finds that there is a corresponding calculation rule three, and hangs calculation rule three after point b_in2 (120 ms); when the edge gateway 20 traverses to a_in3 (115 ms), it finds that there is a corresponding calculation rule two, and hangs calculation rule two after point a_in3 (115 ms); when the edge gateway 20 traverses to b_in1 (110 ms), it finds that there is a corresponding calculation rule two, but at this time calculation rule two already exists, so it is ignored; when the edge gateway 20 traverses to a_in2 (105 ms), it finds that there is a corresponding calculation rule four, but at this time calculation rule four already exists, so it is ignored; when the edge gateway 20 traverses to a_in1 (100 ms), it finds that there is a corresponding calculation rule three, but at this time calculation rule three already exists, so it is ignored.

[0195] After the edge gateway 20 obtains the calculation rules, it traverses all device data from the head of the queue and performs calculations. The entire calculation process is as follows:

[0196] a_in1 (100ms) is put into the real-time database;

[0197] a_in2 (105ms) is put into the real-time database;

[0198] b_in1 (110ms) is put into the real-time database;

[0199] a_in3 (115ms) is put into the real-time database;

[0200] According to calculation rule two, retrieve the latest input data section b_in1 (110ms) and a_in3 (115ms) from the real-time database to obtain the calculation data b_out1, stamp the time as 115ms, and put b_out1 (115ms) into the real-time database;

[0201] b_in2 (120ms) is put into the real-time database;

[0202] According to calculation rule three, retrieve the latest input data section a_in1 (100ms) and b_in2 (120ms) from the real-time database to obtain the calculation data b_out2, stamp the time as 120ms, and put b_out2 (120ms) into the real-time database;

[0203] c_in1 (125ms) is put into the real-time database;

[0204] b_in3 (130ms) is put into the real-time database;

[0205] c_in2 (135ms) is put into the real-time database;

[0206] According to calculation rule four, retrieve the latest input data section a_in2 (105ms), b_in3 (130ms), c_in2 (135ms) and c_in3 (100ms) from the real-time database to obtain the calculation data c_out1, stamp the time as 135ms, and put c_out1 (135ms) into the real-time database;

[0207] According to calculation rule five, retrieve the latest input data section c_in1 (125ms) and c_in2 (135ms) from the real-time database to obtain the calculation data c_out2, stamp the time as 135ms, and put c_out2 (135ms) into the real-time database.

[0208] After the above calculation process is completed, the edge gateway 20 clears the device data in the to-be-calculated domain and resets the packet aggregation timer.

[0209] At this time, the device data c_in3(100ms), a_in1(100ms), a_in2(105ms), b_in1(110ms), a_in3(115ms), b_out1(115ms), b_in2(120ms), b_out2(120ms), c_in1(125ms), b_in3(130ms), c_in2(135ms), c_out1(135ms), and c_out2(135ms) already exist in the real-time database.

[0210] It should be noted that the edge gateway 20 can send the ordered device data and computing data in the real-time database to the cloud in real time for the cloud to process and apply the device data and computing data.

[0211] In summary, this method can be widely applied to scenarios that require quick response and instant insight. For example, in the common power merging of meter branches, after the power of multiple branches is reported at the branch collection point, the total power of multiple branches needs to be aggregated and reported. Another example is in the integrated scenario of photovoltaic energy storage and charging. By reading the working status and total active power, it is determined whether the energy storage system is charging or discharging at present. Another example is that after installing a particle counter in a laboratory with dust-free requirements, it is necessary to perform a periodic averaging operation on the reported values of the counter to achieve real-time monitoring of the number of particles. Another example is when a wind turbine generates electricity, the real-time power generation power of the wind turbine is calculated through the wind speed, blade radius, and power coefficient.

[0212] Please refer to Figure 8 , which shows the block diagram of a data processing device shown in an exemplary embodiment of the present application. This device can be used to execute all or part of the steps performed by a computer device as shown in Figure 2 or Figure 3 shown in the method. As shown in Figure 8 , this device includes:

[0213] A receiving module 801, configured to receive a data group sent by a first Internet of Things device. The data group contains at least one piece of device data; the device data has a data identifier and a timestamp;

[0214] A traversing module 802, configured to traverse at least one piece of device data in the data group in the order of the timestamp from first to last;

[0215] An adding module 803, configured to add the first device data to the domain to be calculated when the first device data in the data group is traversed and there is no device data in the domain to be calculated of the edge gateway 20 that has the same data identifier as the first device data but a different timestamp;

[0216] A calculation module 804, configured to, when traversing to second device data in a data group and there is device data in the calculation domain to be calculated of the edge gateway 20 that has the same data identifier as the second device data but a different timestamp, perform calculations on each piece of device data in the calculation domain to be calculated according to a preset calculation rule.

[0217] In some embodiments, the calculation rule includes data identifiers of at least two pieces of device data;

[0218] A calculation module 804, configured to, when traversing to second device data in a data group and there is device data in the calculation domain to be calculated of the edge gateway 20 that has the same data identifier as the second device data but a different timestamp, traverse at least two pieces of device data in the calculation domain to be calculated in the order from the latest to the earliest timestamp;

[0219] A calculation module 804, configured to, when traversing to third device data in the calculation domain to be calculated, and the data identifier of the third device data corresponds to a first calculation rule and there is no device data associated with the first calculation rule in the calculation domain to be calculated, associate the first calculation rule with the third device data;

[0220] A calculation module 804, configured to, when traversing to third device data and the data identifier of the third device data corresponds to a first calculation rule and there is device data associated with the first calculation rule in the calculation domain to be calculated, end the traversal of the third device data;

[0221] A calculation module 804, configured to, when the traversal of at least two pieces of device data in the calculation domain to be calculated ends, perform calculations on each piece of device data in the calculation domain to be calculated according to a preset calculation rule.

[0222] In some embodiments, a calculation module 804, configured to, when the traversal of at least two pieces of device data in the calculation domain to be calculated ends, traverse at least two pieces of device data in the calculation domain to be calculated in the order from the earliest to the latest timestamp;

[0223] A calculation module 804, configured to, when traversing to fourth device data in the calculation domain to be calculated and the fourth device data is not associated with a calculation rule, add the fourth device data to the real-time library;

[0224] A calculation module 804, configured to, when traversing to fifth device data and the fifth device data is associated with a second calculation rule, add the fifth device data to the real-time library; query at least two pieces of device data corresponding to the second calculation rule from the real-time library; perform calculations on at least two pieces of device data corresponding to the second calculation rule according to the second calculation rule to obtain first calculation data; set the timestamp of the fifth device data to the timestamp of the first calculation data; add the first calculation data to the real-time library.

[0225] In some embodiments, the calculation module 804 is configured to query at least one candidate device data corresponding to the first data identifier in the real-time library; the first data identifier is any one of the data identifiers included in the second calculation rule;

[0226] The calculation module 804 is configured to obtain, as the device data corresponding to the first data identifier among at least two pieces of device data corresponding to the second calculation rule, the candidate device data with the latest corresponding timestamp among the at least one candidate device data.

[0227] In some embodiments, the apparatus further includes: a clearing module, configured to clear the to-be-calculated domain when the traversal of at least two pieces of device data in the to-be-calculated domain ends;

[0228] The apparatus further includes: an updating module, configured to move the second device data and other device data in the data group whose timestamps are after the timestamp of the second device data to the to-be-calculated domain.

[0229] In some embodiments, a timer is set in the edge gateway 20; the apparatus further includes: a timing module, configured to perform calculations on each piece of device data in the to-be-calculated domain when the timer times out;

[0230] The timing module is configured to reset the timer after each calculation on each piece of device data in the to-be-calculated domain is completed.

[0231] It should be noted that when the apparatus provided in the above embodiments implements its functions, only the division of the above-mentioned functional modules is used for illustration. In actual applications, the above functions can be allocated to different functional modules according to actual needs, that is, the content structure of the device is divided into different functional modules to complete all or part of the functions described above.

[0232] Regarding the apparatus in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method; the technical effects obtained by each module performing operations are the same as those in the embodiments related to the method, and will not be elaborated here in detail.

[0233] Please refer to Figure 9, which shows a block diagram of a computer device 900 shown in an exemplary embodiment of the present application. This computer device can be implemented as the server in the above solution of the present application. The computer device 900 includes a central processing unit (CPU) 901, a system memory 904 including a random access memory (RAM) 902 and a read-only memory (ROM) 903, and a system bus 905 connecting the system memory 904 and the central processing unit 901. The computer device 900 also includes a mass storage device 906 for storing an operating system 909, application programs 910, and other program modules 911.

[0234] The mass storage device 906 is connected to the central processing unit 901 through a mass storage controller (not shown) connected to the system bus 905. The mass storage device 906 and its associated computer-readable medium provide non-volatile storage for the computer device 900. That is to say, the mass storage device 906 can include computer-readable media (not shown) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.

[0235] Without loss of generality, the computer-readable medium can include computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media includes RAM, ROM, erasable programmable read-only registers (EPROM), electrically erasable programmable read-only memory (EEPROM) flash memory or other solid-state storage technologies, CD-ROM, digital versatile disc (DVD) or other optical storage, magnetic tape cartridges, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art know that the computer storage media is not limited to the above several. The above system memory 904 and mass storage device 906 can be collectively referred to as memory.

[0236] According to various embodiments of the present disclosure, the computer device 900 can also operate by connecting to a remote computer on a network such as the Internet. That is, the computer device 900 can be connected to the network 908 through the network interface unit 907 connected to the system bus 905. Or rather, the network interface unit 907 can also be used to connect to other types of networks or remote computer systems (not shown).

[0237] The memory further includes at least one computer instruction, and the at least one computer instruction is stored in the memory. The central processing unit 901 implements all or part of the steps in the methods shown in the above various embodiments by executing the at least one computer instruction.

[0238] In an exemplary embodiment, a chip is further provided. The chip includes a programmable logic circuit and program instructions, and when the chip runs on a computer device, it is used to implement the data processing method in the above aspects.

[0239] In an exemplary embodiment, a computer program product is further provided. The computer program product includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor reads and executes the computer instructions from the computer-readable storage medium to implement the data processing method provided in the above method embodiments.

[0240] In an exemplary embodiment, a computer-readable storage medium is further provided. The computer-readable storage medium stores computer instructions, and the computer instructions are loaded and executed by a processor to implement the data processing method provided in the above method embodiments.

[0241] Those of ordinary skill in the art can understand that all or part of the steps to implement the above embodiments can be completed by hardware, or can be completed by a program instructing relevant hardware. The program can be stored in a computer-readable storage medium, and the above-mentioned storage medium can be a read-only memory, a magnetic disk or an optical disc, etc.

[0242] Those skilled in the art should be able to realize that in the above one or more examples, the functions described in the embodiments of the present application can be implemented by hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. The computer-readable medium includes computer storage media and communication media, where the communication media includes any medium that facilitates the transfer of a computer program from one place to another. The storage media can be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0243] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application.

Claims

1. A data processing method, characterized in that: The method is performed by an edge gateway in an Internet of Things system, and the method includes: Receive a data group sent by a first IoT device, wherein the data group includes at least one piece of device data, and the device data has a data identifier and a timestamp; Traversing at least one piece of the device data in the data group in the order of the timestamps from earliest to latest; When traversing to the first device data in the data group and there is no device data having the same data identifier and a different timestamp as the first device data in the to-be-calculated domain of the edge gateway, adding the first device data to the to-be-calculated domain; When traversing to the second device data in the data group, and there is device data with the same data identifier as the second device data and a different timestamp in the to-be-calculated domain of the edge gateway, traversing at least two pieces of the device data in the to-be-calculated domain in the order of the timestamps from later to earlier; When traversing to the third device data in the domain to be calculated, and the data identifier of the third device data corresponds to the first calculation rule, and there is no device data associated with the first calculation rule in the domain to be calculated, associating the first calculation rule with the third device data; When the third device data is traversed, and the data identifier of the third device data corresponds to the first calculation rule, and the device data associated with the first calculation rule exists in the to-be-calculated domain, the traversal of the third device data is terminated; When the traversal of at least two pieces of the device data in the domain to be calculated is completed, calculation is performed on each piece of the device data in the domain to be calculated according to a preset calculation rule; the calculation rule includes data identifiers of at least two pieces of the device data.

2. The method according to claim 1, characterized in that: When the traversal of at least two pieces of device data in the domain to be calculated is completed, performing calculation on each piece of device data in the domain to be calculated according to a preset calculation rule includes: When the traversal of at least two pieces of device data in the domain to be calculated is completed, traversing the at least two pieces of device data in the domain to be calculated in the order of the timestamps from earliest to latest; When traversing to the fourth device data in the to-be-calculated domain and the fourth device data is not associated with the calculation rule, adding the fourth device data to the real-time library; When traversing to the fifth device data and the fifth device data has been associated with the second calculation rule, the fifth device data is added to the real-time library; at least two device data corresponding to the second calculation rule are queried from the real-time library; according to the second calculation rule, calculation is performed on the at least two device data corresponding to the second calculation rule to obtain first calculation data; the timestamp of the fifth device data is set to the timestamp of the first calculation data; and the first calculation data is added to the real-time library.

3. The method according to claim 2, characterized in that The querying the at least two pieces of device data corresponding to the second calculation rule from the real-time library includes: querying the real-time database for at least one candidate device data corresponding to a first data identifier; the first data identifier is any one of the data identifiers included in the second calculation rule; The candidate device data having the latest corresponding timestamp among at least one of the candidate device data is acquired as the device data corresponding to the first data identifier among the at least two device data corresponding to the second calculation rule.

4. The method according to claim 2, characterized in that The method further comprises: When the traversal of at least two pieces of the device data in the domain to be calculated is completed, clearing the domain to be calculated; The second device data and other device data in the data group whose timestamp is after the timestamp of the second device data are moved to the to-be-calculated domain.

5. The method according to any one of claims 1 to 4, characterized in that: The edge gateway is provided with a timer; the method further comprises: When the timer times out, performing calculation on each device data in the domain to be calculated; After each calculation of each device data in the to-be-calculated domain is completed, the timer is reset.

6. The method according to any one of claims 1 to 4, characterized in that: The first Internet of Things device includes at least one data collection point, and the data identifier is used to indicate the data collection point corresponding to the device data.

7. A data processing device, characterized in that: The device comprises: A receiving module, configured to receive a data group sent by a first IoT device, wherein the data group includes at least one piece of device data; the device data has a data identifier and a timestamp; A traversal module, used for traversing at least one piece of the device data in the data group in the order of the timestamps from earliest to latest; an adding module, configured to add the first device data to the to-be-calculated domain when the first device data in the data group is traversed and there is no device data having the same data identifier and a different timestamp as the first device data in the to-be-calculated domain of the edge gateway; A calculation module, for, when traversing to the second device data in the data group and there is device data with the same data identifier and different timestamp as the second device data in the to-be-calculated domain of the edge gateway, traversing at least two of the device data in the to-be-calculated domain in the order of the timestamps from the last to the first; when traversing to the third device data in the to-be-calculated domain and the data identifier of the third device data corresponds to the first calculation rule, and there is no device data associated with the first calculation rule in the to-be-calculated domain, associating the first calculation rule with the third device data; when traversing to the third device data and the data identifier of the third device data corresponds to the first calculation rule, and there is device data associated with the first calculation rule in the to-be-calculated domain, ending the traversal of the third device data; when traversing to at least two of the device data in the to-be-calculated domain is ended, performing calculation on each device data in the to-be-calculated domain according to a preset calculation rule; the calculation rule contains the data identifiers of at least two of the device data.

8. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one computer instruction, and the at least one computer instruction is loaded and executed by the processor to implement the data processing method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer instruction, and the computer instruction is loaded and executed by a processor to implement the data processing method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium; the computer instructions are read and executed by a processor of a computer device to implement the data processing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Equipment data acquisition method and device based on cloud edge collaboration, equipment and medium

    CN115460251A

  • Data processing method, data acquisition device and system

    CN118473576A