A method and system for data relay and distribution based on internet of things equipment
By configuring formats and library mapping relationships, allocating storage areas and pre-storing device data according to the number of device transmission protocols, the problems of frequent subsystem adaptation and insufficient storage capacity in IoT device data exchange are solved, improving the timeliness of data distribution and storage utilization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-15
- Publication Date
- 2026-03-20
AI Technical Summary
In existing technologies, when IoT devices exchange data, the subsystems of different manufacturers need to be frequently adapted, resulting in a large workload for third-party applications. Furthermore, when the storage capacity of the data transfer station's storage area is running low, manual adjustments are not made in a timely manner, affecting data distribution capabilities.
Based on the IoT device data relay and distribution method, the system configures the format mapping relationship between the device layer and the data relay layer, allocates storage areas according to the number of device transmission protocols, and adjusts the storage capacity through the format and library mapping relationship. Pre-store device data to intelligently adjust the storage area capacity and avoid storage full and memory alarms.
This allows for advance adjustment of storage capacity before storage becomes critical, reducing the latency of human intervention and improving the timeliness of data distribution and the rational utilization of storage space.
Smart Images

Figure CN115509445B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of Internet of Things device data management, and in particular to a method and system for data transfer and distribution based on Internet of Things devices. BACKGROUND
[0002] The current Internet of Things industry is developing at an astonishing speed, and Internet of Things devices have spread to all walks of life, from various industrial Internet of Things devices to home smart devices. With the addition of more and more intelligent hardware, Internet of Things device data exchange has become an urgent need, especially for the exchange of device data from different manufacturers.
[0003] Generally, different Internet of Things devices from the same manufacturer will provide a subsystem for data exchange. However, the subsystems of different manufacturers exist independently, and the data types, data formats, and data storage mechanisms used are also different. If a third-party application needs to use these data, it needs to first develop a push function by each subsystem, and the third-party application develops a receiving function. When each subsystem obtains the latest Internet of Things device data, it pushes the data to the third-party application, but each subsystem needs to adapt to the third-party application, and each subsystem needs to be adapted once for each third-party application, which is a very large workload for each subsystem. Alternatively, each subsystem provides an API interface for reading the latest Internet of Things device data, and the third-party application develops a timed pull function to read the data of each subsystem at fixed times, but the third-party application needs to adapt to multiple different subsystems, and the third-party application needs to be adapted once for each subsystem, which is a very large workload for the third-party application.
[0004] To solve the above problems, in related technologies, a data transfer station is constructed between the third-party application and the subsystem, the data mapping relationship between each subsystem and the data transfer station and the data mapping relationship between the data transfer station and each third-party application are configured in advance based on multiple different protocols, and multiple storage areas are allocated in the data transfer station for data classification storage according to multiple different protocols, which is beneficial to data management and data tracing in the later stage. According to the data mapping relationship, the device data of the subsystem in multiple protocols and multiple data formats can be obtained, the obtained device data is stored in the corresponding storage area in the data transfer station, and the device data is then reverse analyzed and directly mapped to the database of the corresponding third-party application through the data mapping relationship, thereby realizing the rapid acquisition and distribution of device data.
[0005] The inventor considers that the above related art has the following defects: Since the storage spaces of the data transfer stations are shared by the storage areas, the total storage space is divided into multiple storage spaces when the data transfer stations allocate the storage areas, and the storage capacities of the multiple storage spaces need to be monitored simultaneously. When the storage capacity of any storage area is in urgent need, a warning message is automatically sent to the management personnel of the data transfer station, and the management personnel needs to timely adjust the storage capacity of the storage area or sort the stored device data in the storage area. If the management personnel does not timely process, the data transfer and distribution capability of the data transfer station will be affected, and thus the third-party application cannot timely obtain the device data of the subsystem. SUMMARY
[0006] In order to improve the defect that the storage capacity of any storage area needs to be timely adjusted by human beings when the storage capacity is in urgent need, the present application provides a method and system for data transfer and distribution of Internet of Things device data.
[0007] In a first aspect, the present application provides a method for data transfer and distribution of Internet of Things device data, comprising the following steps:
[0008] configuring a format mapping relationship between a system device layer and a data transfer layer, wherein the system device layer comprises multiple Internet of Things subsystems with different device transmission protocols;
[0009] allocating multiple storage areas with the same number as the number of the device transmission protocols in the data transfer layer according to the number of the device transmission protocols;
[0010] configuring a library mapping relationship between an application layer and the data transfer layer, wherein the application layer comprises multiple application devices with different application transmission protocols;
[0011] obtaining system device data of the multiple Internet of Things subsystems in the system device layer based on the storage capacities of the multiple storage areas;
[0012] adjusting the storage capacities of the multiple storage areas according to the obtained system device data;
[0013] mapping the system device data to the corresponding storage areas based on the format mapping relationship;
[0014] distributing the system device data in each storage area to the application devices based on the library mapping relationship.
[0015] By adopting the technical scheme, after the format mapping relationship between the system device layer and the data transfer layer is configured based on the device transmission protocol, a same number of storage areas as the number of protocols can be allocated in the data transfer layer according to the number of device transmission protocols, when the system device data of the plurality of Internet of Things subsystems in the system device layer is acquired, the data acquisition mode can be changed according to the storage capacity of each storage area, so as to avoid the situation that the storage area is suddenly full of data due to the instantaneous acquisition of a large amount of system device data, and after the system device data is acquired, the system device data can be pre-stored, the storage capacity of each storage area is intelligently adjusted in advance according to the data amount of the pre-stored system device data, so as to reasonably utilize all the storage capacity of the data transfer layer as much as possible, and the system device data is mapped to the storage area after the adjustment, compared with the manual adjustment after the memory alarm in the related art, the way of adjusting the storage capacity in advance is more time-efficient.
[0016] Optionally, the acquiring the system device data of the plurality of Internet of Things subsystems in the system device layer based on the storage capacity of each storage area comprises the following steps:
[0017] judging whether there is an over-capacity storage area whose storage capacity exceeds a preset capacity threshold;
[0018] if the over-capacity storage area exists, identifying a target Internet of Things subsystem corresponding to the over-capacity storage area based on the format mapping relationship;
[0019] turning off the data push mode of the target Internet of Things subsystem, and actively pulling the system device data of the target Internet of Things subsystem based on a preset interval time;
[0020] if the over-capacity storage area does not exist, acquiring the system device data pushed by the Internet of Things subsystem or actively pulling the system device data of the Internet of Things subsystem based on the interval time.
[0021] By adopting the technical scheme, the over-capacity storage area with the risk of memory alarm in the storage area is screened out through the preset capacity threshold, and then the target Internet of Things subsystem corresponding to the over-capacity storage area is identified according to the format mapping relationship, and the data push mode of the target Internet of Things subsystem is turned off, so as to reduce the possibility that the over-capacity storage area suddenly stores a large amount of data, thereby avoiding the risk of memory alarm of the over-capacity storage area as much as possible.
[0022] Optionally, the adjusting the storage capacity of each storage area according to the acquired system device data comprises the following steps:
[0023] scanning the storage proportion of all the storage areas;
[0024] after the scanning is completed, judging whether there is a first target storage area whose storage proportion exceeds a preset first proportion threshold;
[0025] if the first target storage area does not exist, predicting a predicted storage proportion of all the storage areas after the system device data obtained is mapped to the corresponding storage areas;
[0026] respectively judging whether each of the predicted storage proportions exceeds a preset second proportion threshold, the second proportion threshold being greater than the first proportion threshold;
[0027] if the predicted storage proportion exceeds the second proportion threshold, adjusting a second target storage capacity of a second target storage area corresponding to the predicted storage proportion.
[0028] By adopting the technical solution, the storage areas are classified by the preset first proportion threshold and the real-time scanning obtained storage proportion, and the storage areas with the storage proportion exceeding the first proportion threshold are divided into the first target storage area. The first target storage area has a higher storage proportion and has a certain memory warning risk. If the result of the proportion comparison is that there is no first target storage area, it is indicated that all the storage areas do not have the memory warning risk at present, and therefore the predicted storage proportion of all the storage areas after the system device data obtained is mapped to the corresponding storage areas can be predicted. Then, whether there is a predicted storage proportion exceeding the preset second proportion threshold is judged. Since the system device data obtained may have a large data volume, the second proportion threshold is preset to be greater than the first proportion threshold. If there is a predicted storage proportion exceeding the second proportion threshold, it is indicated that the second target storage area corresponding to the predicted storage proportion has a higher memory warning risk, and therefore the second target storage capacity of the second target storage area needs to be adjusted.
[0029] Optionally, the method further comprises the following steps:
[0030] if the first target storage area exists, calculating a total storage proportion of the data transfer layer;
[0031] judging whether the total storage proportion exceeds the first proportion threshold;
[0032] if the total storage proportion exceeds the first proportion threshold, enabling a preset standby storage area, and evenly distributing a standby storage capacity of the standby storage area to all the storage areas;
[0033] if the total storage proportion does not exceed the first proportion threshold, distributing a remaining capacity of a non-target storage area to the first target storage area until the storage proportions of all the storage areas are less than the first proportion threshold, the non-target storage area being a storage area other than the first target storage area in the data transfer layer, and the remaining capacity being a capacity required for the storage proportion of the non-target storage area to reach the first proportion threshold.
[0034] By adopting the technical scheme, if there is a first target storage area whose storage ratio exceeds the first ratio threshold in the process of comparing the storage ratios with the first ratio threshold, the total storage ratio of the data transfer layer needs to be calculated first, and whether the total storage of the data transfer layer is large is analyzed and judged by comparing the total storage ratio with the first ratio threshold. If the total storage ratio exceeds the first ratio threshold, it indicates that the total storage of the data transfer layer is large, and the preset standby storage area needs to be started, and the standby storage capacity of the standby storage area is evenly distributed to all storage areas. If the total storage ratio does not exceed the first ratio threshold, it indicates that the total storage of the data transfer layer is small, and the standby storage area can be temporarily not enabled, and the remaining capacity of the non-target storage area is distributed to the first target storage area until the storage ratios of all storage areas are less than the first ratio threshold.
[0035] Optionally, the step of distributing the remaining capacity of the non-target storage area to the first target storage area until the storage ratios of all the storage areas are less than the first ratio threshold comprises the following steps:
[0036] calculating the average excess capacity of all the first target storage areas;
[0037] calculating the average remaining capacity of all the non-target storage areas;
[0038] judging whether the average remaining capacity is greater than the average excess capacity;
[0039] if the average remaining capacity is greater than the average excess capacity, the remaining capacity of the non-target storage area is extracted in descending order of the remaining capacity of the non-target storage area;
[0040] the extracted remaining capacity is distributed to the first target storage area until the storage ratios of all the storage areas are less than the first ratio threshold;
[0041] if the average remaining capacity is less than or equal to the average excess capacity, the remaining capacity of a plurality of non-target storage areas is extracted, and the extracted remaining capacity is distributed to the first target storage area until the storage ratios of all the storage areas are less than the first ratio threshold.
[0042] By adopting the technical scheme, after calculating the average excess capacity of all the first target storage areas and the average remaining capacity of all the non-target storage areas, the macro storage status of all the storage areas can be analyzed by comparing the average excess capacity and the average remaining capacity, so that different ways of capacity distribution are adopted, and the storage ratios of all the storage areas are less than the first ratio threshold after capacity distribution.
[0043] Optionally, the step of adjusting the second target storage capacity of the corresponding second target storage area comprises the following steps:
[0044] calculating a predicted excess capacity of the corresponding second target storage area;
[0045] enabling a preset backup storage area;
[0046] extracting a backup storage capacity equal to the predicted excess capacity from the backup storage area;
[0047] allocating the backup storage capacity to the second target storage area.
[0048] By adopting the technical scheme, since the predicted storage ratio has exceeded the second ratio threshold, the second target storage area corresponding to the predicted storage ratio has a risk of running out of memory, therefore, a preset backup storage area needs to be enabled, and a backup storage capacity is extracted from the backup storage area and allocated to the second target storage area. The extracted backup storage capacity can be equal to the predicted excess capacity of the second target storage area calculated.
[0049] Optionally, the scanning of the storage ratios of all the storage areas includes the following steps:
[0050] obtaining the number of partitions of all the storage areas in the data transfer layer;
[0051] configuring a scanning time interval according to the number of partitions;
[0052] scanning the storage ratios of all the storage areas every other scanning time interval.
[0053] By adopting the technical scheme, if the storage ratios of all the storage areas are to be scanned, each storage area needs to be scanned, and a certain scanning time is required for scanning each storage area. Therefore, when the number of partitions of the storage areas is large, the scanning time required is also long. Therefore, the scanning time interval can be flexibly configured according to the number of partitions, which is beneficial to completely scanning all the storage areas when the number of partitions of the storage areas is large.
[0054] In a second aspect, the present application also provides a system for data transfer and distribution based on Internet of Things equipment, which comprises a memory, a processor, and a program stored in the memory and capable of being executed on the processor. The program can be loaded and executed by the processor to implement the method for data transfer and distribution based on Internet of Things equipment as described in the first aspect.
[0055] By adopting the technical scheme, after the format mapping relationship between the system device layer and the data transfer layer is configured based on the device transmission protocol, a same number of storage areas as the number of the device transmission protocols can be allocated in the data transfer layer according to the number of the device transmission protocols, when the system device data of the plurality of Internet of Things subsystems in the system device layer is acquired, the data acquisition manner can be changed according to the storage capacity of each storage area, so as to avoid the situation that the storage area is suddenly full due to the instantaneous acquisition of a large amount of system device data, after the system device data is acquired, the system device data can be prestored first, the storage capacity of each storage area is intelligently adjusted in advance according to the data amount of the prestored system device data, so as to reasonably utilize all the storage capacities of the data transfer layer as much as possible, and after the adjustment, the system device data is mapped to the storage area, compared with the manual adjustment after the memory alarm in the related art, the way of adjusting the storage capacity in advance is more time-efficient.
[0056] In summary, the present application includes the following beneficial technical effects:
[0057] After the format mapping relationship between the system device layer and the data transfer layer is configured based on the device transmission protocol, a same number of storage areas as the number of the device transmission protocols can be allocated in the data transfer layer according to the number of the device transmission protocols, when the system device data of the plurality of Internet of Things subsystems in the system device layer is acquired, the data acquisition manner can be changed according to the storage capacity of each storage area, so as to avoid the situation that the storage area is suddenly full due to the instantaneous acquisition of a large amount of system device data, after the system device data is acquired, the system device data can be prestored first, the storage capacity of each storage area is intelligently adjusted in advance according to the data amount of the prestored system device data, so as to reasonably utilize all the storage capacities of the data transfer layer as much as possible, and after the adjustment, the system device data is mapped to the storage area, compared with the manual adjustment after the memory alarm in the related art, the way of adjusting the storage capacity in advance is more time-efficient. BRIEF DESCRIPTION OF DRAWINGS
[0058] Figure 1 is a flowchart of one embodiment of the method for transferring and distributing Internet of Things device data according to the present application.
[0059] Figure 2 is a flowchart of one embodiment of the method for transferring and distributing Internet of Things device data according to the present application.
[0060] Figure 3 is a flowchart of one embodiment of the method for transferring and distributing Internet of Things device data according to the present application.
[0061] Figure 4 is a flowchart of one embodiment of the method for transferring and distributing Internet of Things device data according to the present application.
[0062] Figure 5 is a flowchart of one embodiment of a method for data transfer and distribution based on an Internet of Things device.
[0063] Figure 6 is a flowchart of one embodiment of a method for data transfer and distribution based on an Internet of Things device. DETAILED DESCRIPTION
[0064] The following will be described in detail with reference to the accompanying drawings Figures 1 to 6 The present application will be further described in detail.
[0065] The present application discloses a method for data transfer and distribution based on an Internet of Things device.
[0066] Reference Figure 1 The method for data transfer and distribution based on an Internet of Things device comprises the following steps:
[0067] S101. Configure the format mapping relationship between the system device layer and the data transfer layer.
[0068] The Internet of Things subsystem can be a temperature and humidity subsystem, an air conditioning subsystem, and various other kinds of Internet of Things device systems. The system device layer includes multiple Internet of Things subsystems with different device transmission protocols, including Http, Tcp, Mqtt, Websocket, Modubus, Udp, Coap, etc. According to different transmission protocols and the data format required by the protocols, different format mapping relationships between the system device layer and the data transfer layer can be configured. After configuring the format mapping relationship, the device data of the corresponding protocol of the system device layer can be directly mapped to the data transfer layer. The data transfer layer uses a springwebflux reactive programming framework, which can specifically include a data forwarding module, a data source management module, and a data storage module.
[0069] S102. According to the number of protocols of the device transmission protocol, allocate a plurality of storage areas with the same number of protocols in the data transfer layer.
[0070] The number of protocols of the device transmission protocol can be obtained according to the number of configured format mapping relationships, and a plurality of storage areas with the same number of protocols can be allocated in the data storage module of the data transfer layer according to the initial number of protocols. The sum of the storage capacities of all the storage areas is the same as the total capacity of the data storage module. If a new device transmission protocol is added and a new format mapping relationship is configured, a part of the idle capacity of the storage area with the most idle capacity among the plurality of storage areas can be separated as a new storage area.
[0071] S103. Configure the library mapping relationship between the application layer and the data transfer layer.
[0072] The application layer includes application devices of multiple different application transmission protocols, and the application devices are usually third-party application devices. The library mapping relationship supports distribution modes such as Http, Websocket, MQ, JDBC, Dolphindb, and Taos. By configuring a data source of a third-party application system, a library name and a table name are obtained, and a library mapping relationship is constructed through a table field. When data needs to be distributed, the data stored in the data transfer layer is directly reverse parsed into a database mapping of the third-party application system, and different sql syntaxes can be automatically constructed according to different data source forms, and data distribution is completed through the operation of the library.
[0073] S104. Obtain system device data of multiple Internet of Things subsystems in the system device layer based on storage capacities of the storage areas.
[0074] The method of obtaining the system device data includes two methods of actively pulling data of the Internet of Things subsystems and passively receiving data pushed by the Internet of Things subsystems. When the storage capacities of the storage areas are all small, the two methods can be used to obtain the system device data. When the storage capacities of some storage areas are large, only the method of actively pulling is used to obtain the system device data.
[0075] S105. Adjust the storage capacities of the storage areas according to the obtained system device data.
[0076] The obtained system device data is first mapped and pre-stored in a preset pre-storage area, and then the storage capacities of the storage areas are adjusted according to data amounts of the system device data, so as to guarantee normal storage of the system device data. When the system device data is mapped in the corresponding storage area, the same system device data in the pre-storage area will be automatically deleted.
[0077] S106. Map the system device data in the corresponding storage area based on a format mapping relationship.
[0078] S107. Distribute the system device data in the storage areas to the application devices based on a library mapping relationship.
[0079] The implementation principle of the embodiment is as follows:
[0080] After the format mapping relationship between the system device layer and the data transfer layer is configured based on the device transmission protocol, a number of storage areas equal to the number of the device transmission protocols can be allocated in the data transfer layer according to the number of the device transmission protocols. When the system device data of the plurality of Internet of Things subsystems in the system device layer is acquired, the data acquisition manner can be changed according to the storage capacity of each storage area, so as to avoid the situation that the storage area is suddenly full of data due to the acquisition of a large amount of system device data at a moment. After the system device data is acquired, the system device data can be prestored, and the storage capacity of each storage area is intelligently adjusted in advance according to the data amount of the prestored system device data, so as to reasonably utilize all the storage capacities of the data transfer layer as much as possible. After the adjustment, the system device data is mapped to the storage area. Compared with the manual adjustment after the memory alarm in the related art, the manner of adjusting the storage capacity in advance is more time-efficient.
[0081] In one of the embodiments of the present application, referring to Figure 2 , step S104 specifically includes the following steps:
[0082] S201. Determine whether there is an over-capacity storage area whose storage capacity exceeds a preset capacity threshold. If there is an over-capacity storage area, perform step S202; if there is no over-capacity storage area, perform step S204.
[0083] The preset capacity threshold is generally lower than the alarm capacity threshold. The over-capacity storage area can be understood as follows: when a large amount of data is stored in the storage area within a short period of time, the storage capacity of the storage area exceeds the alarm capacity threshold, and the storage area is an over-capacity storage area.
[0084] S202. Identify the target Internet of Things subsystem corresponding to the over-capacity storage area based on the format mapping relationship.
[0085] The system device data of the target Internet of Things subsystem is mapped in the over-capacity storage area.
[0086] S203. Close the data push mode of the target Internet of Things subsystem, and actively pull the system device data of the target Internet of Things subsystem based on a preset interval time.
[0087] In order to avoid the memory alarm of the over-capacity storage area due to the sudden storage of a large amount of data, the data push mode of the target Internet of Things subsystem can be closed, and only the data of the target Internet of Things subsystem is actively pulled.
[0088] S204. Acquire the system device data pushed by the Internet of Things subsystem or actively pull the system device data of the Internet of Things subsystem based on the interval time.
[0089] The implementation principle of the present embodiment is as follows:
[0090] The preset capacity threshold is used to screen the super-capacity storage area with the memory warning risk in the storage area, and then the target Internet of Things subsystem corresponding to the super-capacity storage area is identified according to the format mapping relationship, and the data pushing mode of the target Internet of Things subsystem is closed, so as to reduce the possibility of sudden storage of a large amount of data in the super-capacity storage area, thereby avoiding the risk of memory warning in the super-capacity storage area as much as possible.
[0091] In one of the embodiments of the present application, with reference to Figure 3 , step S105 specifically includes the following steps:
[0092] S301. Scan the storage proportion of all storage areas.
[0093] The storage proportion of the storage area is calculated according to the formula: (used capacity of the storage area / total capacity of the storage area)*100%=storage proportion of the storage area.
[0094] S302. After the scanning is completed, it is judged whether there is a first target storage area with the storage proportion exceeding the preset first proportion threshold value, if there is no first target storage area, step S303 is executed, and if there is a first target storage area, step S306 is executed.
[0095] S303. Predict the predicted storage proportion of all storage areas after the obtained system device data is mapped to the corresponding storage area.
[0096] The predicted storage proportion is calculated according to the formula: (used capacity of the storage area+predicted capacity value) / total capacity of the storage area*100%=predicted storage proportion of the storage area.
[0097] S304. It is respectively judged whether each predicted storage proportion exceeds the preset second proportion threshold value, if the predicted storage proportion exceeds the second proportion threshold value, step S305 is executed.
[0098] The first proportion threshold value is a risk warning threshold value, the second proportion threshold value is an alarm threshold value, and the second proportion threshold value is greater than the first proportion threshold value. If the determination result is that all predicted storage proportions do not exceed the second proportion threshold value, the storage capacity of each storage area is not adjusted.
[0099] S305. Adjust the second target storage capacity of the corresponding second target storage area.
[0100] S306. Calculate the total storage proportion of the data transfer layer.
[0101] First, the sum of the stored capacities of all storage areas in the data transfer layer is calculated, and then the sum of the stored capacities is divided by the maximum storage capacity upper limit of the data transfer layer, so that the total storage proportion of the data transfer layer at present can be calculated.
[0102] S307. Determine whether the total storage ratio exceeds the first ratio threshold, if the total storage ratio exceeds the first ratio threshold, execute step S308; if the total storage ratio does not exceed the first ratio threshold, execute step S309.
[0103] S308. Enable the preset standby storage area, and evenly distribute the standby storage capacity of the standby storage area to all storage areas.
[0104] Among them, when the standby storage area is enabled, the target system device data in the data transfer layer is selected in chronological order, the target system device data is uploaded to the preset cloud database, and the target system device data in the data transfer layer is cleared.
[0105] S309. Distribute the remaining capacity of the non-target storage area to the first target storage area until the storage ratio of all storage areas is less than the first ratio threshold.
[0106] Among them, the non-target storage area is a storage area in the data transfer layer other than the first target storage area, and the remaining capacity is the capacity required for the storage ratio of the non-target storage area to reach the first ratio threshold.
[0107] The implementation principle of the embodiment is:
[0108] First, the storage areas are classified by the preset first ratio threshold and the real-time scanned storage ratio, and the storage areas whose storage ratio exceeds the first ratio threshold can be divided into the first target storage area. The storage ratio of the first target storage area is high, and it has a certain risk of memory warning. If the proportion comparison is performed one by one and the determination result is that there is no first target storage area, it means that all storage areas do not have the risk of memory warning at the moment, so the predicted storage ratio of all storage areas after the obtained system device data is mapped to the corresponding storage area can be predicted. Then, whether there is a predicted storage ratio exceeding the second ratio threshold is determined by the preset second ratio threshold. Since the obtained system device data may have a large data volume, the second ratio threshold will be preset to be larger than the first ratio threshold. If there is a predicted storage ratio exceeding the second ratio threshold, it means that the second target storage area corresponding to the predicted storage ratio has a high risk of memory warning, so the second target storage capacity of the second target storage area needs to be adjusted.
[0109] If there is a first target storage area whose storage ratio exceeds the first ratio threshold in the comparison between the storage ratio and the first ratio threshold, the total storage ratio of the data transfer layer needs to be calculated first, and then the total storage ratio is compared with the first ratio threshold to analyze and determine whether the total storage of the data transfer layer is large. If the total storage ratio exceeds the first ratio threshold, it indicates that the total storage of the data transfer layer is large, and the preset standby storage area needs to be started, and the standby storage capacity of the standby storage area is evenly distributed to all storage areas. If the total storage ratio does not exceed the first ratio threshold, it indicates that the total storage of the data transfer layer is small, and the standby storage area can be temporarily not enabled, and the remaining capacity of the non-target storage area is distributed to the first target storage area until the storage ratio of all storage areas is less than the first ratio threshold.
[0110] In one of the embodiments of the present application, referring to Figure 4 , step S309 specifically includes the following steps:
[0111] S401. Calculate the average excess capacity of all first target storage areas.
[0112] First, the excess capacity of each first target storage area needs to be calculated respectively, and the excess capacity calculation formula is: excess capacity = (first target storage area total capacity * storage ratio) - (first target storage area total capacity * first ratio threshold), and then the total excess capacity of all first target storage areas is divided by the number of first target storage areas, and the average excess capacity can be calculated.
[0113] S402. Calculate the average remaining capacity of all non-target storage areas.
[0114] Since the remaining capacity is the capacity required for the storage ratio of the non-target storage area to reach the first ratio threshold, the total remaining capacity of all non-target storage areas is calculated first, and then the total remaining capacity is divided by the number of non-target storage areas, and the average remaining capacity can be calculated.
[0115] S403. Determine whether the average remaining capacity is greater than the average excess capacity. If the average remaining capacity is greater than the average excess capacity, execute step S404; if the average remaining capacity is less than or equal to the average excess capacity, execute step S406.
[0116] S404. Extract the remaining capacity of the non-target storage area in the order from large to small according to the remaining capacity of the non-target storage area.
[0117] If the determination result of step S403 is that the average remaining capacity is greater than the average excess capacity, it indicates that there are multiple non-target storage areas with high remaining capacity in all storage areas, so the remaining capacity can be extracted from the non-target storage area for distribution, and the extraction order is the order from large to small according to the remaining capacity.
[0118] S405. Distribute the extracted remaining capacity to the first target storage area until the storage proportion of all storage areas is less than the first proportion threshold.
[0119] For example, first, a preset target remaining capacity is extracted from the non-target storage area with the largest remaining capacity, and the storage proportion of the non-target storage area after the target remaining capacity is extracted is still less than the first proportion threshold. Then, the target remaining capacity is distributed to the first target storage area one by one until the storage proportion of all storage areas is less than the first proportion threshold or the target remaining capacity is distributed completely. If the target remaining capacity is distributed completely and there is still a first target storage area, the target remaining capacity of the next non-target storage area is extracted, and the process is continued until the storage proportion of all storage areas is less than the first proportion threshold.
[0120] S406. Extract the remaining capacity of the plurality of non-target storage areas, and distribute the extracted remaining capacity to the first target storage area until the storage proportion of all storage areas is less than the first proportion threshold.
[0121] If the determination result of step S403 is that the average remaining capacity is less than or equal to the average excess capacity, it means that there are a plurality of first target storage areas with high excess capacity. Therefore, the remaining capacity needs to be extracted from a plurality of non-target storage areas, and the extracted remaining capacity needs to be distributed to the first target storage area until the storage proportion of all storage areas is less than the first proportion threshold.
[0122] The implementation principle of the embodiment is as follows:
[0123] After calculating the average excess capacity of all first target storage areas and the average remaining capacity of all non-target storage areas, the macro storage status of all storage areas can be analyzed by comparing the average excess capacity and the average remaining capacity, so that different ways of capacity distribution are adopted, and the storage proportion of all storage areas is less than the first proportion threshold after capacity distribution.
[0124] In one of the implementation manners of the embodiment of the present application, with reference to Figure 5 , step S305 specifically includes the following steps:
[0125] S501. Calculate the predicted excess capacity of the corresponding second target storage area.
[0126] The predicted excess capacity calculation formula is: predicted excess capacity = (total capacity of the second target storage area * predicted storage proportion) - (total capacity of the second target storage area * second proportion threshold).
[0127] S502. Enable the preset standby storage area.
[0128] When the standby storage area is enabled, the target system device data in the data transfer layer is selected in chronological order, the target system device data is uploaded to the preset cloud database, and the target system device data in the data transfer layer is cleared.
[0129] S503. Extracting the same standby storage capacity as the predicted excess capacity from the standby storage area.
[0130] S504. Assigning the standby storage capacity to the second target storage area.
[0131] The implementation principle of the embodiment is:
[0132] Since the predicted storage ratio has exceeded the second ratio threshold, the second target storage area corresponding to the predicted storage ratio has a risk of running out of memory, so a preset standby storage area needs to be enabled, and standby storage capacity is extracted from the standby storage area and assigned to the second target storage area. The extracted standby storage capacity can be equal to the calculated predicted excess capacity of the second target storage area.
[0133] In one of the embodiments of the present application, with reference to Figure 6 , step S301 specifically includes the following steps:
[0134] S601. Obtain the number of partitions of all storage areas in the data transfer layer.
[0135] S602. Configure a scanning time interval according to the number of partitions.
[0136] The more the number of partitions, the longer the configured scanning time interval.
[0137] S603. Scan the storage ratio of all storage areas every scanning time interval.
[0138] The implementation principle of the embodiment is:
[0139] If the storage ratios of all storage areas are to be scanned, each storage area needs to be scanned, and a certain scanning time is required for each storage area. Therefore, when the number of partitions of the storage area is large, the required scanning time is also longer. Therefore, the scanning time interval can be flexibly configured according to the number of partitions, which is beneficial to completely scanning all storage areas when the number of partitions of the storage area is large.
[0140] The embodiment of the present application also discloses a system for transferring and distributing data of Internet of Things equipment, which comprises a memory, a processor and a program stored in the memory and executable on the processor. Figures 1 to 6 The program can be loaded and executed by the processor to implement the method for transferring and distributing data of Internet of Things equipment shown in the embodiment.
[0141] The implementation principle of the embodiment is:
[0142] The above are all preferred embodiments of the present application, and are not intended to limit the protection scope of the present application, so that: any equivalent changes made according to the structure, shape, principle of the present application should be covered within the protection scope of the present application.
Claims
1. A method for data relay and distribution based on IoT devices, characterized in that, Includes the following steps: Configure the format mapping relationship between the system device layer and the data relay layer, wherein the system device layer includes multiple IoT subsystems with different device transmission protocols; Based on the number of protocols in the device transmission protocol, allocate multiple storage areas in the data transfer layer that are the same number as the number of protocols; Configure the library mapping relationship between the application layer and the data relay layer, wherein the application layer contains multiple application devices with different application transmission protocols; Based on the storage capacity of each of the storage areas, obtain system device data of multiple IoT subsystems in the system device layer; Adjust the storage capacity of each storage area according to the acquired system device data; Based on the format mapping relationship, the system device data is mapped to the corresponding storage area; Based on the library mapping relationship, the system device data in each of the storage areas is distributed to the application devices; The step of obtaining system device data of multiple IoT subsystems in the system device layer based on the storage capacity of each storage area includes the following steps: determining whether there is an overcapacity storage area whose storage capacity exceeds a preset capacity threshold; if the overcapacity storage area exists, identifying the target IoT subsystem corresponding to the overcapacity storage area based on the format mapping relationship; disabling the data push mode of the target IoT subsystem, and actively pulling the system device data of the target IoT subsystem based on a preset interval; if the overcapacity storage area does not exist, obtaining the system device data pushed by the IoT subsystem or actively pulling the system device data of the IoT subsystem based on the interval.
2. The method for data relay and distribution based on IoT devices according to claim 1, characterized in that, The step of adjusting the storage capacity of each storage area based on the acquired system device data includes the following steps: Scan the storage percentage of all said storage areas; After the scan is completed, it is determined whether there is a first target storage area whose storage ratio exceeds a preset first ratio threshold; If the first target storage area does not exist, the predicted storage ratio of all storage areas after the acquired system device data is mapped to the corresponding storage area is predicted. Each of the predicted storage ratios is determined to be greater than a preset second ratio threshold, where the second ratio threshold is greater than the first ratio threshold. If the predicted storage ratio exceeds the second ratio threshold, then the second target storage capacity of the corresponding second target storage area is adjusted.
3. The method for data relay and distribution based on IoT devices according to claim 2, characterized in that, The method further includes the following steps: If the first target storage area exists, then calculate the total storage ratio of the data transfer layer; Determine whether the total storage ratio exceeds the first ratio threshold; If the total storage ratio exceeds the first ratio threshold, a preset backup storage area is activated, and the backup storage capacity of the backup storage area is evenly distributed to all the storage areas. If the total storage ratio does not exceed the first ratio threshold, the remaining capacity of the non-target storage area is allocated to the first target storage area until the storage ratio of all the storage areas is less than the first ratio threshold. The non-target storage area is the storage area outside the first target storage area in the data transfer layer, and the remaining capacity is the capacity required for the storage ratio of the non-target storage area to reach the first ratio threshold.
4. The method for data relay and distribution based on IoT devices according to claim 3, characterized in that, The step of allocating the remaining capacity of non-target storage areas to the first target storage area until the storage ratio of all the storage areas is less than the first ratio threshold includes the following steps: Calculate the average overcapacity of all first target memory areas; Calculate the average remaining capacity of all non-target memory areas; Determine whether the average remaining capacity is greater than the average overcapacity; If the average remaining capacity is greater than the average overcapacity, then the remaining capacity of the non-target storage areas is extracted sequentially in descending order of their remaining capacity. The extracted remaining capacity is allocated to the first target storage area until the storage ratio of all the storage areas is less than the first ratio threshold. If the average remaining capacity is less than or equal to the average overcapacity, then the remaining capacity of multiple non-target storage areas is extracted, and the extracted remaining capacity is allocated to the first target storage area until the storage ratio of all storage areas is less than the first ratio threshold.
5. The method for data relay and distribution based on IoT devices according to claim 2, characterized in that, The adjustment of the second target storage capacity of the corresponding second target storage area includes the following steps: Calculate the predicted excess capacity of the corresponding second target storage area; Enable the default backup storage area; Extract the same amount of spare storage capacity as the predicted excess capacity from the spare storage area; The spare storage capacity is allocated to the second target storage area.
6. The method for data relay and distribution based on IoT devices according to claim 2, characterized in that, The process of scanning the storage ratio of all said storage areas includes the following steps: Obtain the number of partitions in all storage areas of the data transfer layer; Configure the scan time interval according to the number of partitions; The storage ratio of all the storage areas is scanned at each of the scan intervals.
7. A system for data relay and distribution based on Internet of Things (IoT) devices, characterized in that, It includes a memory, a processor, and a program stored in the memory and executable on the processor, which, when loaded and executed by the processor, implements a method for data relay and distribution based on IoT devices as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Industrial Internet of Things system beneficial to system expansibility and control method
CN114629940A