Internet of Things data processing method and device, medium and program product
By acquiring IoT data and its types, finding and applying appropriate persistent computing rules to update storage, the problem of insufficient real-time and diversity of IoT data processing in the prior art is solved, and efficient data integration and processing is achieved.
Patent Information
- Application Number
- CN202411533939.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-02-25
AI Technical Summary
The existing IoT data processing methods have poor real-time performance, and cannot effectively distinguish and process different types of IoT data, making it difficult to meet the requirements of real-time and diversity.
By obtaining the current IoT data and its data type, finding matching persistent calculation rules, and determining the target segment accuracy time point based on the acquisition time point, and updating the stored segment accuracy data based on these rules.
It has achieved efficient integration of different IoT data sources, improved data processing efficiency, and improved real-time and diversity.
Smart Images

Figure CN119513075A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Internet of Things, and in particular to a method, device, medium and program product for processing Internet of Things data. Background Art
[0002] With the widespread application of IoT technology, the amount of data generated by IoT devices has increased dramatically, which has put higher requirements on real-time processing, efficient storage and intelligent analysis of data.
[0003] At present, the existing IoT data processing method usually sets a period at each interval, centrally processes the IoT data received during the interval, and obtains the data processing results. This data processing method has poor real-time performance and cannot distinguish and process different types of IoT data, making it difficult to meet the real-time and diversity requirements of IoT data processing. Summary of the invention
[0004] The present invention provides a method, device, medium and program product for processing Internet of Things data, which can realize efficient integration of different Internet of Things data sources, improve the processing efficiency of Internet of Things data, and improve the real-time and diversity of Internet of Things data processing.
[0005] According to one aspect of the present invention, a method for processing Internet of Things data is provided, comprising:
[0006] Get the current IoT data and the corresponding data type;
[0007] Find a persistent calculation rule that matches the data type, and obtain a target precision time point according to the acquisition time point of the current IoT data;
[0008] Based on the persistent calculation rule, the stored sub-precision data is updated and stored according to the current Internet of Things data, the acquisition time point and the target sub-precision time point.
[0009] According to another aspect of the present invention, there is provided a device for processing Internet of Things data, comprising:
[0010] Data acquisition module, used to obtain current IoT data and corresponding data types;
[0011] A time point acquisition module is used to find a persistent calculation rule that matches the data type and obtain a target precision time point according to the acquisition time point of the current IoT data;
[0012] The data update storage module is used to update and store the stored precision data based on the persistent computing rule, according to the current IoT data, the acquisition time point and the target precision time point.
[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0014] at least one processor; and
[0015] a memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for processing Internet of Things data described in any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and the computer program is used to enable a processor to implement the method for processing Internet of Things data described in any embodiment of the present invention when executed.
[0018] According to another aspect of the present invention, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the computer program implements the method for processing Internet of Things data according to any embodiment of the present invention.
[0019] The technical solution of the embodiment of the present invention obtains the current Internet of Things data and the corresponding data type; searches for the persistence calculation rule that matches the data type, and obtains the target precision time point according to the acquisition time point of the current Internet of Things data; based on the persistence calculation rule, the stored precision data is updated and stored according to the current Internet of Things data, the acquisition time point and the target precision time point; by selecting different persistence calculation rules for real-time processing of Internet of Things data of different data types, efficient integration of different Internet of Things data sources can be achieved, the processing efficiency of Internet of Things data can be improved, and the real-time and diversity of Internet of Things data processing can be improved.
[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1is a flowchart of a method for processing Internet of Things data provided according to Embodiment 1 of the present invention;
[0023] Figure 2 is a schematic diagram of an Internet of Things data stream provided according to Embodiment 1 of the present invention;
[0024] Figure 3 is a calculation flow chart of a left adjacent value calculation rule provided in Embodiment 1 of the present invention;
[0025] Figure 4 is a calculation flow chart of a switch / enumeration value calculation rule provided according to Embodiment 1 of the present invention;
[0026] Figure 5 is a calculation flow chart of a linear interpolation calculation rule provided according to the first embodiment of the present invention;
[0027] Figure 6 is a flowchart of persistent calculation of derivative data provided by Embodiment 1 of the present invention;
[0028] Figure 7 This is a schematic diagram of the structure of a device for processing Internet of Things data provided according to Embodiment 2 of the present invention;
[0029] Figure 8 It is a structural schematic diagram of an electronic device for implementing the method for processing Internet of Things data according to an embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "first", "second", "target", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] Embodiment 1
[0033] Figure 1 A flowchart of a method for processing IoT data is provided for the first embodiment of the present invention. This embodiment is applicable to the case where persistent calculation of IoT data from different data sources is performed. The method can be executed by an IoT data processing device. The IoT data processing device can be implemented in the form of hardware and / or software. Typically, the IoT data processing device can be configured in an electronic device, such as a computer device or a server. Figure 1 As shown, the method includes:
[0034] S110. Obtain current IoT data and corresponding data types.
[0035] In this embodiment, IoT data of different data types can be collected from different data sources. Typically, the data types may include direct data and derived data. Direct data may be data generated by direct calculation, which refers to direct calculation through a certain device data. Derived data may be data generated by derivative calculation, which refers to data that cannot be directly calculated through a certain device data, but requires the introduction of other collected data from the device itself or other devices to participate in the calculation process.
[0036] Derivative computing can be divided into self-derived computing and external-derived computing. Self-derived computing means that the derived data calculation of a device attribute can be completed by simply reading the device's own attribute data, while external-derived computing means that the derived data calculation of an object attribute needs to be completed by reading the attribute data of other devices.
[0037] Optionally, when acquiring IoT data, first, subscribe to the data stream from the Kafka queue and read the data as a data source for subsequent data processing; then, use Flink's window mechanism, such as TimeWindow or CountWindow, to divide the subscribed data into windows of time point + quantity to obtain parallel data streams; finally, the parallel data streams can be further split according to the data type to obtain two parallel data streams of direct data and derived data.
[0038] S120: searching for a persistent calculation rule that matches the data type, and obtaining a target precision time point according to the acquisition time point of the current IoT data.
[0039] In this embodiment, the mapping relationship between the data type and the persistent calculation rule can be preset, and the persistent calculation rules corresponding to different data types can be the same or different, which is not specifically limited in this embodiment. Therefore, after obtaining the current data type, the matching persistent calculation rule can be determined by searching the mapping relationship between the preset data type and the persistent calculation rule.
[0040] Among them, the persistent calculation rules can be the calculation rules of the precision values corresponding to the precision time points, and can include direct acquisition calculation rules and derived calculation rules. The direct acquisition calculation rules can be the calculation logic used to process the direct acquisition data, and the derived calculation rules can be the calculation logic used to process the derived data.
[0041] It should be noted that the minute-precision time point is a time statistic that can be obtained by dividing the time axis according to a given time step. For example, the minute-precision type can be 5 minutes, 15 minutes, 1 hour, 1 day and natural month. When the minute-precision type is 1 hour, every hour is a minute-precision time point. Specifically, first, each original minute-precision time point can be determined according to the preset minute-precision type; then, it can be determined between which two original minute-precision time points the acquisition time point of the current IoT data is, and the latter original minute-precision time point can be determined as the target minute-precision time point. For example, if the acquisition time point is between the original minute-precision time points T and T+1, the target minute-precision time point is T+1.
[0042] S130: Based on the persistence calculation rule, the stored precision data is updated and stored according to the current IoT data, the acquisition time point, and the target precision time point.
[0043] Specifically, based on the persistence calculation rule, first, the current precision value corresponding to the target precision time point can be calculated based on the current IoT data; then, if it is detected that the target precision time point does not exist in the stored precision data, the target precision time point and the corresponding current precision value can be directly stored; and if it is detected that the target precision time point exists in the stored precision data, the current acquisition time point and the acquisition time point of the stored precision value can be compared to determine whether the stored precision value needs to be updated. If it is determined that an update is required, the precision value can be replaced; if an update is not required, the current IoT data can be directly discarded.
[0044] Optionally, based on the persistent calculation rule, according to the current IoT data, the acquisition time point, and the target precision time point, updating and storing the stored precision data may include:
[0045] The target precision time point is locked, and based on the persistence calculation rule, according to the current IoT data, the acquisition time point and the target precision time point, the stored precision data is updated and stored, and the target precision time point is unlocked.
[0046] In this embodiment, before updating and storing the stored precision data, the current precision time point may be locked first, and after the update and storage operation is completed, the current precision time point may be unlocked. This embodiment does not specifically limit the locking and unlocking methods.
[0047] The benefit of the above settings is that they can ensure consistency and accuracy when updating or querying point-in-time data.
[0048] The technical solution of the embodiment of the present invention obtains the current Internet of Things data and the corresponding data type; searches for the persistence calculation rule that matches the data type, and obtains the target precision time point according to the acquisition time point of the current Internet of Things data; based on the persistence calculation rule, the stored precision data is updated and stored according to the current Internet of Things data, the acquisition time point and the target precision time point; by selecting different persistence calculation rules for real-time processing of Internet of Things data of different data types, efficient integration of different Internet of Things data sources can be achieved, the processing efficiency of Internet of Things data can be improved, and the real-time and diversity of Internet of Things data processing can be improved.
[0049] In an optional implementation of this embodiment, searching for a persistent calculation rule matching the data type may include:
[0050] When the data type is direct-acquisition data, the current device type corresponding to the current IoT data is obtained, and based on the mapping relationship between the preset device type and the direct-acquisition calculation rule, the target direct-acquisition calculation rule matching the current device type is obtained as a persistent calculation rule matching the data type.
[0051] The device type may be identified by a preset character string, and this embodiment may not specifically limit the device type. In this embodiment, a mapping relationship between the device type and the direct purchase calculation rule may be preset. After the current device type is acquired, the matching target direct purchase calculation rule may be determined by searching for the mapping relationship between the preset device type and the direct purchase calculation rule.
[0052] Typically, the direct sampling calculation rule may include at least one of the left adjacent value calculation rule, the switch / enumeration value calculation rule, and the linear interpolation calculation rule. For example, the IoT data stream may be as follows: Figure 2As shown, the arrow direction is the time flow direction. For the left adjacent value calculation rule, if T is a sub-precision time point, P3, P1 and P2 are input in sequence at T3, T1 and T2 respectively. When P3 is received first, T3 is closest to T, so the sub-precision value at T is P3; afterwards, P1 arrives, T1 is closer to T than T3, so the sub-precision value at T is updated from P3 to P1; and when P2 arrives, since T2 has exceeded T, it is used to determine the sub-precision value of the next sub-precision time point, and the sub-precision value at T remains P1.
[0053] Secondly, for the switch / enumeration value calculation rules, there are time variables with only two numerical states of 0 or 1 along the continuous time axis, or time variables with only given integer numerical states, such as device switch state, system alarm state, manual and automatic state, etc. The precision value is the data value of the IoT data closest to the precision time point, and the point data such as the shear point data and temporary point data of the switch quantity need to be stored. Finally, for the linear interpolation calculation rule, the precision value corresponding to the precision time point T can be obtained by linear interpolation calculation of the two original data (such as T1 and T2) before and after T (spanning the precision time points).
[0054] Correspondingly, based on the persistent calculation rule, according to the current IoT data, the acquisition time point and the target precision time point, updating and storing the stored precision data may include:
[0055] Based on the target direct acquisition calculation rules, the stored precision data is updated and stored according to the current IoT data, the acquisition time point and the target precision time point.
[0056] Specifically, when the data type is direct-collected data, the precision value corresponding to the precision time point can be determined based on the target direct-collection calculation rule that matches the device type.
[0057] The advantage of the above settings is that it can realize persistent computing of directly acquired data types and expand the applicable scenarios of persistent computing of IoT data.
[0058] Optionally, based on the left adjacent value calculation rule, according to the current IoT data, the acquisition time point and the target precision time point, updating and storing the stored precision data may include:
[0059] According to the current IoT data and the acquisition time point, obtain the current sub-precision value corresponding to the target sub-precision time point and the acquisition time point of the current sub-precision value;
[0060] Determine whether the target score accuracy time point exists in the stored score accuracy data, and if so, obtain the stored score accuracy value corresponding to the target score accuracy time point and the time point at which the stored score accuracy value is obtained according to the stored score accuracy data;
[0061] If it is detected that the acquisition time point of the current score precision value is closer to the target score precision time point than the acquisition time point of the stored score precision value, the stored score precision value corresponding to the target score precision time point in the stored score precision data is replaced with the current score precision value.
[0062] In this embodiment, when the left adjacent value calculation rule is used for direct data processing, first, the current Internet of Things data can be parsed to obtain the current precision value. For example, the precision value can be a state value, positioning information, parameter value, etc., and the acquisition time point of the current Internet of Things data can be directly used as the acquisition time point of the current precision value. Then, if it is determined that there is a target precision time point and a corresponding stored precision value in the stored precision data, the stored precision value and the corresponding acquisition time point can be read from the stored precision data at the same time, and the acquisition time point of the current precision value is compared to whether it is closer to the target precision time point than the acquisition time point of the stored precision value. If it is determined to be closer, the current precision value can be used to replace the stored precision value, and the acquisition time point of the current precision value can be stored. If it is determined that there is no target precision time point in the stored precision data, a record of the target precision time point and the corresponding current precision value can be directly added to the stored precision data.
[0063] In a specific example, the calculation process of the left adjacent value calculation rule can be as follows Figure 3 As shown. First, obtain the rule data and determine the target precision time point. Then, lock the target precision time point, and based on the rule data, determine whether the target precision time point exists in the stored precision data of the HBase database; if it is determined that it does not exist, add a new target precision time point record, synchronize the new record to the cache, and then save it to the stored precision data in the HBase database for persistence. If it is determined that it exists, compare whether the current acquisition time point of the current precision value is closer to the target precision time point than the original acquisition time point of the stored precision value. If so, update the precision value, use the current precision value to replace the stored precision value, and persist the update to the HBase database. If not, directly discard the current precision value. Finally, after the update and storage are completed, unlock the target precision time point.
[0064] The advantage of the above setting is that it can realize real-time update of each precision time point and the corresponding precision value of persistent storage, ensuring that the precision value of persistent storage can represent the latest device status within the corresponding time interval, which can reduce the amount of IoT data that needs to be stored.
[0065] Optionally, the target precision time point may include a pre-precision time point and a post-precision time point. Based on the switch / enumeration value calculation rule, according to the current IoT data, the acquisition time point and the target precision time point, updating and storing the stored precision data may include:
[0066] According to the current IoT data and the acquisition time point, the current point data is acquired, and according to the stored precision data, the stored point data between the previous precision time point and the next precision time point is acquired, wherein the point data includes the point time point and the point data value;
[0067] Determine whether the number of the stored point data is greater than or equal to a preset threshold, and if so, determine the position of the current point data in all the stored point data according to the point time point;
[0068] According to the position of the current point data in all the stored point data, the stored point data are updated and stored.
[0069] In this embodiment, when the switch / enumeration value calculation rule is used for direct data processing, point data is allowed to exist between the precision time points, and the point data may include switching point data and temporary point data. The point data value is 0 or 1, or other integer values.
[0070] Specifically, first, when the current IoT data is point data, the current point data is obtained by parsing the current IoT data; then, in the stored precision data, the pre-precision time point and post-precision time point located on both sides of the current point time point, as well as the stored point data between the two precision time points, are obtained; secondly, it is determined whether the number of stored point data is greater than or equal to a preset threshold, for example, 3; if it is determined to be less than 3, no processing is performed; and if it is determined to be greater than or equal to 3, all point data can be sorted and processed according to the point time point according to the time axis to determine the position of the current point data in all stored point data. Among them, the position may include overlapping with a certain stored point data (the point time point is the same), between two stored point data, and at the front or the end of all stored point data. Finally, based on the pre-configured data processing rules that match the current position, each stored point data can be updated and stored according to the current point data.
[0071] The advantage of the above setting is that it can retain a certain amount of point data while achieving real-time update of each precision time point and the corresponding precision value of persistent storage, thereby achieving an intuitive display of device status changes.
[0072] Optionally, updating and storing the stored point data according to the position of the current point data in all stored point data may include:
[0073] If the current point data overlaps with a certain stored point data, the current point data is discarded;
[0074] If the current point data is at the front or the end of all the stored point data, determine whether the current point data value of the current point data is equal to the adjacent stored point data value of the adjacent stored point data; if they are determined to be equal, use the current point data to replace the adjacent stored point data;
[0075] Furthermore, if the current point data is between the first stored point data and the second stored point data, then in the first stored point data and the second stored point data, search for target stored point data having the same point data value as the current point data, and use the current point data to replace the target stored point data.
[0076] In this embodiment, taking the point data values of 0 or 1 as an example, when the current point data overlaps with a certain stored point data, the current point data can be directly discarded, that is, no update storage operation is performed; and if the current point data is at the front or the end of all stored point data, when it is determined that the current point data value of the current point data is equal to the adjacent stored point data value of the adjacent stored point data, the current point data is used to replace the adjacent stored point data; and when it is determined that the current point data value of the current point data is not equal to the adjacent stored point data value of the adjacent stored point data, the current point data is added as a new record to the stored precision data. In addition, if the current point data is between the first stored point data and the second stored point data, the current point data can be used to replace the stored point data with the same point data value as itself in the first stored point data and the second stored point data.
[0077] In a specific example, the calculation process of the switch / enumeration value calculation rule can be as follows Figure 4As shown. Specifically, first, obtain the rule data, and according to the current IoT data and the acquisition time point, obtain the current point data, and determine the previous and next precision time points. Then, lock the precision time point, and obtain the stored point data between the previous and next precision time points; then, determine whether the number of stored point data is greater than or equal to 3, if not, there is no current precision processing process; if so, obtain the position of the current point data in all stored point data. Further, if the position is overlapping, no processing is performed; if the position is the front or the last, when the current point data value is equal to the adjacent stored point data value, the adjacent stored point data is replaced, and when they are not equal, the current point data is stored as a new record; if the position is in the middle, the adjacent stored point data with equal point data values is directly replaced. Finally, the precision time point can be unlocked.
[0078] The advantage of the above setting is that it can realize real-time update of persistently stored point data and dynamic display of device status changes.
[0079] It is understandable that when the stored point data between two fine-precision time points are updated, the fine-precision values corresponding to the corresponding fine-precision time points can be adaptively updated based on the left adjacent value calculation rule.
[0080] In another optional implementation of this embodiment, based on the linear interpolation calculation rule, according to the current IoT data, the acquisition time point and the target precision time point, updating and storing the stored precision data may include:
[0081] Determine whether the target precision time point exists in the stored precision data, and if so, obtain the previous historical IoT data and the subsequent historical IoT data corresponding to the target precision time point;
[0082] Determine, from among the previous historical IoT data and the subsequent historical IoT data, first historical IoT data that is on the same side as the target precision time point as the current IoT data, and second historical IoT data that is on a different side from the target precision time point as the current IoT data;
[0083] If it is detected that the acquisition time point of the current IoT data is closer to the target precision time point than the acquisition time point of the first historical IoT data, interpolation calculation is performed according to the current IoT data and the second historical IoT data to obtain an updated precision value corresponding to the target precision time point;
[0084] The stored score precision value corresponding to the target score precision time point in the stored score precision data is replaced with the updated score precision value.
[0085] In this embodiment, the calculation process of the linear interpolation calculation rule can be as follows: Figure 5 As shown. Specifically, when direct data processing is performed based on the linear interpolation calculation rule, first, the target precision time point can be locked, and it can be determined whether the target precision time point exists in the stored precision data. If not, a new target precision time point record (without the corresponding precision value) can be added, and the current IoT data can be directly added to the stored precision data; and if so, the previous historical IoT data and the later historical IoT data used to calculate the target precision time point can be determined. Then, the first historical IoT data and the second historical IoT data can be determined by judging whether the current IoT data is on the same side of the target precision time point. Further, it can be determined whether the current acquisition time point of the current IoT data is closer to the target precision time point than the original acquisition time point of the first historical IoT data. If so, the current IoT data can be used to replace the first historical IoT data, and the current IoT data and the second historical IoT data can be linearly interpolated to obtain an updated precision value, and then the updated precision value is used to replace the original stored precision value of the target precision time point. Finally, the target precision time point can be unlocked.
[0086] The advantage of the above setting is that it can improve the accuracy of the precision value corresponding to the precision time point of persistent storage, and can realize the dynamic update of the precision time point and the corresponding precision value of persistent storage.
[0087] In another optional implementation of this embodiment, searching for a persistent calculation rule matching the data type may include:
[0088] When the data type is derived data, obtaining a precompiled calculation script as a persistent calculation rule matching the data type;
[0089] Correspondingly, based on the persistent calculation rule, according to the current IoT data, the acquisition time point and the target precision time point, updating and storing the stored precision data may include:
[0090] Based on the precompiled calculation script, the stored sub-precision data is updated and stored according to the current Internet of Things data, the acquisition time point and the target sub-precision time point.
[0091] The precompiled calculation script may be a Lua script, which provides a flexible way to execute complex calculation logic. In this embodiment, when the current IoT data is derived data, it can be used as a parameter of the Lua script and passed into a predefined formula for calculation.
[0092] Specifically, the persistence calculation process of derived data can be as follows: Figure 6 As shown. First, the target precision time point can be locked, and the direct acquisition data and related IoT data corresponding to the target precision time point can be obtained; then, the precompiled Lua script can be used to calculate the direct acquisition data and related IoT data to obtain the current precision value corresponding to the target precision time point; further, it can be determined whether there is a record of the target precision time point in the database. If it is determined to exist, the current precision value can be used to replace the stored precision value when the current precision value is not equal to the stored precision value; if it is determined that it does not exist, the record of the target precision time point can be added. Finally, the target precision time point can be unlocked.
[0093] The advantage of the above setting is that it can expand the application scope of persistent computing of IoT data and realize persistent computing of IoT data from different data sources.
[0094] In this embodiment, by integrating Flink streaming computing technology, real-time processing, aggregation, and analysis of IoT data are achieved, which improves data processing efficiency and greatly improves the digitalization efficiency of IoT. Secondly, the service module is independently designed, easy to expand and maintain, and the system architecture can be flexibly adjusted according to actual needs. Finally, the persistent data service supports customized persistence rules and information point relationships to meet the needs of different business scenarios.
[0095] Embodiment 2
[0096] Figure 7 This is a schematic diagram of the structure of a device for processing Internet of Things data provided by Embodiment 2 of the present invention. Figure 7 As shown, the device includes: a data acquisition module 210, a time point acquisition module 220 and a data update storage module 230; wherein,
[0097] The data acquisition module 210 is used to acquire current IoT data and corresponding data types;
[0098] The time point acquisition module 220 is used to find a persistent calculation rule that matches the data type, and obtain a target precision time point according to the acquisition time point of the current IoT data;
[0099] The data update storage module 230 is used to update and store the stored sub-precision data based on the persistence calculation rule, according to the current Internet of Things data, the acquisition time point and the target sub-precision time point.
[0100] The technical solution of the embodiment of the present invention obtains the current Internet of Things data and the corresponding data type; searches for the persistence calculation rule that matches the data type, and obtains the target precision time point according to the acquisition time point of the current Internet of Things data; based on the persistence calculation rule, the stored precision data is updated and stored according to the current Internet of Things data, the acquisition time point and the target precision time point; by selecting different persistence calculation rules for real-time processing of Internet of Things data of different data types, efficient integration of different Internet of Things data sources can be achieved, the processing efficiency of Internet of Things data can be improved, and the real-time and diversity of Internet of Things data processing can be improved.
[0101] Optionally, the time point acquisition module 220 is specifically used to obtain the current device type corresponding to the current IoT data when the data type is direct acquisition data, and obtain the target direct acquisition calculation rule matching the current device type according to the mapping relationship between the preset device type and the direct acquisition calculation rule, as a persistent calculation rule matching the data type;
[0102] The data update storage module 230 is specifically used to update and store the stored precision data based on the target direct acquisition calculation rule, according to the current IoT data, the acquisition time point and the target precision time point.
[0103] Optionally, the direct sampling calculation rule includes at least one of a left adjacent value calculation rule, a switch / enumeration value calculation rule, and a linear interpolation calculation rule.
[0104] Optionally, the data update storage module 230 is specifically used to obtain the current sub-precision value corresponding to the target sub-precision time point and the acquisition time point of the current sub-precision value according to the current Internet of Things data and the acquisition time point;
[0105] Determine whether the target score accuracy time point exists in the stored score accuracy data, and if so, obtain the stored score accuracy value corresponding to the target score accuracy time point and the time point at which the stored score accuracy value is obtained according to the stored score accuracy data;
[0106] If it is detected that the acquisition time point of the current score precision value is closer to the target score precision time point than the acquisition time point of the stored score precision value, the stored score precision value corresponding to the target score precision time point in the stored score precision data is replaced with the current score precision value.
[0107] Optionally, the target precision time point includes a pre-precision time point and a post-precision time point;
[0108] The data update storage module 230 is specifically used to obtain the current point data according to the current IoT data and the acquisition time point, and to obtain the stored point data between the previous precision time point and the next precision time point according to the stored precision data, wherein the point data includes the point time point and the point data value;
[0109] Determine whether the number of the stored point data is greater than or equal to a preset threshold, and if so, determine the position of the current point data in all the stored point data according to the point time point;
[0110] According to the position of the current point data in all the stored point data, the stored point data are updated and stored.
[0111] Optionally, the data update storage module 230 is specifically configured to discard the current point data if the current point data overlaps with a certain stored point data;
[0112] If the current point data is at the front or the end of all the stored point data, determine whether the current point data value of the current point data is equal to the adjacent stored point data value of the adjacent stored point data; if they are determined to be equal, use the current point data to replace the adjacent stored point data;
[0113] Furthermore, if the current point data is between the first stored point data and the second stored point data, then in the first stored point data and the second stored point data, search for target stored point data having the same point data value as the current point data, and use the current point data to replace the target stored point data.
[0114] Optionally, the data update storage module 230 is specifically used to determine whether the target sub-precision time point exists in the stored sub-precision data, and if so, obtain the previous historical IoT data and the subsequent historical IoT data corresponding to the target sub-precision time point;
[0115] Determine, from among the previous historical IoT data and the subsequent historical IoT data, first historical IoT data that is on the same side as the target precision time point as the current IoT data, and second historical IoT data that is on a different side from the target precision time point as the current IoT data;
[0116] If it is detected that the acquisition time point of the current IoT data is closer to the target precision time point than the acquisition time point of the first historical IoT data, interpolation calculation is performed according to the current IoT data and the second historical IoT data to obtain an updated precision value corresponding to the target precision time point;
[0117] The stored score precision value corresponding to the target score precision time point in the stored score precision data is replaced with the updated score precision value.
[0118] Optionally, the time point acquisition module 220 is specifically used to acquire a precompiled calculation script as a persistent calculation rule matching the data type when the data type is derived data;
[0119] The data update storage module 230 is specifically used to update and store the stored precision data based on the precompiled calculation script, according to the current IoT data, the acquisition time point and the target precision time point.
[0120] Optionally, the data update storage module 230 is specifically used to lock the target precision time point, and based on the persistence calculation rule, according to the current Internet of Things data, the acquisition time point and the target precision time point, update and store the stored precision data, and unlock the target precision time point.
[0121] The device for processing Internet of Things data provided by the embodiment of the present invention can execute the method for processing Internet of Things data provided by any embodiment of the present invention, and has functional modules and beneficial effects corresponding to the execution method.
[0122] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0123] Embodiment 3
[0124] Figure 8 A schematic diagram of the structure of an electronic device 30 that can be used to implement an embodiment of the present invention is shown. The electronic device 30 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device 30 can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0125] like Figure 8As shown, the electronic device 30 includes at least one processor 31, and a memory connected to the at least one processor 31, such as a read-only memory (ROM) 32, a random access memory (RAM) 33, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 31 can perform various appropriate actions and processes according to the computer program stored in the read-only memory 32 or the computer program loaded from the storage unit 38 to the random access memory 33. In the RAM 33, various programs and data required for the operation of the electronic device 30 can also be stored. The processor 31, the ROM 32 and the RAM 33 are connected to each other through a bus 34. The input / output (I / O) interface 35 is also connected to the bus 34.
[0126] A number of components in the electronic device 30 are connected to the I / O interface 35, including: an input unit 36, such as a keyboard, a mouse, etc.; an output unit 37, such as various types of displays, speakers, etc.; a storage unit 38, such as a disk, an optical disk, etc.; and a communication unit 39, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 39 allows the electronic device 30 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0127] The processor 31 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 31 include, but are not limited to, a central processing unit, a graphics processing unit, various special artificial intelligence computing chips, various processors running machine learning model algorithms, digital signal processors, and any appropriate processors, controllers, microcontrollers, etc. The processor 31 performs the various methods and processes described above, such as the processing method of IoT data.
[0128] In some embodiments, the method for processing IoT data may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 38. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 30 via the ROM 32 and / or the communication unit 39. When the computer program is loaded into the RAM 33 and executed by the processor 31, one or more steps of the method for processing IoT data described above may be performed. Alternatively, in other embodiments, the processor 31 may be configured to execute the method for processing IoT data in any other appropriate manner (e.g., by means of firmware).
[0129] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays, application specific integrated circuits, application specific standard products, systems on a chip, load programmable logic devices, computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0130] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0131] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical fiber, a portable compact disk read-only memory, an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0132] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device 30 having: a display device (e.g., a cathode ray tube or a liquid crystal display) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the electronic device 30. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0133] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local area networks, wide area networks, blockchain networks, and the Internet.
[0134] A computing system may include clients and servers. Clients and servers are generally remote from each other and typically interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other. The server may be a cloud server.
[0135] This embodiment may also include a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the method for processing Internet of Things data provided by any embodiment of the present invention.
[0136] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0137] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for processing Internet of Things data, characterized in that: include: Get the current IoT data and the corresponding data type; Find a persistent calculation rule that matches the data type, and obtain a target precision time point according to the acquisition time point of the current IoT data; Based on the persistent calculation rule, the stored sub-precision data is updated and stored according to the current Internet of Things data, the acquisition time point and the target sub-precision time point.
2. The method according to claim 1, characterized in that Find persistent calculation rules that match the data type, including: When the data type is direct acquisition data, the current device type corresponding to the current IoT data is obtained, and according to the preset mapping relationship between the device type and the direct acquisition calculation rule, the target direct acquisition calculation rule matching the current device type is obtained as a persistent calculation rule matching the data type; Based on the persistent calculation rule, according to the current IoT data, the acquisition time point and the target precision time point, the stored precision data is updated and stored, including: Based on the target direct acquisition calculation rules, the stored precision data is updated and stored according to the current IoT data, the acquisition time point and the target precision time point.
3. The method according to claim 2, characterized in that The direct sampling calculation rule includes at least one of a left adjacent value calculation rule, a switch / enumeration value calculation rule, and a linear interpolation calculation rule.
4. The method according to claim 3, characterized in that Based on the left adjacent value calculation rule, according to the current IoT data, the acquisition time point and the target precision time point, the stored precision data is updated and stored, including: According to the current IoT data and the acquisition time point, obtain the current sub-precision value corresponding to the target sub-precision time point and the acquisition time point of the current sub-precision value; Determine whether the target score accuracy time point exists in the stored score accuracy data, and if so, obtain the stored score accuracy value corresponding to the target score accuracy time point and the time point at which the stored score accuracy value is obtained according to the stored score accuracy data; If it is detected that the acquisition time point of the current score precision value is closer to the target score precision time point than the acquisition time point of the stored score precision value, the stored score precision value corresponding to the target score precision time point in the stored score precision data is replaced with the current score precision value.
5. The method according to claim 3, characterized in that: The target precision time point includes a pre-precision time point and a post-precision time point. Based on the switch / enumeration value calculation rule, according to the current IoT data, the acquisition time point and the target precision time point, the stored precision data is updated and stored, including: According to the current IoT data and the acquisition time point, the current point data is acquired, and according to the stored precision data, the stored point data between the previous precision time point and the next precision time point is acquired, wherein the point data includes the point time point and the point data value; Determine whether the number of the stored point data is greater than or equal to a preset threshold, and if so, determine the position of the current point data in all the stored point data according to the point time point; According to the position of the current point data in all the stored point data, the stored point data are updated and stored.
6. The method according to claim 5, characterized in that According to the position of the current point data in all the stored point data, the stored point data is updated and stored, including: If the current point data overlaps with a certain stored point data, the current point data is discarded; If the current point data is at the front or the end of all the stored point data, determine whether the current point data value of the current point data is equal to the adjacent stored point data value of the adjacent stored point data; if they are determined to be equal, use the current point data to replace the adjacent stored point data; Furthermore, if the current point data is between the first stored point data and the second stored point data, then in the first stored point data and the second stored point data, search for target stored point data having the same point data value as the current point data, and use the current point data to replace the target stored point data.
7. The method according to claim 3, characterized in that Based on the linear interpolation calculation rule, according to the current IoT data, the acquisition time point and the target precision time point, the stored precision data is updated and stored, including: Determine whether the target precision time point exists in the stored precision data, and if so, obtain the previous historical IoT data and the subsequent historical IoT data corresponding to the target precision time point; Determine, from among the previous historical IoT data and the subsequent historical IoT data, first historical IoT data that is on the same side as the target precision time point as the current IoT data, and second historical IoT data that is on a different side from the target precision time point as the current IoT data; If it is detected that the acquisition time point of the current IoT data is closer to the target precision time point than the acquisition time point of the first historical IoT data, interpolation calculation is performed according to the current IoT data and the second historical IoT data to obtain an updated precision value corresponding to the target precision time point; The stored score precision value corresponding to the target score precision time point in the stored score precision data is replaced with the updated score precision value.
8. The method according to claim 1, characterized in that Find persistent calculation rules that match the data type, including: When the data type is derived data, obtaining a precompiled calculation script as a persistent calculation rule matching the data type; Based on the persistent calculation rule, according to the current IoT data, the acquisition time point and the target precision time point, the stored precision data is updated and stored, including: Based on the precompiled calculation script, the stored sub-precision data is updated and stored according to the current Internet of Things data, the acquisition time point and the target sub-precision time point.
9. The method according to claim 1, characterized in that: Based on the persistent calculation rule, according to the current IoT data, the acquisition time point and the target precision time point, the stored precision data is updated and stored, including: The target precision time point is locked, and based on the persistence calculation rule, according to the current IoT data, the acquisition time point and the target precision time point, the stored precision data is updated and stored, and the target precision time point is unlocked.
10. An electronic device, characterized in that: The electronic device comprises: at least one processor, and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for processing Internet of Things data according to any one of claims 1 to 9.