Disclosure of Invention
In order to solve the above technical problem, the present invention provides a method and an apparatus for controlling bandwidth in multiple modes.
The technical scheme provided by the invention is as follows:
the invention discloses a multi-mode bandwidth control method, which comprises the following steps: s100, when a device is accessed to the router, controlling the bandwidth resource of each device in the router by adopting a time-sharing control mode; s200, judging whether the time length of the equipment accessing the router reaches the preset continuous time or not; if yes, executing the next step; otherwise, repeating the step S200; and S300, controlling the bandwidth resources of each device in the router by adopting a multi-factor control mode.
Further preferably, the step S100 of controlling bandwidth resources of each device in the router by using a time-sharing control mode when a device accesses the router specifically includes: s110, acquiring the signal intensity of each device in the router; s120, calculating corresponding bandwidth resources according to the signal intensity of each device; and S130, allocating the bandwidth resources to each device according to the corresponding bandwidth resources calculated in the step S120.
Further preferably, the step S300 of controlling bandwidth resources of each device in the router by using the multi-factor control mode specifically includes the steps of: s310, accumulating the accumulated connection time and the accumulated download amount of each device in the router in the preset continuous time; s320, calculating bandwidth resources corresponding to each device according to the accumulated connection time and the accumulated downloading amount in the preset continuous time and the signal intensity of each device; and S330, allocating the bandwidth resources corresponding to the devices.
Further preferably, in step S320, "calculating bandwidth resources corresponding to each device according to the accumulated connection time and the accumulated download amount in the preset continuous time and the signal strength of each device" is calculated by the following formula:
Wj=W(αIj+βTj+γQj) (1)
wherein, WjRepresents the bandwidth resource of the jth device, W is the total amount of bandwidth resource, IjIs the signal strength percentage of the jth device, and alpha is the signal strength percentage IjPredetermined weight coefficient of (T)jIs the cumulative percentage of connection time of the jth device, beta is a preset weight coefficient of the cumulative percentage of connection time, QjThe cumulative download traffic percentage of the jth device, γ is a preset weighting factor of the cumulative connection time percentage, Σ i is the sum of the signal strengths of all devices, Σ q is the sum of the cumulative download traffic of all devices, and Σ t is the sum of the cumulative connection times of all devices.
The invention also discloses a multi-mode bandwidth control device, which comprises: the bandwidth resource control module is used for controlling the bandwidth resources of each device in the router by adopting a time-sharing control mode when the device is accessed to the router; the time judgment module is used for judging whether the time length of the equipment accessing the router reaches the preset continuous time or not; and the bandwidth resource control module is also used for controlling the bandwidth resources of each device in the router by adopting a multi-factor control mode when judging whether the duration of the device accessing the router reaches the preset continuous time.
Further preferably, the bandwidth resource control module further includes: the signal intensity acquisition module is used for acquiring the signal intensity of each device in the router; the bandwidth resource calculation module is used for calculating corresponding bandwidth resources according to the signal intensity; and the bandwidth resource allocation module is used for allocating corresponding bandwidth resources for each device.
Further preferably, the bandwidth resource control module further includes: the accumulation module is used for accumulating the accumulated connection time and the accumulated downloading amount of each device in the router within the preset continuous time; and the bandwidth resource calculation module is further used for calculating the bandwidth resource corresponding to each device according to the accumulated connection time and the accumulated download amount in the preset continuous time and the signal strength of each device.
Further preferably, the bandwidth resource calculating module calculates the bandwidth resource corresponding to each device according to the following formula:
Wj=W(αIj+βTj+γQj) (1)
wherein, WjRepresents the bandwidth resource of the jth device, W is the total amount of bandwidth resource, IjIs the signal strength percentage of the jth device, and alpha is the signal strength percentage IjPredetermined weight coefficient of (T)jIs the cumulative percentage of connection time of the jth device, beta is a preset weight coefficient of the cumulative percentage of connection time, QjThe cumulative download traffic percentage of the jth device, γ is a preset weighting factor of the cumulative connection time percentage, Σ i is the sum of the signal strengths of all devices, Σ q is the sum of the cumulative download traffic of all devices, and Σ t is the sum of the cumulative connection times of all devices.
Compared with the prior art, the bandwidth allocation algorithm adds the factors of accumulated flow and accumulated time, automatically allocates the bandwidth, and judges whether the equipment is the network-stealing equipment no longer only by the quantity of signal intensity, so that the router has the function of identifying the self-equipment and the network-stealing equipment, the bandwidth of the network-stealing equipment is not reduced at the lower limit, and the self-equipment has the bandwidth use authority which approaches 100% infinitely.
Detailed Description
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following description will be made with reference to the accompanying drawings. It is obvious that the drawings in the following description are only some examples of the invention, and that for a person skilled in the art, other drawings and embodiments can be derived from them without inventive effort.
For the sake of simplicity, the drawings only schematically show the parts relevant to the present invention, and they do not represent the actual structure as a product. In addition, in order to make the drawings concise and understandable, components having the same structure or function in some of the drawings are only schematically illustrated or only labeled. In this document, "one" means not only "only one" but also a case of "more than one".
Fig. 1 is a schematic diagram of main steps of a multi-mode bandwidth control method according to the present invention, and as shown in fig. 1, the multi-mode bandwidth control method includes the steps of: s100, when a device is accessed to the router, controlling the bandwidth resource of each device in the router by adopting a time-sharing control mode; s200, judging whether the time length of the equipment accessing the router reaches the preset continuous time or not; if yes, executing the next step; otherwise, repeating the step S200; and S300, controlling the bandwidth resources of each device in the router by adopting a multi-factor control mode.
The invention adds the factors of accumulated flow and accumulated time into the bandwidth allocation algorithm, automatically allocates the bandwidth, and judges whether the device is a network-gramming device no longer only by the quantity of signal intensity, so that the router has the function of identifying the home device and the network-gramming device, the bandwidth of the network-grabing device is not reduced at the lower limit, and the home device has the bandwidth use authority which is infinitely close to 100 percent.
Fig. 2 is a diagram illustrating the steps of a multi-mode bandwidth control method according to the present invention. As shown in fig. 2, the step S100 "when there is a device accessing the router, controlling the bandwidth resource of each device in the router by using the time-sharing control mode" specifically includes:
s110, acquiring the signal intensity of each device in the router;
s120, calculating corresponding bandwidth resources according to the signal intensity of each device;
and S130, allocating the bandwidth resources to each device according to the corresponding bandwidth resources calculated in the step S120.
Specifically, when the device is just accessed to the router, the time-sharing control mode is adopted for the device, the time-sharing control mode adopts simple control based on signal strength, and the router cannot drive the device out of the network no matter how weak the signal strength is.
Fig. 3 is a diagram illustrating a multi-mode bandwidth control method according to an embodiment of the present invention. As shown in fig. 3, the device 2 is closer to the router, assuming that the signal strength of the device 2 is 100%, the device 1 is farther, assuming that the signal strength is 30%, and the total amount of network bandwidth provided by the ISP is 10Mbps, then we perform a simple process, and consider that the transmission rate is proportional to the signal strength. Then, when only device 1 accesses, the bandwidth used by device 1 is 0.3 × 10 ═ 3Mbps, and similarly, only device 2 accesses, the bandwidth of device 2 is 10Mbps, and the bandwidth of device 1 is 0.3/(0.3+1) × 10 ≈ 2.3Mbps, and similarly, the bandwidth of device 2 is 7.7 Mbps.
The above describes a control procedure based on a time-sharing control mode, and the same is applied to access a plurality of devices.
Preferably, as shown in fig. 2, the step S300 of controlling bandwidth resources of each device in the router by using the multi-factor control mode specifically includes the steps of: s310, accumulating the accumulated connection time and the accumulated download amount of each device in the router in the preset continuous time; s320, calculating bandwidth resources corresponding to each device according to the accumulated connection time and the accumulated downloading amount in the preset continuous time and the signal intensity of each device; and S330, allocating the bandwidth resources corresponding to the devices.
The invention adopts a multi-factor control mode after the device continues for a preset continuous time (such as 15 days) from the moment when the device accesses the router. The core idea of the invention is to prevent network from being stolen, not to let the external device access, but to limit the network resource of the external device.
Preferably, in step S320, "calculating bandwidth resources corresponding to each device according to the accumulated connection time and the accumulated download amount in the preset continuous time and the signal strength of each device" is calculated by the following formula:
Wj=W(αIj+βTj+γQj) (1)
wherein Wj represents a bandwidth resource of the jth device, W is a total amount of the bandwidth resource and represents a bandwidth resource provided by the ISP, Ij is a signal strength percentage of the jth device, α is a preset weight coefficient of the signal strength percentage Ij, Tj is a cumulative connection time percentage of the jth device, β is a preset weight coefficient of the cumulative connection time percentage, Qj is a cumulative download traffic percentage of the jth device, γ is a preset weight coefficient of the cumulative connection time percentage, Σ i is a sum of signal strengths of all devices, Σ q is a sum of cumulative download traffic of all devices, and Σ t is a sum of cumulative connection times of all devices.
Specifically, the specific working flow of the present invention is described below with reference to fig. 2 as a specific example.
And setting the preset duration time in the time-sharing control mode to be 15 days. The device 2 is a legal device allowed by a user, and the device 1 is a network-rubbing device. Two parameters were introduced below: the connection time and the accumulated download amount are accumulated, then the signal intensity in the time-sharing control mode is added, and the multi-factor control mode adopts the thought that the three factors are considered in combination to realize the network-stealing prevention function.
Now, assuming that the preset duration is 15 days, the time for device 2 to access the router per day is 5 hours, and the time for device 1 to access the router per day is 2 hours. The data amount obtained by the device 2 from the network is 5 GB per day, and the data amount obtained by the device 1 from the network is 1 GB per day. Then, within the preset duration, the time for the device 1 to access the router is 30 hours, the time for the device 2 to access the router is 75 hours, the cumulative download traffic of the device 1 is 15 GB, and the cumulative download traffic of the device 2 is 75 GB.
The multi-factor control mode starts from the suspension state of the time-sharing control mode, and calculates the bandwidth by the following equation:
Wj=W(αIj+βTj+γQj) (1)
where Wj represents a bandwidth resource of a j-th device, W represents a bandwidth resource provided by an ISP, Ij is a signal strength percentage of the j-th device, α is a preset weight coefficient of the signal strength percentage Ij, Tj is a cumulative connection time percentage of the j-th device, β is a preset weight coefficient of the cumulative connection time percentage, Qj is a cumulative download traffic percentage of the j-th device, γ is a preset weight coefficient of the cumulative connection time percentage, Σ i is a signal strength sum of all devices, Σ q is a cumulative download traffic sum of all devices, and Σ t is a cumulative connection time sum of all devices.
W still takes 10Mbps in the time-sharing control mode, and alpha, beta and gamma respectively take 0.6,0.2 and 0.2. I is1=0.3,I2=0.6,T1=30/(30+75)≈0.286,T275/(30+75) equals about 0.714, Q1=15/(15+75)≈0.167,Q275/(15+75) ≈ 0.833. Substituting the above numerical values into formula 1, and calculating to obtain:
W1=10*(0.6*0.3+0.2*0.167+0.2*0.286)=2.706
W2=10*(0.6*0.6+0.2*0.833+0.2*0.714)=6.694
the bandwidth resources of device 1 and device 2 are allocated in the manner described above. According to the algorithm, the accumulated continuous time and the accumulated downloading flow of each device in the preset duration are accumulated at preset time intervals, the accumulated continuous time and the accumulated downloading flow are taken as variables to be introduced into a formula for iterative calculation, and the bandwidth resources which are required to be allocated to each accessed device are updated.
Fig. 4 is a schematic diagram of an actual application effect of the method for controlling bandwidth in multiple modes according to the present invention. As shown in fig. 4, the dashed line represents the percentage of the bandwidth resource of the device 2, and the solid line represents the percentage of the bandwidth resource of the device 1, and as can be seen from fig. 4, the percentage of the bandwidth resource of the device 2 starts from 70% and gradually approaches 100% as time is accumulated.
Fig. 5 is a schematic diagram of a multi-mode bandwidth control apparatus according to the present invention. As shown in fig. 5, a multimode control bandwidth device includes: the bandwidth resource control module is used for controlling the bandwidth resources of each device in the router by adopting a time-sharing control mode when the device is accessed to the router; the time judgment module is used for judging whether the time length of the equipment accessing the router reaches the preset continuous time or not; and the bandwidth resource control module is also used for controlling the bandwidth resources of each device in the router by adopting a multi-factor control mode when judging whether the duration of the device accessing the router reaches the preset continuous time.
Preferably, the bandwidth resource control module further includes: the signal intensity acquisition module is used for acquiring the signal intensity of each device in the router; the bandwidth resource calculation module is used for calculating corresponding bandwidth resources according to the signal intensity; and the bandwidth resource allocation module is used for allocating corresponding bandwidth resources for each device.
Preferably, the bandwidth resource control module further includes: the accumulation module is used for accumulating the accumulated connection time and the accumulated downloading amount of each device in the router within the preset continuous time; and the bandwidth resource calculation module is further used for calculating the bandwidth resource corresponding to each device according to the accumulated connection time and the accumulated download amount in the preset continuous time and the signal strength of each device.
Preferably, the bandwidth resource calculating module calculates the bandwidth resource corresponding to each device according to the following formula:
Wj=W(αIj+βTj+γQj) (1)
where Wj represents a bandwidth resource of a j-th device, W represents a bandwidth resource provided by an ISP, Ij is a signal strength percentage of the j-th device, α is a preset weight coefficient of the signal strength percentage Ij, Tj is a cumulative connection time percentage of the j-th device, β is a preset weight coefficient of the cumulative connection time percentage, Qj is a cumulative download traffic percentage of the j-th device, γ is a preset weight coefficient of the cumulative connection time percentage, Σ i is a signal strength sum of all devices, Σ q is a cumulative download traffic sum of all devices, and Σ t is a cumulative connection time sum of all devices.
It should be noted that the information interaction, execution process, and other contents between the modules in the apparatus are based on the same concept as the method embodiment, and specific contents may refer to the description in the method embodiment of the present invention, and are not described herein again.
It should be noted that the above embodiments can be freely combined as necessary. The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.