Internet of Things equipment data processing method and related device based on real-time database
By adopting a real-time database-based method in the data processing of IoT devices, acquiring and storing the knowledge metadata, basic data, historical data and real-time tasks of IoT devices, the problem that traditional databases are difficult to meet the real-time and large-scale management needs of IoT devices are solved, and efficient and real-time data processing effects are achieved.
Patent Information
- Application Number
- CN202111131396.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-26
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2041-09-26
AI Technical Summary
Traditional databases are difficult to meet the real-time and large-scale management needs of IoT device data processing, especially in network environments with unstable communications such as the Internet.
The data processing method of IoT devices based on real-time database is adopted to store data in real-time into the memory dictionary by acquiring knowledge metadata, basic data, historical data and real-time tasks, thereby improving the efficiency and real-timeness of data processing.
It realizes efficient real-time processing of IoT device data, meets the needs of large-scale device management and real-time data analysis, and improves the stability and performance of the system.
Smart Images

Figure CN113986913B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of Internet of Things, and in particular to a method and related apparatus for processing data of Internet of Things devices based on a real-time database. Background Art
[0002] With the integration of communication, sensing and information technologies, the application of the Internet of Things has developed rapidly. The Internet of Things is essentially a follow-up development of traditional industrial control systems on the Internet. Like traditional industrial control systems, the Internet of Things has functions such as data collection, real-time computing, real-time monitoring, remote control, and statistical analysis.
[0003] Although the overall functional scope of the Internet of Things is roughly the same as that of industrial control systems, the operating environment and application purposes are still very different. The Internet of Things runs in an unstable network environment such as the Internet, and the Internet of Things applications need to manage various types of equipment in a wide range, and the number of equipment may be very large. And it needs to be able to easily add or remove equipment; at the same time, the Internet of Things application pays great attention to the statistical analysis function of data, and needs to encapsulate a large number of business operation rules. Traditional databases obviously cannot meet the above requirements well. Summary of the invention
[0004] In view of this, the purpose of the present disclosure is to propose a data processing method and related devices for IoT devices based on a real-time database.
[0005] Based on the above purpose, the present disclosure provides a method for processing IoT device data based on a real-time database, comprising:
[0006] Acquire knowledge metadata;
[0007] According to the knowledge metadata, basic data of the target IoT device is obtained;
[0008] Obtaining historical data of the target IoT device;
[0009] Obtaining the real-time task corresponding to the target IoT device;
[0010] According to the real-time task, the real-time data of the target IoT device is obtained, and based on the basic data and historical data, the real-time data is stored in a memory dictionary.
[0011] Based on the same inventive concept, the present disclosure provides an IoT device data processing device based on a real-time database, comprising:
[0012] A knowledge metadata acquisition module is configured to acquire knowledge metadata;
[0013] A basic data acquisition module is configured to acquire basic data of a target IoT device according to the knowledge metadata;
[0014] A historical data acquisition module, configured to acquire historical data of the target IoT device;
[0015] A real-time task acquisition module is configured to acquire the real-time task corresponding to the target IoT device;
[0016] The real-time data storage module is configured to obtain the real-time data of the target IoT device according to the real-time task, and store the real-time data in a memory dictionary based on the basic data and historical data.
[0017] Based on the same inventive concept, the present disclosure provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method as described above when executing the program.
[0018] Based on the same inventive concept, the present disclosure provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the above method.
[0019] From the above, it can be seen that the IoT device data processing method and related devices provided by the present disclosure based on the real-time database include: obtaining knowledge metadata; obtaining basic data of the target IoT device according to the knowledge metadata; obtaining historical data of the target IoT device; obtaining real-time tasks corresponding to the target IoT device; according to the real-time tasks, obtaining the real-time data of the target IoT device, and based on the basic data and historical data, storing the real-time data in the memory dictionary. The present disclosure can effectively process IoT device data through the designed real-time database. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the present disclosure or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 A flow chart of a method for processing data of an Internet of Things device based on a real-time database provided in an embodiment of the present disclosure;
[0022] Figure 2 A structural schematic diagram of an IoT device data processing device based on a real-time database provided in an embodiment of the present disclosure;
[0023] Figure 3 A more specific schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0024] In order to make the objectives, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0025] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the embodiments of the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0026] As described in the background technology section, specifically, although the overall functional scope of the Internet of Things is roughly the same as that of industrial control systems, there are still obvious differences between the two. Industrial control systems generally run on reliable real-time connections, and the main operating environment is the industrial control network, while the Internet of Things may run on a slow and unreliable network, generally the Internet; industrial control systems generally use a Windows-style interface, and the Internet of Things generally uses a browser + app user interface; industrial control systems emphasize control and stable operation, and generally use a lower computer to separate control, while the Internet of Things emphasizes monitoring and statistical analysis. Internet of Things applications generally do not have independent lower computers, and industrial control systems can serve as the control end and data acquisition part of the Internet of Things; the number of devices managed by industrial control systems is limited, generally in the hundreds; while the number of devices managed by Internet of Things applications is even larger, and millions are common.
[0027] Real-time database is the core component of industrial control system. The functions of real-time database include real-time data collection and external services, mapping of real-time data of equipment in memory, real-time task scheduling, and historical data management. Internet of Things applications are also inseparable from the support of real-time database. Each commercial industrial control system generally comes with a real-time database product, and there are also independent real-time database software products.
[0028] The real-time database products in related technologies generally have the same functional objectives and the same technical architecture. The core part of real-time database products, device memory mapping, uses variables. That is, the value of a certain indicator of each device is a variable in the real-time database. A variable is essentially a structure, and its main attributes include name, value, data type, and data quality. All real-time databases that use this type of data structure are publicly and uniformly referred to as variable-type real-time databases.
[0029] The variable itself does not have the attributes of equipment and indicators. For a specific application, the variables need to be set according to the actual on-site environment, and the on-site environment of a specific application is different. If you want to achieve product-level development, you cannot directly write abstract algorithms based on variables. Therefore, applications that use variable real-time databases are generally project-based, because variables must be related to a specific project. It is difficult to achieve large-scale applications. When the number of variables reaches a certain amount, such as 10,000, the management of the variables themselves becomes very difficult. In order to maintain the logical relationship of variables, there is generally an Excel description table. To maintain hundreds of thousands of records in an Excel table, the consequences must be catastrophic. The collection time attribute, the current real-time database generally does not have data collection time, which makes it difficult to judge communication interruption. In industrial control systems, communication is generally stable and reliable, but in IoT applications, communication is not necessarily stable and reliable. Therefore, the collection time attribute is required for corresponding processing.
[0030] In view of this, the present disclosure proposes a method and related apparatus for processing data of an Internet of Things device based on a real-time database.
[0031] Figure 1 A flow chart of a method for processing data of an Internet of Things device based on a real-time database provided in an embodiment of the present disclosure; the method for processing data of an Internet of Things device based on a real-time database includes:
[0032] S110. Acquire knowledge metadata.
[0033] In some embodiments, the knowledge metadata includes:
[0034] IoT device types, measurement units, data metrics, and algorithm libraries.
[0035] S120: Acquire basic data of the target IoT device according to the knowledge metadata.
[0036] S130: Acquire historical data of the target IoT device.
[0037] In IoT applications, the real-time data of devices changes very quickly, usually at the millisecond level. If these data are stored in a traditional relational database, due to the need for cross-process access, there will generally be a delay of tens of milliseconds for cross-process access. Even if the IoT has lowered the real-time requirements, it still does not meet the real-time requirements. Therefore, to better meet the real-time requirements, the real-time data of the device needs to be placed in memory, and the real-time database is preferably a shared process with the main application. When new data arrives, the real-time data in memory directly overwrites the original old data. However, the old data still has important analytical and statistical significance, and certain strategies need to be adopted to archive the real-time data. Since the real-time data of the device changes very quickly, and some data archiving and preservation is unnecessary. Therefore, certain strategies need to be adopted to archive the real-time data. The archived data needs to have a higher collection frequency, generally no more than once a minute. Therefore, after running for a period of time, the amount of archived data is very large, often reaching the TB level or more, and traditional database queries often cannot meet the performance requirements.
[0038] The present disclosure proposes a set of definitions, utilization methods and strategies for real-time data. Users and implementers can define real-time data based on devices. Archiving strategies are divided into two types: periodic archiving and change archiving. Periodic archiving: if there is new data within a certain period of time, the data will be archived; change archiving is used for devices that do not change frequently or at special times to compare the alarm occurrence time and the problem diagnosis time. Archiving is based on devices as units. Each time it is archived, the collection time and the real-time data of the device are saved in a compressed manner. The archived data mainly includes three data: device ID, collection time, and index value compressed string. The specific archiving purpose is not limited by the patent of this invention, which can be a file or a relational database. However, the archived data must be stored in chronological order to facilitate quick access later.
[0039] The present disclosure provides a data access method called timestamp for historical data. Timestamp can also be called device snapshot. Data accessors can access the data of the device closest to a certain historical moment. The timestamp data access method is particularly suitable for generating interval quantity calculations based on cumulative quantities. For example, calculate your energy usage, inventory at a certain historical moment, etc. The present disclosure provides a method for quickly accessing timestamp data. Quick access to historical snapshot data is divided into two parts: periodic loading and on-demand access.
[0040] In some embodiments, the acquiring the historical data of the target IoT device includes:
[0041] Initialize the historical snapshot dictionary of the target IoT device; the historical snapshot dictionary is a nested dictionary of snapshot creation time, IoT device identification number, and IoT device archive data;
[0042] Obtaining the operating time of the target IoT device;
[0043] Determine a time interval granularity, use the running time as the interval start time, and obtain the next time interval according to the time interval granularity;
[0044] Archiving records according to the latest time of the interval of the target IoT device; in response to determining that the target IoT device has no records, taking records of the previous time segment;
[0045] The record is used as snapshot data, loaded into the historical snapshot dictionary of the target IoT device, and the required snapshot data is returned.
[0046] In some embodiments, the acquiring the historical data of the target IoT device includes:
[0047] In response to receiving the snapshot request, querying the snapshot time key in the memory snapshot;
[0048] According to the snapshot time key, query the latest snapshot time from the snapshot dictionary;
[0049] The most recent snapshot time and the request time form a time interval;
[0050] Archiving records according to the latest time of the interval of the target IoT device; in response to determining that the target IoT device has no records, taking records of the previous time segment;
[0051] The record is used as snapshot data, loaded into the historical snapshot dictionary of the target IoT device, and the required snapshot data is returned.
[0052] S140: Obtain the real-time task corresponding to the target IoT device.
[0053] In some embodiments, the real-time tasks include:
[0054] Real-time alarm, data archiving, data cleaning and data value-added.
[0055] S150: acquiring the real-time data of the target IoT device according to the real-time task, and storing the real-time data in a memory dictionary based on the basic data and the historical data.
[0056] In some embodiments, the acquiring the real-time data of the target IoT device according to the real-time task and storing the real-time data in a memory dictionary based on the basic data and the historical data includes:
[0057] The real-time data is stored in a nested dictionary of IoT device identity number, indicator identity number, and value; wherein the IoT device identity number is the key of the outer dictionary of the nested dictionary, and the indicator identity number is the key of the inner dictionary of the nested dictionary.
[0058] The present disclosure proposes a new type of real-time database product type, an object real-time database. The core concept is to integrate devices and indicators into the real-time database. One of the core parts of the present disclosure is the mapping part of the device in the memory, which no longer uses variables but adopts an object-oriented form. The access to the real-time data of the device is no longer through the variable name, but through the IoT device identity ID + indicator identity ID.
[0059] In order to improve access efficiency, facilitate algorithm encapsulation, and facilitate project implementation, the mapping of real-time device data in memory adopts a nested dictionary method. The key of the outer dictionary is the IoT device identity number, and the key of the memory dictionary is the indicator identity number. At the same time, the collection time attribute is added to the outer dictionary.
[0060] In order to efficiently access specific device information and indicator data based on IoT device identification numbers and indicator identification numbers, devices and indicators are also stored in memory in the form of a single-layer dictionary. In order to improve the versatility of the algorithm, device type data is also stored in memory, and it is recommended that unified indicator codes and device type codes be shared between different projects.
[0061] In some embodiments, before storing the real-time data in a memory dictionary, the method further includes:
[0062] The real-time data is cleaned and value-added.
[0063] From the above, it can be seen that the IoT device data processing method and related devices provided by the present disclosure based on the real-time database include: obtaining knowledge metadata; obtaining basic data of the target IoT device according to the knowledge metadata; obtaining historical data of the target IoT device; obtaining real-time tasks corresponding to the target IoT device; according to the real-time tasks, obtaining the real-time data of the target IoT device, and based on the basic data and historical data, storing the real-time data in the memory dictionary. The present disclosure can effectively process IoT device data through the designed real-time database.
[0064] It should be noted that the method of the embodiment of the present disclosure can be performed by a single device, such as a computer or a server. The method of the present embodiment can also be applied in a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present disclosure, and the multiple devices will interact with each other to complete the described method.
[0065] It should be noted that the above describes some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0066] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present disclosure also provides an Internet of Things device data processing device based on a real-time database.
[0067] refer to Figure 2 , the IoT device data processing device based on real-time database comprises:
[0068] The knowledge metadata acquisition module 210 is configured to acquire knowledge metadata;
[0069] A basic data acquisition module 220 is configured to acquire basic data of a target IoT device according to the knowledge metadata;
[0070] A historical data acquisition module 230 is configured to acquire historical data of the target IoT device;
[0071] The real-time task acquisition module 240 is configured to acquire the real-time task corresponding to the target IoT device;
[0072] The real-time data storage module 250 is configured to obtain the real-time data of the target IoT device according to the real-time task, and store the real-time data in a memory dictionary based on the basic data and historical data.
[0073] For the convenience of description, the above device is described by dividing it into various modules according to its functions. Of course, when implementing the present disclosure, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0074] The device of the above embodiment is used to implement the corresponding IoT device data processing method based on a real-time database in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0075] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for processing data of an Internet of Things device based on a real-time database as described in any of the above embodiments is implemented.
[0076] Figure 3 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 in the device.
[0077] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0078] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 1020 and are called and executed by the processor 1010.
[0079] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0080] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0081] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).
[0082] It should be noted that, although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040 and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.
[0083] The electronic device of the above-mentioned embodiment is used to implement the corresponding Internet of Things device data processing method based on real-time database in any of the above-mentioned embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0084] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present disclosure also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the Internet of Things device data processing method based on a real-time database as described in any of the above embodiments.
[0085] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0086] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the IoT device data processing method based on a real-time database as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0087] It should be noted that the embodiments of the present disclosure may be further described in the following manner:
[0088] A method for processing data of an Internet of Things device based on a real-time database, comprising:
[0089] Acquire knowledge metadata;
[0090] According to the knowledge metadata, basic data of the target IoT device is obtained;
[0091] Obtaining historical data of the target IoT device;
[0092] Obtaining the real-time task corresponding to the target IoT device;
[0093] According to the real-time task, the real-time data of the target IoT device is obtained, and based on the basic data and historical data, the real-time data is stored in a memory dictionary.
[0094] Optionally, the knowledge metadata includes:
[0095] IoT device types, measurement units, data metrics, and algorithm libraries.
[0096] Optionally, the real-time task includes:
[0097] Real-time alarm, data archiving, data cleaning and data value-added.
[0098] Optionally, the acquiring the real-time data of the target IoT device according to the real-time task, and storing the real-time data in a memory dictionary based on the basic data and the historical data, includes:
[0099] The real-time data is stored in a nested dictionary of IoT device identity number, indicator identity number, and value; wherein the IoT device identity number is the key of the outer dictionary of the nested dictionary, and the indicator identity number is the key of the inner dictionary of the nested dictionary.
[0100] Optionally, before storing the real-time data in the memory dictionary, the method further includes:
[0101] The real-time data is cleaned and value-added.
[0102] Optionally, the acquiring historical data of the target IoT device includes:
[0103] Initialize the historical snapshot dictionary of the target IoT device; the historical snapshot dictionary is a nested dictionary of snapshot creation time, IoT device identification number, and IoT device archive data;
[0104] Obtaining the operating time of the target IoT device;
[0105] Determine a time interval granularity, use the running time as the interval start time, and obtain the next time interval according to the time interval granularity;
[0106] Archiving records according to the latest time of the interval of the target IoT device; in response to determining that the target IoT device has no records, taking records of the previous time segment;
[0107] The record is used as snapshot data, loaded into the historical snapshot dictionary of the target IoT device, and the required snapshot data is returned.
[0108] Optionally, the acquiring historical data of the target IoT device includes:
[0109] In response to receiving the snapshot request, querying the snapshot time key in the memory snapshot;
[0110] According to the snapshot time key, query the latest snapshot time from the snapshot dictionary;
[0111] The most recent snapshot time and the request time form a time interval;
[0112] Archiving records according to the latest time of the interval of the target IoT device; in response to determining that the target IoT device has no records, taking records of the previous time segment;
[0113] The record is used as snapshot data, loaded into the historical snapshot dictionary of the target IoT device, and the required snapshot data is returned.
[0114] A data processing device for Internet of Things devices based on a real-time database, comprising:
[0115] A knowledge metadata acquisition module is configured to acquire knowledge metadata;
[0116] A basic data acquisition module is configured to acquire basic data of a target IoT device according to the knowledge metadata;
[0117] A historical data acquisition module, configured to acquire historical data of the target IoT device;
[0118] A real-time task acquisition module is configured to acquire the real-time task corresponding to the target IoT device;
[0119] The real-time data storage module is configured to obtain the real-time data of the target IoT device according to the real-time task, and store the real-time data in a memory dictionary based on the basic data and historical data.
[0120] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the method described above is implemented when the processor executes the program.
[0121] A non-transitory computer-readable storage medium stores computer instructions, wherein the computer instructions are used to enable a computer to execute the above method.
[0122] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples. Based on the concept of the present disclosure, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present disclosure as described above, which are not provided in detail for the sake of simplicity.
[0123] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present disclosure difficult to understand, the known power / ground connections to the integrated circuit (IC) chips and other components may or may not be shown in the provided figures. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present disclosure difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present disclosure will be implemented (that is, these details should be fully within the scope of understanding of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present disclosure, it is apparent to those skilled in the art that the embodiments of the present disclosure can be implemented without these specific details or with changes in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0124] Although the present disclosure has been described in conjunction with specific embodiments of the present disclosure, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0125] The embodiments of the present disclosure are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present disclosure should be included in the scope of protection of the present disclosure.
Claims
1. A method for processing data of an Internet of Things device based on a real-time database, comprising: Acquire knowledge metadata; According to the knowledge metadata, basic data of the target IoT device is obtained; Obtain the historical data of the target IoT device, including: Initialize the historical snapshot dictionary of the target IoT device; the historical snapshot dictionary is a nested dictionary of snapshot creation time, IoT device identification number, and IoT device archive data; obtain the running time of the target IoT device; determine the time interval granularity, use the running time as the interval start time, and obtain the next time interval according to the time interval granularity; archive records according to the latest time of the interval of the target IoT device; in response to determining that the target IoT device has no records, obtain the records of the previous time segment; use the records as snapshot data, load them into the historical snapshot dictionary of the target IoT device, and return the required snapshot data; Or, in response to receiving a snapshot request, querying a snapshot time key in a memory snapshot; querying a recent snapshot time from a snapshot dictionary according to the snapshot time key; forming a time interval with the recent snapshot time and the request time; archiving records according to the latest time of the interval of the target IoT device; in response to determining that the target IoT device has no records, obtaining records of the previous time segment; using the records as snapshot data, loading them into a historical snapshot dictionary of the target IoT device, and returning the required snapshot data; Obtaining the real-time task corresponding to the target IoT device; According to the real-time task, the real-time data of the target IoT device is obtained, and based on the basic data and the historical data, the real-time data is stored in a memory dictionary, specifically including: storing the real-time data in a nested dictionary of IoT device identity identification number, indicator identity identification number, and value; wherein the IoT device identity identification number is the key of the outer dictionary of the nested dictionary, and the indicator identity identification number is the key of the inner dictionary of the nested dictionary.
2. The method according to claim 1, wherein: The knowledge metadata includes: IoT device types, measurement units, data metrics, and algorithm libraries.
3. The method according to claim 1, wherein: The real-time tasks include: Real-time alarm, data archiving, data cleaning and data value-added.
4. The method according to claim 1, wherein: Before storing the real-time data in the memory dictionary, the method further includes: The real-time data is cleaned and value-added.
5. A data processing device for Internet of Things devices based on a real-time database, comprising: A knowledge metadata acquisition module is configured to acquire knowledge metadata; A basic data acquisition module is configured to acquire basic data of a target IoT device according to the knowledge metadata; The historical data acquisition module is configured to acquire the historical data of the target IoT device, and is specifically configured to: Initialize the historical snapshot dictionary of the target IoT device; the historical snapshot dictionary is a nested dictionary of snapshot creation time, IoT device identification number, and IoT device archive data; obtain the running time of the target IoT device; Determine the time interval granularity, use the running time as the interval start time, and obtain the next time interval according to the time interval granularity; archive the record according to the latest time of the interval of the target IoT device; in response to determining that the target IoT device has no record, obtain the record of the previous time segment; use the record as snapshot data, load it into the historical snapshot dictionary of the target IoT device, and return the required snapshot data; or, in response to receiving a snapshot request, querying a snapshot time key in the memory snapshot; querying a most recent snapshot time from a snapshot dictionary according to the snapshot time key; The most recent snapshot time and the request time form a time interval; archive the records according to the latest time of the interval of the target IoT device; in response to determining that the target IoT device has no records, obtain the records of the previous time segment; use the records as snapshot data, load them into the historical snapshot dictionary of the target IoT device, and return the required snapshot data; A real-time task acquisition module is configured to acquire the real-time task corresponding to the target IoT device; The real-time data storage module is configured to obtain the real-time data of the target IoT device according to the real-time task, and store the real-time data in a memory dictionary based on the basic data and historical data. Specifically, the real-time data is stored in a nested dictionary of IoT device identity number, indicator identity number, and value; wherein the IoT device identity number is the key of the outer dictionary of the nested dictionary, and the indicator identity number is the key of the inner dictionary of the nested dictionary.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 4 when executing the program.
7. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Service-oriented intelligent residential area real-time database system and working method thereof
CN107122422A
Data storage method and device, storage medium and product
CN113297339A