An adaptive mapping method for Internet of Things data monitoring points and register addresses
By using two-level mapping tables and classification hash functions in the embedded system, combined with the two-way linked list method, the problem of large storage space and high search time complexity of sensor data monitoring points and register address mapping is solved, and a mapping method of fast search and adaptive update is realized.
Patent Information
- Application Number
- CN202111610982.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2041-12-27
AI Technical Summary
Prior Art In embedded systems, sensor data monitoring points and register address mapping methods have problems such as large storage space, high search time complexity, and insufficient real-time performance. It is difficult to realize a fast search and general and convenient mapping method in embedded systems.
A two-level mapping table structure is adopted, combining a classification hash function and a two-way linked list to build a mapping network of monitoring points and registers. The monitoring point information collection is divided through a first-level mapping table, and the mapping information and physical addresses are stored in the second-level mapping table. The register addresses are stored using a two-way linked list, which supports adaptive updates.
It realizes the rapid search of sensor data monitoring points and register addresses in embedded systems, reduces storage space usage, ensures real-time and code decoupling, and supports automatic updates and adaptive mapping of new data.
Smart Images

Figure CN114281408B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of Internet of Things, and in particular relates to an Internet of Things data monitoring point and register address adaptive mapping method. Background Art
[0002] In recent years, with the continuous development of the Internet of Things and the digital economy, Internet of Things technology has been widely used in the industrial field. At the same time, obtaining sensor data from the Internet of Things has become the first step to access the Internet of Everything.
[0003] After obtaining the sensor and register values, they need to be displayed to the user or uploaded to the cloud server in the form of monitoring points. A monitoring point abstracts the data attributes to be reported into a field.
[0004] Each monitoring point has a specific mapping relationship with a register. For simple monitoring point mappings, you can directly obtain the mapping by reading the register data. For complex mapping relationships, factors such as code scalability and portability need to be considered.
[0005] Existing technical solutions can be summarized as follows:
[0006] 1) Academia often uses a Translation Lookaside Buffer (TLB). While TLBs can avoid multiple mapping queries to a certain extent, they become increasingly complex as memory mapping increases. Furthermore, mapping multiple page entries often exceeds several megabytes in size, which is unacceptable for embedded systems.
[0007] 2) In his patent [CN 107133233 A], Li Zhenyuan established a single mapping table to store the required parameters. Although the mapping relationship can be established, as the amount of data stored increases, all the data is stored in one table, which makes the mapping table space very large. The time complexity of traversing and searching for the required data is extremely high, which is not real-time enough for embedded systems.
[0008] 3) In his patent [CN 109325086 A], Li Pengwei uses a multi-branch tree mapping structure for discrete geographic data. Although it can form a multi-level mapping, the code implementation is complex and the tree structure occupies too much space, making it unsuitable for embedded systems.
[0009] Therefore, according to the characteristics of the embedded system such as small storage space and high real-time performance, the present invention realizes a mapping method that can be used in the embedded system and can realize fast search and is universal and convenient. Summary of the Invention
[0010] In view of the above problems, the present invention proposes a method for adaptively mapping data monitoring points and register addresses.
[0011] The method is a linear table mapping and includes:
[0012] A mapping network is formed according to the mapping relationship between monitoring points and registers;
[0013] According to the characteristics of the first field of the monitoring point, a classification hash function is used to divide it into a first-level mapping table, where each element of the first-level mapping table corresponds to a type of monitoring point information set;
[0014] According to the first-level mapping table, a second-level mapping table is constructed on this basis. The second-level mapping table stores mapping information, calculates and stores the first address of the physical address, and stores each register linked list.
[0015] The mapping information of the monitoring point is retrieved according to the mapping table. If it is found, the corresponding information is taken out. If it cannot be retrieved, the monitoring point information is added to the secondary mapping table according to the current order and the first address of the physical address is automatically calculated and stored.
[0016] Among them, the classification hash function formula is:
[0017] Hash(key)=(key-65)%26;
[0018] Among them, key is the ASCII code value of the first field of the monitoring point.
[0019] The storage mapping information includes the monitoring point value, the number of corresponding registers, the type and category, and whether an update is required. The 32-bit address information includes the physical address of the register information linked list.
[0020] Among them, the first physical address of the register newly added to store monitoring point mapping information can be dynamically adjusted.
[0021] Among them, the storage mapping uses a bidirectional linked list to store the addresses of the corresponding registers to facilitate search and storage.
[0022] Beneficial effects of the present invention:
[0023] 1) The present invention effectively establishes the mapping between data monitoring points and registers by establishing a two-level mapping table. To ensure better correspondence and versatility between data monitoring points and various types of discontinuous register groups, the registers that need to be matched are put together to form a bidirectional linked list, which is convenient for adding, deleting and searching.
[0024] 2) In view of the small memory space of embedded devices, the information parameters that need to be saved are stored using as few fields as possible.
[0025] 3) At the same time, when adding new data monitoring point information, it is possible to use information parameters to determine whether it needs to be updated without modifying the code, automatically add it, and write it to FLASH, so that after the next restart, the mapping table can be updated to achieve an adaptive effect.
[0026] 4) Separating the physical storage location from the mapping table ensures the decoupling of the code structure. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A flow chart of the monitoring point and register adaptation method of the present invention;
[0028] Figure 2 A mapping network formed between monitoring points and registers of the present invention;
[0029] Figure 3 The first-level mapping table and the initialized second-level mapping table in the present invention;
[0030] Figure 4 It is the secondary mapping table and the bidirectional linked list used for storage in the present invention;
[0031] Figure 5 This is a complete functional diagram of the present invention. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical solutions and beneficial effects of the present invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings and specific examples. Figure 1 This is a flow chart of the monitoring point and register adaptation method of the present invention.
[0033] Step 101: Construct a mapping network based on the mapping relationship between monitoring points and registers.
[0034] It should be noted that the relationship between monitoring points and registers can be divided into one-to-one, one-to-many continuous, and one-to-many discontinuous. For the first two, the value can be obtained by reading the register value. For one-to-many discontinuous, a mapping relationship must be built first. Specific examples are as follows Figure 2 As shown in the figure, the monitoring point A001 corresponds to three different register groups.
[0035] Step 102: Based on the characteristics of the first field of the monitoring point, a classification hash function is used to divide the first field into a first-level mapping table, where each element of the first-level mapping table corresponds to a type of monitoring point information set.
[0036] It should be noted that the classification hash function formula is Hash (key) = (key-65)% 26. A specific example is as follows Figure 3 As shown, S301 is the first-level mapping table, and S302 is the initial second-level mapping table.
[0037] Step 103: Based on the first-level mapping table, a second-level mapping table is constructed. The second-level mapping table stores mapping information, calculates and stores the first address of the physical address, and stores each register linked list.
[0038] It should be noted that the storage mapping information includes the monitoring point value, the number of corresponding registers, the type and type, whether it needs to be updated, and the 32-bit address information includes the physical address of the register information list. Figure 4 As shown in the figure, the storage mapping uses a bidirectional linked list to store the addresses of the corresponding registers, which is convenient for search and storage.
[0039] exist Figure 4 In FIG, S401 and S402 represent the entire contents of the secondary mapping table. S401 consists of three parts: the monitoring point name, the mapping parameter information, and the physical address of the bidirectional linked list.
[0040] The first column in S401 indicates the name of the monitoring point. The second and third columns in S401 are 8-bit data, representing the total number of mapped registers. The maximum number of mappable registers is 255. The fourth and fifth columns in S401 contain a total of 8 bits, the first 7 of which indicate whether a register of that type exists. The corresponding bit number for each register type is shown in S403. The last bit corresponds to the update field: 0 indicates no update is required, and 1 indicates an update is required.
[0041] The last column of S401 stores the physical address of the doubly linked list. If a new mapping register is required for the monitoring point, the address space in the next row of monitoring point mapping information needs to be automatically offset to ensure that the correct data can be obtained.
[0042] S402 is the register corresponding to a monitoring point, and data can be read through the bidirectional linked list. The linked list header is the number of bytes occupied by the entire linked list data.
[0043] Step 104: Retrieve the mapping information of the monitoring point according to the mapping table. If the information is found, extract the corresponding information. If not, add the monitoring point information to the secondary mapping table according to the current order and automatically calculate the first address of the physical address.
[0044] It should be noted that if the corresponding mapping information is not found in the corresponding mapping table, it means that the mapping of the register is not stored in the table. Then you can create a row of mapping information for the monitoring point in the secondary mapping table of the type you are looking for, and set the value of the whether to update field to 1. After the user enters the mapping information again, it can be stored in the secondary mapping table just created, and the value of the whether to update field is set to 0. Finally, the entire mapping table is saved in ROM as a file for re-retrieval after power failure. It should be noted that Figure 5 This is a complete functional diagram of the present invention.
Claims
1. A method for adaptively mapping IoT data monitoring points and register addresses, characterized in that: include: A mapping network is formed according to the mapping relationship between monitoring points and registers; According to the characteristics of the first field of the monitoring point, a classification hash function is used to divide it into a first-level mapping table, where each element of the first-level mapping table corresponds to a type of monitoring point information set; According to the first-level mapping table, a second-level mapping table is constructed on this basis. The second-level mapping table stores mapping information and calculates and stores the first address of the physical address to store each register linked list; Retrieve the mapping information of the monitoring point according to the secondary mapping table. If found, take out the mapping information. If not found, add the mapping information of the monitoring point to the secondary mapping table according to the current order and automatically calculate the first address of the physical address. The storage mapping information includes the monitoring point value, the number of corresponding registers, the type and whether it needs to be updated. The field after the mapping information also includes the physical address of the register information linked list; it also includes the use of a bidirectional linked list to store the address of the corresponding register for easy search and storage.
2. The method for adaptively mapping IoT data monitoring points and register addresses according to claim 1, characterized in that: The classification hash function formula is: Hash(key)=(key-65)%26 The key is the ASCII code value of the first field of the monitoring point.
3. The method for adaptively mapping IoT data monitoring points and register addresses according to claim 1, wherein: The first physical address of the newly added register storing monitoring point data can be adjusted dynamically.
Citation Information
Patent Citations
Processing method and device for configuration data query
CN107133233A
Discrete geographic data archiving management method
CN109325086A
Real-time database for rail transit, operating method and operating device
CN102110134A
Configurable function API monitoring method based on virtualized efficient HASH
CN110046502A