A multi-parameter dynamic sampling method and device thereof
By dynamically adjusting the sampling rate of terminal equipment parameters, the data loss and excessive system load caused by high sampling rate parameters are solved, and the reliability and efficiency of data sampling are improved.
Patent Information
- Application Number
- CN202080101675.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-21
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2040-07-21
AI Technical Summary
In the field of industrial automation, the number of terminal devices connected to intelligent gateways is huge, and the parameter sampling rate of each terminal device is different. The high sampling rate parameters occupy serious resources, resulting in data loss and excessive system load, affecting data analysis and fault diagnosis.
The multi-parameter dynamic sampling method is used to dynamically adjust the sampling rate of each sampling parameter. By configuring at least two sampling rates, the load of each parameter is calculated, and the high load parameters are determined after sorting. The high load parameters are downsampled when data loss occurs, avoid data loss and improve sampling reliability.
It effectively avoids data loss, reduces system load, improves the reliability and efficiency of the sampling process, and ensures the normal progress of cloud data analysis and fault diagnosis.
Smart Images

Figure CN115917463B_ABST
Abstract
Description
Technical Field
[0001] The present invention mainly relates to the field of industrial automation, and particularly relates to a multi-parameter dynamic sampling method and device thereof. Background Art
[0002] The Internet of Things system is widely applied to the field of industrial automation, and generally includes terminal devices, intelligent gateways and cloud servers. The intelligent gateway is connected to a plurality of terminal devices, and collects a plurality of parameters of the plurality of terminal devices at a preset period, and then sends a data packet composed of the parameters to the cloud server, and the cloud server analyzes and processes the data packet.
[0003] In practical applications, the number of terminal devices connected to the intelligent gateway is quite large, and each parameter of each terminal device has a different sampling rate, and some of the parameters have a very high sampling rate (sampling period is less than 1 second). However, a large number of parameters with high sampling rates will seriously occupy the resources of the terminal devices, affect the normal operation of the terminal devices, cause the response messages of the terminal devices to be slow, and all parameters cannot be collected within the preset collection period, resulting in data loss, which is not conducive to data analysis and fault diagnosis by the cloud. On the other hand, due to the limited processing capacity of the intelligent gateway, for sampling parameters with a relatively high sampling rate, or having a large number of sub-parameters, or a long length, or being retried multiple times, it will cause the load of the intelligent gateway to be too high, and also cause data loss, and in severe cases, the system may crash. Summary of the Invention
[0004] In order to solve the above technical problems, the present invention provides a multi-parameter dynamic sampling method and device thereof, which can dynamically adjust the sampling rate of parameters, avoid data loss and improve the reliability of sampling.
[0005] To achieve the above object, the present invention proposes a multi-parameter dynamic sampling method, the method comprising: configuring at least two sampling rates for each sampling parameter in the multi-parameters; selecting one sampling rate from at least two sampling rates of each sampling parameter to sample the corresponding sampling parameter; calculating the load of each sampling parameter at the selected sampling rate, sorting the sampling parameters according to the load size, and determining the high-load sampling parameters according to the sorting result; judging whether data loss occurs in all the sampling parameters, and if data loss occurs in at least one sampling parameter, downsampling the high-load sampling parameters within the range of at least two configured sampling rates. For this reason, when data loss occurs in the sampling parameters, downsampling the high-load parameters within the range of at least two configured sampling rates can reduce the total load, avoid data loss and improve the reliability of sampling.
[0006] In an embodiment of the present invention, the method further includes: determining sampling parameters for low load according to the sorting result, and if no data loss occurs in all the sampling parameters, upsampling the sampling parameters for low load within the range of at least two configured sampling rates. To this end, upsampling the sampling parameters for low load when no data loss occurs can accelerate the sampling process of the sampling parameters for low load and improve the sampling efficiency.
[0007] In an embodiment of the present invention, configuring priorities for each of the sampling parameters includes: configuring priorities for each of the sampling parameters and fixing the sampling rate of the sampling parameter with the highest priority.
[0008] In an embodiment of the present invention, configuring priorities for each of the sampling parameters includes: obtaining the priorities of the sampling parameters from a cloud server. To this end, it can be ensured that the sampling rate of the sampling parameter with the highest priority is not adjusted, improving the sampling security.
[0009] In an embodiment of the present invention, after configuring at least two sampling rates for each of the sampling parameters, it includes: calculating the load of each sampling parameter at the lowest sampling rate, calculating the total load according to the load of each sampling parameter, comparing the total load with a preset value, and if the total load is greater than the preset value, displaying an overload prompt message. To this end, by displaying an overload prompt message when the total load of each sampling parameter at the lowest sampling rate is greater than the preset value, it can be prompted to the user that the current parameter configuration still exceeds the system load, and the user can reconfigure at least two sampling rates of the sampling parameters according to the overload prompt message to avoid data loss.
[0010] In an embodiment of the present invention, it further includes: sorting the sampling parameters according to the load at the lowest sampling rate and displaying the sorting result of the sampling parameters. To this end, by displaying the result of sorting the sampling parameters according to the load at the lowest sampling rate, the user can preferentially adjust the sampling rate of the sampling parameter with a larger load according to the load situation, thereby improving the adjustment efficiency.
[0011] In an embodiment of the present invention, it is judged whether data loss occurs in all the sampling parameters. If data loss occurs in at least one sampling parameter, downsampling the parameter with the highest load within the range of at least two configured sampling rates. To this end, adjusting the sampling rate of the sampling parameter with the highest load can reduce the complexity and improve the sampling stability.
[0012] In an embodiment of the present invention, it is characterized in that judging whether data loss occurs in all the sampling parameters includes: checking the sampling result at a preset period. If there are sampling parameters with unchanged states during the check, it is determined that data loss occurs in the sampling parameters. To this end, it can quickly judge whether data loss occurs in the sampling parameters.
[0013] The present invention also provides a multi-parameter dynamic sampling device, which includes: a configuration unit for configuring at least two sampling rates for each sampling parameter among the multi-parameters; a sampling unit for selecting one sampling rate from at least two sampling rates of each sampling parameter to sample the corresponding sampling parameter; a calculation unit for calculating the load of each sampling parameter at the selected sampling rate, sorting the sampling parameters according to the load size, and determining the sampling parameters with high load according to the sorting result; an adjustment unit for judging whether all the sampling parameters have data loss. If at least one sampling parameter has data loss, downsampling is performed on the sampling parameters with high load within the range of at least two configured sampling rates.
[0014] In an embodiment of the present invention, the calculation unit further determines the sampling parameters with low load according to the sorting result. If no data loss occurs in all sampling parameters, the adjustment unit also performs upsampling on the sampling parameters with low load within the range of at least two configured sampling rates.
[0015] In an embodiment of the present invention, the configuration unit configuring priorities for each sampling parameter includes: configuring priorities for each sampling parameter and fixing the sampling rate of the sampling parameter with the highest priority.
[0016] In an embodiment of the present invention, the configuration unit configuring priorities for each sampling parameter includes: obtaining the priorities of the sampling parameters from a cloud server.
[0017] In an embodiment of the present invention, after the configuration unit configures at least two sampling rates for each sampling parameter, it includes: calculating the load of each sampling parameter at the lowest sampling rate, calculating the total load according to the load of each sampling parameter, comparing the total load with a preset value. If the total load is greater than the preset value, an overload prompt message is displayed.
[0018] In an embodiment of the present invention, the configuration unit further includes: sorting the sampling parameters according to the load size at the lowest sampling rate and displaying the sorting result of the sampling parameters.
[0019] In an embodiment of the present invention, the adjustment unit judges whether all the sampling parameters have data loss. If at least one sampling parameter has data loss, downsampling is performed on the parameter with the highest load within the range of at least two configured sampling rates.
[0020] In an embodiment of the present invention, the adjustment unit judging whether all the sampling parameters have data loss includes: checking the sampling results at a preset period. If there are sampling parameters whose states have not changed during the check, it is determined that the sampling parameters have data loss.
[0021] The present invention also provides an intelligent gateway, which includes a processor, a memory, and instructions stored in the memory. When the instructions are executed by the processor, the above-described method is implemented.
[0022] The present invention also provides an Internet of Things system, which includes the intelligent gateway described above.
[0023] The present invention also provides a computer-readable storage medium, on which computer instructions are stored. When the computer instructions are run, the method according to the above is executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The following drawings are only intended to illustrate and explain the present invention schematically, and do not limit the scope of the present invention. Among them,
[0025] Figure 1 is a schematic structural diagram of an Internet of Things system according to an embodiment of the present invention;
[0026] Figure 2 is a flowchart of a multi-parameter dynamic sampling method according to an embodiment of the present invention;
[0027] Figure 3 is a schematic diagram of a sampling result according to an embodiment of the present invention;
[0028] Figure 4 is a schematic diagram of a multi-parameter dynamic sampling device according to an embodiment of the present invention.
[0029] DESCRIPTION OF THE REFERENCE NUMERALS
[0030] 100 Internet of Things system
[0031] 110 Terminal device
[0032] 120 Intelligent gateway
[0033] 130 Cloud server
[0034] 200 Multi-parameter dynamic sampling method
[0035] S210-S240 Steps
[0036] 300 Sampling result
[0037] 400 Multi-parameter dynamic sampling device
[0038] 410 Configuration unit
[0039] 420 Sampling unit
[0040] 430 Calculation unit
[0041] 440 Adjustment unit Detailed implementation manners
[0042] For a clearer understanding of the technical features, objectives, and effects of the present invention, the specific implementation manners of the present invention will now be described with reference to the accompanying drawings.
[0043] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. However, the present invention may be implemented in other ways different from those described herein, and thus the present invention is not limited by the specific embodiments disclosed below.
[0044] As shown in the present application and the claims, unless the context clearly indicates otherwise, words such as "a", "an", "one", and / or "the" are not specifically singular and may also include the plural. Generally speaking, the terms "comprising" and "including" only indicate the inclusion of the steps and elements that have been clearly identified, and these steps and elements do not constitute an exclusive list. A method or device may also include other steps or elements.
[0045] Figure 1 is a schematic structural diagram of an Internet of Things system 100 according to an embodiment of the present invention. As Figure 1 shown, the Internet of Things system 100 includes terminal devices 110, an intelligent gateway 120, and a cloud server 130. The intelligent gateway 120 is connected to a plurality of terminal devices, and the intelligent gateway 120 is also connected to the cloud server 130. The intelligent gateway 120 sends request messages to the terminal devices 110 at a preset period, and the terminal devices 110 return result messages to the intelligent gateway 120, thereby collecting a plurality of parameters of the plurality of terminal devices 110. The plurality of parameters form a data packet, and the intelligent gateway 120 sends the data packet to the cloud server 130, and the cloud server 130 analyzes and processes the data packet. The plurality of terminal devices 110 may generate the same plurality of parameters or different plurality of parameters.
[0046] In practical applications, the number of terminal devices 110 connected to the intelligent gateway 120 is extremely large, and each parameter of each terminal device 110 has a different sampling rate, and some of the parameters have a very high sampling rate (sampling period less than 1 second). However, a large number of parameters with a high sampling rate will seriously occupy the resources of the terminal devices 110, affect the normal operation of the terminal devices 110, cause the response messages of the terminal devices 110 to be sluggish, and all parameters cannot be collected within the preset collection period, resulting in data loss, which is not conducive to the cloud server 130 for data analysis and fault diagnosis. On the other hand, due to the limited processing capacity of the intelligent gateway 120, for sampling parameters with a relatively high sampling rate, or having a large number of sub-parameters, or a long length, or being retried multiple times, it will cause the load of the intelligent gateway 120 to be too high, and data loss will also occur. In severe cases, the Internet of Things system 100 may crash.
[0047] The present invention provides a multi-parameter dynamic sampling method and apparatus, which can dynamically adjust the sampling rate of parameters, avoid data loss, and improve the reliability of acquisition.
[0048] Figure 2 It is a flowchart of a multi-parameter dynamic sampling method according to an embodiment of the present invention. The multi-parameter dynamic sampling method in the embodiments of the present invention can be implemented in an Internet of Things system as shown in Figure 1 It can be understood that the dynamic sampling method in the present invention is not limited to this, and can also be applied to other parameter acquisition scenarios. As shown in Figure 2 As shown, the dynamic sampling method includes:
[0049] Step S210, configure at least two sampling rates for each sampling parameter among the multi-parameters.
[0050] In this step, at least two sampling rates are configured for each sampling parameter, and the sampling parameter can be sampled at any one of the at least two configured sampling rates. The at least two sampling rates configured for the sampling parameter can be manually input by the user or automatically obtained according to historical information. In some cases, a part of the at least two sampling rates configured for the sampling parameter is manually input by the user, and the other part is automatically obtained according to historical information. It should be noted that the sampling rate and the sampling period are reciprocal to each other. The sampling rate can be directly configured, or the sampling rate can be configured through the sampling period. For the convenience of description, the present invention uniformly uses the sampling rate. As a non-limiting example, three sampling rates of 50Hz, 100Hz, and 200Hz can be configured for the sampling parameter of the temperature of a terminal device 110.
[0051] In an optional case, configure a priority for each sampling parameter and fix the sampling rate of the sampling parameter with the highest priority. In the embodiments of the present invention, the priority of the sampling parameter increases with its importance, that is, the higher the importance of the sampling parameter, the higher its priority. For the sampling parameter with the highest priority, fix its sampling rate, that is, its sampling rate cannot be adjusted. Through this setting, it can be ensured that the sampling rate of the sampling parameter with the highest priority is not adjusted, improving the safety of sampling. The priority configured for each sampling parameter can be manually input by the user.
[0052] In some embodiments, configuring a priority for each sampling parameter may include: obtaining the priority of the sampling parameter from a cloud server. The priorities configured for the sampling parameters by other users are stored on the cloud server. By obtaining the priority of the sampling parameter from the cloud server, the automatic acquisition of the priority of the sampling parameter can be realized, and at the same time, the cloud server analyzes and processes the priorities of the sampling parameters configured by multiple users, which can improve the accuracy of the pushed priority.
[0053] In an alternative case, after configuring at least two sampling rates for each sampling parameter, it includes: calculating the load of each sampling parameter at the lowest sampling rate, calculating the total load based on the load of each sampling parameter, comparing the total load with a preset value, and if the total load is greater than the preset value, displaying an overload prompt message.
[0054] After configuring at least two sampling rates for each sampling parameter, if the total load of each sampling parameter at the lowest sampling rate still exceeds the preset value, the system is still operating overloaded, which will cause some sampling parameters to be unable to be collected, resulting in data loss and affecting the system performance. By displaying an overload prompt message when the total load of each sampling parameter at the lowest sampling rate is greater than the preset value, it can prompt the user that the current parameter configuration still exceeds the system load, and the user can reconfigure at least two sampling rates of the sampling parameters according to the overload prompt message to avoid data loss.
[0055] Exemplarily, the load of each sampling parameter at the lowest sampling rate can be calculated by formula (1), and the total load can be calculated by formula (2).
[0056]
[0057]
[0058] Wherein, L n,min represents the load of parameter n at the lowest sampling rate, e represents the average retry times of parameter n, h represents the number of sub-parameters i of parameter n, l represents the word length of sub-parameter i, ll represents the priority of parameter n, T max represents the maximum sampling period of parameter n (corresponding to the lowest sampling rate), N represents the number of parameter n, La represents the total load of each sampling parameter at the lowest sampling rate, and A, B, C, D are constants.
[0059] Exemplarily, the priority values can be set to eleven levels: 0, 1, 2,..., 8, 9, 10. The lower the priority value, the higher the priority. For the sampling parameter with the highest priority, its priority value is 0.
[0060] In an alternative case, after displaying the overload information, it further includes: sorting the sampling parameters according to the load at the lowest sampling rate and displaying the sorting result of the sampling parameters. By displaying the sorting result of the sampling parameters according to the load at the lowest sampling rate, the user can preferentially adjust the sampling rate of the sampling parameter with a larger load according to the load situation, thereby improving the adjustment efficiency. Preferably, the sampling parameters can be sorted in descending order of load, and the parameters with larger loads are located at the top, so that the user can more directly understand the sampling parameters with larger loads.
[0061] Step S220: Select one sampling rate from at least two sampling rates of each sampling parameter to sample the corresponding sampling parameter.
[0062] The above step configures at least two sampling rates for each sampling parameter. In this step, start to select one sampling rate from at least two sampling rates of each sampling parameter to sample each sampling parameter, that is, send a request message at the selected sampling rate. Taking the acquisition of temperature at a sampling rate of 50 Hz as an example, the intelligent gateway 120 sends 50 request messages per second, and the terminal device 110 returns a result message containing temperature to the intelligent gateway 120 in response to the request message.
[0063] One sampling rate from at least two sampling rates of each sampling parameter is the initial sampling rate of each sampling parameter. The initial sampling rate can be specified by the user or set automatically. The lowest sampling rate of each sampling parameter can be set as the initial sampling rate, or the highest sampling rate of each sampling parameter can be set as the initial sampling rate, or the initial sampling rate of each sampling parameter can be set through other rules. Preferably, the highest sampling rate of each sampling parameter is set as the initial sampling rate. For example, for the sampling parameter of temperature of a terminal device 110, three sampling rates of 50 Hz, 100 Hz, and 200 Hz are configured, and the highest sampling rate of 200 Hz can be set as the initial sampling rate.
[0064] Step S230: Calculate the load of each sampling parameter at the selected sampling rate, sort the sampling parameters according to the load size, and determine the sampling parameters with high load according to the sorting result.
[0065] The load of each sampling parameter at the selected sampling rate can be calculated by formula (3):
[0066]
[0067] Among them, L n represents the load of parameter n, e represents the average retry times of parameter n, h represents the number of sub-parameters i of parameter n, l represents the word length of sub-parameter i, T represents the sampling period of parameter n (corresponding to the selected sampling rate), ll represents the priority of parameter n, and A, B, C, and D are constants.
[0068] Exemplarily, the priority value can be set to eleven levels of 0, 1, 2,..., 8, 9, 10. The lower the priority value, the higher the priority. For the sampling parameter with the highest priority, its priority value is 0. For the parameter with the highest importance, its priority value is 0, and the load calculated by formula (3) is also 0, and its sampling rate cannot be adjusted.
[0069] After calculating the load of each sampling parameter at the selected sampling rate, sort the sampling parameters according to the load size. The sampling parameters can be sorted in descending order of load or in ascending order of load.
[0070] After sorting the sampling parameters according to the load size, determine the sampling parameters with high load according to the sorting result. In some embodiments, for the sorting of sampling parameters in descending order of load, a threshold n (natural number) can be set, and the sampling parameters within the order 1 - n are determined as high - load parameters. In other embodiments, for the sorting of sampling parameters in descending order of load, the median sampling parameter can be determined first, and the sampling parameters above the median sampling parameter are high - load parameters.
[0071] Step S240: Determine whether data loss occurs in all sampling parameters. If data loss occurs in at least one sampling parameter, down - sample the parameters with high load within the range of at least two configured sampling rates.
[0072] In this step, if data loss occurs, down - sampling the sampling parameters with high load can reduce the total load, avoid data loss, and improve the reliability of sampling. Optionally, if no data loss occurs in all sampling parameters, up - sample the parameters with low load within the range of at least two configured sampling rates. Therefore, up - sampling the sampling parameters with low load when no data loss occurs can speed up the sampling process of low - load sampling parameters and improve the sampling efficiency.
[0073] Determine whether data loss occurs in all sampling parameters. If data loss occurs in at least one sampling parameter, down - sample the parameter with the highest load within the range of at least two configured sampling rates. Therefore, adjusting the sampling rate of the sampling parameter with the highest load can reduce the complexity and improve the stability of sampling. In some embodiments, if no data loss occurs in all sampling parameters, up - sample the parameter with the lowest load within the range of at least two configured sampling rates. Therefore, adjusting the sampling rate of the sampling parameter with the lowest load can reduce the complexity and improve the stability of sampling.
[0074] In some embodiments, determining whether data loss occurs in all sampling parameters may include: checking the sampling results at a preset period. If there are sampling parameters whose status has not changed during the check, it is determined that data loss has occurred in the sampling parameters. For example, after the intelligent gateway 120 sends a request message to the terminal device 110, check the result message at a preset period. The result message is the sampling result. If the status of the sampling parameter in the result message changes, the collection of this sampling parameter is completed. If the status of the sampling parameter in the result message remains unchanged, the collection of this sampling parameter is not completed, and at this time, it is determined that data loss has occurred in the sampling parameter.
[0075] Figure 3 is a schematic diagram of a sampling result 300 according to an embodiment of the present invention. As Figure 3 shown, the sampling result 300 is the message status after a preset period. The message collects data from 8 ports, and each port has the same collection parameters. According to Figure 3 the shown message status, the statuses of ports 3 - 8 all become Y, indicating that the parameter collection of these ports has been completed. The statuses of parameter B and parameter C of port 2 become Y, indicating that the parameter collection of parameter B and parameter C of port 2 has been completed. The statuses of parameter A of port 2, and parameter A, parameter B, and parameter C of port 1 remain unchanged, still being N, indicating that these parameters have not been collected yet. That is to say, the sampling result 300 indicates data loss.
[0076] Here, a flowchart is used to illustrate the operations performed by the method according to an embodiment of the present application. It should be understood that the previous operations do not necessarily need to be executed precisely in sequence. On the contrary, they can be processed in reverse order or simultaneously. Also, other operations can be added to these processes, or one or several steps can be removed from these processes.
[0077] This embodiment of the present invention provides a multi - parameter dynamic sampling method. When data loss occurs in the sampling parameters, down - sampling is performed on high - load parameters within the range of at least two configured sampling rates, which can reduce the total load, avoid data loss, and improve the reliability of sampling.
[0078] Figure 4 is a schematic diagram of a dynamic sampling device 400 according to an embodiment of the present invention. As Figure 4 shown, the multi - parameter dynamic sampling device 400 includes:
[0079] A configuration unit 410 that configures at least two sampling rates for each sampling parameter among the multi - parameters; a sampling unit 420 that selects one sampling rate from at least two sampling rates of each sampling parameter to sample the corresponding sampling parameter; a calculation unit 430 that calculates the load of each sampling parameter at the selected sampling rate and sorts the sampling parameters according to the load size, and determines the high - load sampling parameters according to the sorting result; an adjustment unit 440 that determines whether all sampling parameters have data loss. If at least one sampling parameter has data loss, down - sampling is performed on the high - load parameters within the range of at least two configured sampling rates.
[0080] In an optional case, the calculation unit 430 also determines the low - load sampling parameters according to the sorting result. If all sampling parameters do not have data loss, the adjustment unit 440 also performs up - sampling on the low - load sampling parameters within the range of at least two configured sampling rates.
[0081] In an alternative case, the configuration unit 410 configures priorities for each sampling parameter, including: configuring priorities for each sampling parameter in the message and fixing the sampling rate of the sampling parameter with the highest priority.
[0082] In an alternative case, the configuration unit 410 configures priorities for each sampling parameter, including: obtaining the priorities of the sampling parameters from the cloud server.
[0083] In an alternative case, after the configuration unit 410 configures at least two sampling rates for each sampling parameter, it includes: calculating the load of each sampling parameter at the lowest sampling rate, calculating the total load according to the load of each sampling parameter, comparing the total load with a preset value, and if the total load is greater than the preset value, displaying an overload prompt message.
[0084] In an alternative case, the configuration unit 410 further includes: sorting the sampling parameters according to the load at the lowest sampling rate and displaying the sorting result of the sampling parameters.
[0085] In an alternative case, the adjustment unit 440 determines whether all sampling parameters have data loss. If at least one sampling parameter has data loss, downsampling is performed on the parameter with the highest load within the range of at least two configured sampling rates.
[0086] In an alternative case, the adjustment unit 440 determines whether all sampling parameters have data loss, including: checking the sampling results at a preset period. If there are sampling parameters with unchanged status during the check, it is determined that the sampling parameters have data loss.
[0087] The implementation manner and specific process of the multi-parameter dynamic sampling device 400 can refer to the multi-parameter dynamic sampling method 200, which will not be elaborated here.
[0088] The present invention also proposes an intelligent gateway, including a processor, a memory, and instructions stored in the memory, where the instructions, when executed by the processor, implement the above method.
[0089] The present invention also proposes an Internet of Things system, including the above intelligent gateway.
[0090] The present invention also proposes a computer-readable storage medium, on which computer instructions are stored, and the computer instructions, when run, execute according to the above method.
[0091] Some aspects of the methods and apparatuses of the present invention may be executed entirely by hardware, entirely by software (including firmware, resident software, microcode, etc.), or by a combination of hardware and software. The above-mentioned hardware or software may all be referred to as "blocks", "modules", "engines", "units", "components" or "systems". The processor may be one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DAPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, or combinations thereof. In addition, aspects of the present invention may be embodied as a computer product located in one or more computer-readable media, which product includes computer-readable program code. For example, the computer-readable media may include, but are not limited to, magnetic storage devices (such as hard disks, floppy disks, magnetic tapes...), optical disks (such as compact disks (CDs), digital versatile disks (DVDs)...), smart cards, and flash memory devices (such as cards, sticks, key drives...).
[0092] The computer-readable media may contain a propagated data signal having computer program code therein, for example, on a baseband or as part of a carrier wave. The propagated signal may take many forms, including electromagnetic, optical, or the like, or a suitable combination thereof. The computer-readable media can be any computer-readable media other than a computer-readable storage media, which can communicate, propagate, or transport a program for use by being connected to an instruction execution system, apparatus, or device. The program code located on the computer-readable media can be propagated through any suitable medium, including radio, cable, fiber optic cable, radio frequency signal, or similar media, or a combination of any of the above media.
[0093] It should be understood that although this specification is described according to various embodiments, not every embodiment only contains an independent technical solution. This narrative manner of the specification is only for clarity. Those skilled in the art should regard the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments understandable to those skilled in the art.
[0094] The above description is only a schematic specific embodiment of the present invention and is not intended to limit the scope of the present invention. Any equivalent changes, modifications, and combinations made by those skilled in the art without departing from the concept and principles of the present invention shall fall within the scope of protection of the present invention.
Claims
1. A multi-parameter dynamic sampling method (200) for an Internet of Things system in the field of industrial automation. The Internet of Things system includes multiple terminal devices and an intelligent gateway connected to the multiple terminal devices. The intelligent gateway collects multiple parameters of the multiple terminal devices. The method (200) includes: Configuring at least two sampling rates (210) for each sampling parameter among the multiple parameters; Selecting one sampling rate from at least two sampling rates of each sampling parameter to sample the corresponding sampling parameter (220); Calculating the load of each sampling parameter at the selected sampling rate, sorting the sampling parameters according to the load size, and determining the high-load sampling parameters according to the sorting result (230); Judging whether all the sampling parameters have data loss. If at least one sampling parameter has data loss, then downsampling the high-load sampling parameters within the range of at least two configured sampling rates (240).
2. The method according to claim 1, wherein, the method (200) further includes: determining the low-load sampling parameters according to the sorting result. If no data loss occurs in all sampling parameters, then upsampling the low-load sampling parameters within the range of at least two configured sampling rates.
3. The method according to claim 1 or 2, wherein, configuring priorities for each sampling parameter includes: configuring priorities for each sampling parameter and fixing the sampling rate of the sampling parameter with the highest priority.
4. The method according to claim 3, wherein, configuring priorities for each sampling parameter includes: obtaining the priorities of the sampling parameters from a cloud server.
5. The method according to claim 1 or 2, wherein, after configuring at least two sampling rates (210) for each sampling parameter, it includes: calculating the load of each sampling parameter at the lowest sampling rate, calculating the total load according to the load of each sampling parameter, comparing the total load with a preset value. If the total load is greater than the preset value, then displaying an overload prompt message.
6. The method according to claim 5, wherein, the method (200) further includes: sorting the sampling parameters according to the load size at the lowest sampling rate and displaying the sorting result of the sampling parameters.
7. The method according to claim 1 or 2, wherein, judging whether all the sampling parameters have data loss. If at least one sampling parameter has data loss, then downsampling the parameter with the highest load within the range of at least two configured sampling rates.
8. The method according to claim 1 or 6, wherein, judging whether all the sampling parameters have data loss includes: checking the sampling results at a preset period. If there are sampling parameters with unchanged states during the check, it is determined that the sampling parameters have data loss. 9. A multi-parameter dynamic sampling device (400) for an Internet of Things system in the field of industrial automation. The Internet of Things system includes multiple terminal devices and an intelligent gateway connected to the multiple terminal devices. The intelligent gateway collects multiple parameters of the multiple terminal devices. The device (400) comprises: a configuration unit (410) that configures at least two sampling rates for each sampling parameter among the multiple parameters; a sampling unit (420) that selects one sampling rate from at least two sampling rates of each sampling parameter to sample the corresponding sampling parameter; a calculation unit (430) that calculates the load of each sampling parameter at the selected sampling rate, sorts the sampling parameters according to the load size, and determines the sampling parameters with high load according to the sorting result; an adjustment unit (440) that determines whether data loss occurs in all the sampling parameters. If data loss occurs in at least one sampling parameter, downsampling is performed on the sampling parameters with high load within the range of at least two configured sampling rates.
10. The device according to claim 9, wherein, the calculation unit (430) further determines the sampling parameters with low load according to the sorting result. If no data loss occurs in all the sampling parameters, the adjustment unit (440) also performs upsampling on the sampling parameters with low load within the range of at least two configured sampling rates.
11. The device according to claim 9 or 10, wherein, the configuration unit (410) configuring priorities for each sampling parameter includes: configuring priorities for each sampling parameter and fixing the sampling rate of the sampling parameter with the highest priority.
12. The device according to claim 11, wherein, the configuration unit (410) configuring priorities for each sampling parameter includes: obtaining the priorities of the sampling parameters from a cloud server.
13. The device according to claim 9 or 10, wherein, after the configuration unit (410) configures at least two sampling rates for each sampling parameter, it includes: calculating the load of each sampling parameter at the lowest sampling rate, calculating the total load according to the load of each sampling parameter, comparing the total load with a preset value. If the total load is greater than the preset value, an overload prompt message is displayed.
14. The device according to claim 13, wherein, the configuration unit (410) further includes: sorting the sampling parameters according to the load size at the lowest sampling rate and displaying the sorting result of the sampling parameters.
15. The device according to claim 9 or 10, wherein, the adjustment unit (440) determines whether data loss occurs in all the sampling parameters. If data loss occurs in at least one sampling parameter, downsampling is performed on the parameter with the highest load within the range of at least two configured sampling rates.
16. The device according to claim 9 or 15, wherein, The adjustment unit (440) determines whether data loss occurs in all the sampling parameters, including: checking the sampling results at a preset period, and if there are sampling parameters with unchanged states during the check, it is determined that data loss occurs in the sampling parameters.
17. An intelligent gateway, comprising a processor, a memory, and instructions stored in the memory, wherein when the instructions are executed by the processor, the method according to any one of claims 1-8 is implemented.
18. An Internet of Things system, comprising the intelligent gateway according to claim 17.
19. A computer-readable storage medium, having computer instructions stored thereon, and the computer instructions execute the method according to any one of claims 1-8 when running.
Citation Information
Patent Citations
Scalable performance monitoring using dynamic flow sampling
US20150074258A1
Determining a sampling rate for data traffic
WO2016122708A1