Channel selection method, wireless network device and storage medium
Through multiple scans and sliding window filtering, the reliability problem of wireless network devices when selecting channels is solved, and the accuracy and reliability of channel selection are improved.
Patent Information
- Application Number
- CN202410216495.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-27
- Publication Date
- 2025-08-29
AI Technical Summary
When selecting a channel, wireless network devices are susceptible to interference from WiFi signals on other devices, resulting in low reliability of selecting a channel, especially when the channel is not occupied when the hotspot is not sent.
By obtaining the preset number of scans, performing multiple scans on the channel, combining the sliding window filtering of the CCA value of the processing channel, obtaining the interference value of the channel, and selecting the communication channel based on the interference value.
It improves the reliability of wireless network equipment to select communication channels, reduces the impact of instant interference, and enhances the accuracy of channel selection.
Smart Images

Figure CN120568508A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of device detection, and in particular to a method for selecting a channel, a wireless network device, and a storage medium. Background Art
[0002] The electronic device needs to establish wireless network communication through a wireless network device, which may include a WiFi (wireless network communication technology) device, and the electronic device transmits through the wireless network device.
[0003] Existing methods reduce interference from WiFi signals from other devices by determining the number of hotspots in a wireless network device's environment and the signal strength of each hotspot. However, hotspots in a wireless network device's environment (such as WiFi signals from other devices) may not be transmitting packets, making it impossible to count channel occupancy. This results in low reliability in channel selection for wireless network devices. Summary of the Invention
[0004] The present application provides a channel selection method, a wireless network device, and a storage medium to solve technical problems encountered in the prior art.
[0005] To solve the above problems, the first aspect of the present application provides a method for selecting a channel, which is applied to a wireless network device, wherein the wireless network device includes multiple channels, and the method includes: obtaining a preset number of scans, scanning the same channel among the multiple channels according to the preset number of scans, and obtaining multiple CCA values of the channel, wherein one CCA value is obtained by scanning the channel once; performing sliding window filtering on the multiple CCA values of the channel to obtain an interference value of the channel; repeating all steps to obtain interference values of at least two channels, and selecting a communication channel from at least two channels based on the interference values of at least two channels.
[0006] The step of performing sliding window filtering on the multiple CCA values of the channel to obtain the interference value of the channel includes:
[0007] A preset window length is obtained, and a sliding window filtering process is performed on the multiple CCA values of the channel based on the preset window length to obtain an interference value of the channel.
[0008] The step of performing sliding window filtering on the multiple CCA values of the channel based on the preset window length includes:
[0009] Calculating a mean value for all the CCA values within the preset window length;
[0010] Updating the last CCA value within the preset window length to the mean value;
[0011] Repeat all steps to obtain the interference value of the channel.
[0012] The step of obtaining interference values of at least two of the channels and selecting a communication channel from the at least two channels based on the interference values of the at least two channels comprises:
[0013] Obtaining interference values of all channels of the wireless network device;
[0014] The communication channel is selected from the entire channels based on the interference values of the entire channels.
[0015] The method further comprises:
[0016] In response to the wireless network device being powered on for the first time, obtaining a channel utilization rate of the wireless network device based on the interference values of all channels;
[0017] The preset number of scans and the preset window length are adjusted based on the channel utilization of the wireless network device.
[0018] The step of adjusting the preset number of scans and the preset window length based on the channel utilization of the wireless network device includes:
[0019] In response to a channel utilization rate of the wireless network device being within a first preset range, adding a first value to the preset number of scans to obtain a first number of scans, and adding a second value to the preset window length to obtain a first window length;
[0020] The preset number of scans is updated to the first number of scans, and the preset window length is updated to the first window length.
[0021] The step of adjusting the preset number of scans and the preset window length based on the channel utilization of the wireless network device includes:
[0022] In response to the channel utilization rate of the wireless network device being within a second preset range, adding a third value to the preset number of scans to obtain a second number of scans, and adding a fourth value to the preset window length to obtain a second window length;
[0023] The preset number of scans is updated to the second number of scans, and the preset window length is updated to the second window length.
[0024] The step of selecting a communication channel from at least two channels based on interference values of at least two channels includes:
[0025] Calculating score values of at least two of the channels based on interference values of at least two of the channels;
[0026] From the score values of at least two of the channels, a channel corresponding to a minimum score value is selected as the communication channel.
[0027] To solve the above problem, the second aspect of the present application provides a wireless network device, including a processing unit and multiple channels, wherein the processing unit selects a communication channel from the multiple channels based on the above method.
[0028] To solve the above problems, the third aspect of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processing unit, it is used to implement the above method.
[0029] The beneficial effects of the present application are as follows: Different from the prior art, the present application obtains a preset number of scans, scans the same channel among the multiple channels according to the preset number of scans, and obtains multiple CCA values of the channel; performs sliding window filtering on the multiple CCA values of the channel to obtain the interference value of the channel; repeats all steps to obtain the interference values of at least two of the channels, and selects a communication channel from the at least two channels based on the interference values of the at least two channels. By scanning the same channel according to the preset number of scans, that is, scanning the channel multiple times according to the preset number of scans, the scanning time for scanning the same channel can be increased, the impact of the hotspot not sending packets and being unable to count the interference value of the channel can be reduced, and the reliability of the wireless network device in selecting the communication channel can be improved; by performing sliding window filtering on the multiple CCA values of the channel, the instantaneous interference suffered by the channel can be filtered, further improving the reliability of the wireless network device in selecting the communication channel. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without inventive efforts. Among them:
[0031] Figure 1 This is a flow chart of an embodiment of a method for selecting a channel provided by the present application;
[0032] Figure 2 yes Figure 1 A flow chart of an embodiment of step S102;
[0033] Figure 3is a flow chart of another embodiment of the method for selecting a channel provided by the present application;
[0034] Figure 4 yes Figure 3 A flow chart of an embodiment of step S303;
[0035] Figure 5 yes Figure 1 A flow chart of an embodiment of step S103;
[0036] Figure 6 This is a schematic diagram of scanning test of the channels of wireless network equipment;
[0037] Figure 7 It is a test diagram of selecting a channel in the prior art;
[0038] Figure 8 This is a test diagram of selecting a channel using the channel selection method of the present application;
[0039] Figure 9 It is a schematic diagram of a framework of an embodiment of a computer-readable storage medium provided by this application. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0041] The terms "first," "second," "third," "fourth," etc. (if any) in the specification and claims of the present application and in the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential sequence. It should be understood that the numbers used in this way are interchangeable where appropriate, so that the embodiments of the present application described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or apparatus.
[0042] In today's era of the Internet of Things, there are more and more wireless network devices. For example, the wireless network devices used in daily life need to transmit via WiFi, which is easily interfered by the WiFi signals of other devices, affecting the normal use of wireless network devices and resulting in a poor user experience.
[0043] To reduce interference from WiFi signals on other devices, existing wireless network devices rely on the number of hotspots in their environment and the signal strength of each hotspot to minimize interference. However, hotspots in the environment (e.g., WiFi signals on other devices) may not be actively transmitting packets, making it impossible to count occupied channels. Furthermore, existing wireless network devices select communication channels directly based on each channel's clear channel assessment (CCA), which can be subject to momentary interference, resulting in low reliability in channel selection.
[0044] Existing methods rely on determining the number of hotspots in a wireless network device's environment and the signal strength of each hotspot to reduce interference from WiFi signals from other devices. Furthermore, channels are selected based on the idle channel assessment value of each channel. However, this approach results in low reliability in channel selection.
[0045] The present application selects a communication channel from at least two channels based on the interference values of at least two channels, thereby reducing interference from WiFi signals of other devices compared to traditional methods. The present application scans the same channel according to a preset number of scans, that is, scans the channel multiple times according to a preset number of scans, thereby increasing the scanning time for scanning the same channel, reducing the impact of the hotspot not sending packets and being unable to count the interference value of the channel, and improving the reliability of the wireless network device in selecting the communication channel. By performing sliding window filtering on multiple CCA values of the channel, the instantaneous interference to the channel (that is, interference from WiFi signals of other devices) can be filtered, further improving the reliability of the wireless network device in selecting the communication channel.
[0046] See Figure 1 As shown, Figure 1 This is a flow chart illustrating an embodiment of a channel selection method provided by the present application. This embodiment of the channel selection method is applicable to wireless network devices, including but not limited to WiFi devices. Wireless network devices include multiple channels, also known as frequency bands, which are data signal transmission channels that use wireless signals as transmission carriers.
[0047] The method for selecting a channel in this embodiment includes the following steps:
[0048] Step S101: obtaining a preset scanning number, scanning the same channel among multiple channels according to the preset scanning number, and obtaining multiple CCA values of the channel.
[0049] The wireless network device is configured with a preset number of scans; for example, the preset number of scans includes but is not limited to 5, 6, 7, 8, 9, or 10. The preset number of scans is obtained, and a same channel among the multiple channels is scanned according to the preset number of scans to obtain multiple CCA values of the channel; wherein one CCA value is obtained by scanning the channel once.
[0050] A wireless network device performs a channel scan to obtain a clear channel assessment value (CCA) of the channel. For example, the wireless network device performs a channel scan to scan for interfering devices on the channel to obtain a clear channel assessment value (CCA) of the channel.
[0051] Optionally, a preset threshold range is set corresponding to the idle channel assessment value of the channel, the minimum value of the preset threshold range may be a signal detection threshold (Signal Detect, SD), and the minimum value of the preset threshold range may be an energy detection threshold (Energy Detect, ED). After scanning the channel of the wireless network device once, the received signal power of the channel is obtained, and the received signal power of the channel is compared with the signal detection threshold and the energy detection threshold respectively to obtain the idle channel assessment value of the channel.
[0052] Scan the same channel among multiple channels according to the preset scanning number, that is, scan the same channel among multiple channels multiple times according to the preset scanning number, and obtain multiple CCA values of the same channel, and the number of multiple CCA values is equal to the preset scanning number; for example, the preset scanning number is 5 times, and the wireless network device scans the same channel 5 times to obtain 5 CCA values of the channel.
[0053] Because a single scan of a wireless network device's channels takes a short time, hotspots may not send packets and therefore cannot calculate the interference value of the channel, potentially leading to low reliability in the wireless network device's channel selection. This embodiment scans the same channel from multiple channels according to a preset number of scans, i.e., scanning the same channel multiple times according to the number of scans. This increases the channel scanning time, reduces the impact of hotspots not sending packets and therefore cannot calculate the interference value, and improves the reliability of the wireless network device's channel selection.
[0054] Step S102: performing sliding window filtering on multiple CCA values of the channel to obtain an interference value of the channel.
[0055] After obtaining multiple CCA values of the channel, the wireless network device performs sliding window filtering on the multiple CCA values of the channel to obtain an interference value of the channel.
[0056] Optionally, a preset window length is obtained, and a sliding window filtering process is performed on multiple CCA values of the channel based on the preset window length to obtain an interference value of the channel. The wireless network device is provided with a preset window length; the wireless network device obtains the preset window length, and a sliding window filtering process is performed on multiple CCA values of the channel based on the preset window length to obtain an interference value of the channel.
[0057] For example, the preset window length set by the wireless network device is 3, the preset number of scans is 5, and the 5 CCA values of the channel are subjected to sliding window filtering based on the preset window length. That is, the wireless network device divides the 5 CCA values into 3 different windows based on the preset window length, and performs sliding window filtering on the 3 windows in turn so that the windows cover the 5 CCA values.
[0058] Compared with the prior art method of directly selecting a channel as a communication channel based on the idle channel assessment value of each channel, this embodiment can filter the instantaneous interference received by the channel by performing sliding window filtering on multiple CCA values of the channel, thereby further improving the reliability of the wireless network device in selecting the communication channel.
[0059] Step S103: Repeat all steps to obtain interference values of at least two channels, and select a communication channel from the at least two channels based on the interference values of the at least two channels.
[0060] Since the wireless network device includes multiple channels, the wireless network device repeatedly performs steps S101-S102 to scan other channels of the wireless network device according to a preset scanning number of times, thereby obtaining interference values of at least two channels, that is, interference values of at least two channels in the wireless network device.
[0061] For example, the wireless network device includes 13 channels, and the preset number of scans is 5 times. Steps S101-S102 are repeatedly performed so that the wireless network device scans each channel 5 times in sequence to obtain 5 CCA values of the channel. Sliding window filtering is performed on the 5 CCAs of the channel to obtain the interference value of the channel, until each of at least two channels of the wireless network device is scanned 5 times and the interference values of at least two channels are obtained.
[0062] Based on the interference values of the at least two channels, a communication channel is selected from the at least two channels. That is, the wireless network device selects the channel with the minimum interference value from the interference values of the at least two channels as the communication channel. For example, the wireless network device obtains interference values for 13 channels, selects the minimum interference value from the 13 channels, and selects the channel corresponding to the minimum interference value as the communication channel.
[0063] Compared with the prior art, in which a single channel scan by a wireless network device has a short scanning time and there is a situation where a hotspot does not send packets and the interference value of the channel cannot be calculated, this embodiment scans the same channel according to a preset scanning number, that is, scans the channel multiple times according to the preset scanning number. This can increase the scanning time for scanning the same channel, reduce the impact of the hotspot not sending packets and the inability to calculate the interference value of the channel, and improve the reliability of the wireless network device in selecting a communication channel. By performing sliding window filtering on multiple CCA values of the channel, it can filter out instantaneous interference on the channel, further improving the reliability of the wireless network device in selecting a communication channel.
[0064] See Figure 2 As shown, Figure 2 yes Figure 1 Schematic diagram of a flow chart of an embodiment of step S102 in FIG. Step S102 of this embodiment includes the following steps:
[0065] S201: Calculate the mean of all CCA values within a preset window length.
[0066] The wireless network device calculates the mean of all CCA values within a preset window length. For example, if the preset window length is 3, the wireless network device calculates the mean of all CCA values within the preset window length using the following formula:
[0067] y(N)=[y(n-2)+y(n-1)+y(n)]÷3
[0068] Wherein, y(N) represents the mean, y(n) represents the nth CCA value within the preset window length, 3 represents the preset window length, and n is an integer greater than or equal to 3.
[0069] In other embodiments, the preset window length includes but is not limited to 3, 4 or 5, etc.
[0070] For example, the preset number of scans is 5 times, and the wireless network device scans the same channel 5 times to obtain 5 CCA values of the channel, namely the first CCA value, the second CCA value, the third CCA value, the fourth CCA value and the fifth CCA value; when n is equal to 3, the first CCA value, the second CCA value and the third CCA value within the preset window length are used to calculate the first average of the first CCA value, the second CCA value and the third CCA value.
[0071] S202: Update the last CCA value within the preset window length to the mean value.
[0072] The wireless network device updates the last CCA value within the preset window length to the average value, that is, the wireless network device calculates the average value of all CCA values within the preset window length and replaces the last CCA value within the preset window length.
[0073] For example, the wireless network device calculates the first average of the first CCA value, the second CCA value, and the third CCA value, and then updates the third CCA value to the first average, that is, the first average replaces the third CCA value. At this time, the updated five CCA values are the first CCA value, the second CCA value, the first average, the fourth CCA value, and the fifth CCA value.
[0074] S203: Repeat all steps to obtain the interference value of the channel.
[0075] The wireless network device repeatedly executes steps S201 - S202 to obtain the interference value of the channel.
[0076] For example, the wireless network device repeatedly performs steps S201-S202. When n is equal to 4, the second CCA value, the first mean, and the fourth CCA value within the preset window length are calculated. The second mean of the second CCA value, the first mean, and the fourth CCA value is calculated; the wireless network device updates the fourth CCA value to the second mean, and the updated five CCA values are the first CCA value, the second CCA value, the first mean, the second mean, and the fifth CCA value.
[0077] When n is equal to 5, the first mean, the second mean and the fifth CCA value within the preset window length are calculated as the third mean of the first mean, the second mean and the fifth CCA value; the wireless network device updates the fifth CCA value to the third mean, and the updated 5 CCA values are the first CCA value, the second CCA value, the first mean, the second mean and the third mean, respectively. At this time, the interference value of the channel is the third mean.
[0078] Compared with the prior art method of directly selecting a channel as a communication channel based on the idle channel assessment value of each channel, this embodiment can filter the instantaneous interference received by the channel by performing sliding window filtering on multiple CCA values of the channel, thereby further improving the reliability of the wireless network device in selecting the communication channel.
[0079] Optionally, step S103 includes: obtaining interference values of all channels of the wireless network device; and selecting a communication channel from all channels based on the interference values of all channels.
[0080] The wireless network device obtains interference values for all channels of the wireless network device and selects a communication channel from among the channels based on the interference values of all channels. For example, if the wireless network device includes 13 channels and a preset number of scans is five, steps S101-S102 are repeated so that the wireless network device sequentially scans each channel five times to obtain five CCA values for that channel. Sliding window filtering is then performed on the five CCA values of each channel to obtain an interference value for that channel. This process continues until each of the 13 channels of the wireless network device is scanned five times to obtain an interference value for each of the 13 channels. The wireless network device then obtains interference values for all 13 channels and selects a communication channel from among the 13 channels based on the interference values of the 13 channels.
[0081] Compared with the prior art in which a channel is directly selected as a communication channel based on the idle channel evaluation value of each channel, this embodiment obtains the interference values of all channels of the wireless network device; based on the interference values of all channels, a communication channel is selected from all channels; and the interference values of all channels of the wireless network device can be obtained, thereby further improving the reliability of the wireless network device in selecting a communication channel.
[0082] See Figure 3 As shown, Figure 3 This is a flow chart of another embodiment of the method for selecting a channel provided by the present application. The method of this embodiment is described based on the above method, and the method of this embodiment includes the following steps:
[0083] S301: Determine whether the wireless network device is powered on for the first time.
[0084] After obtaining the interference values for all channels of the wireless network device, the wireless network device determines whether the wireless network device is powered on for the first time. If so, that is, in response to the wireless network device being powered on for the first time, the process proceeds to step S302; if not, that is, in response to the wireless network device not being powered on for the first time, the process ends.
[0085] S302: Obtain channel utilization of the wireless network device based on interference values of all channels.
[0086] In response to the wireless network device being powered on for the first time, the wireless network device obtains a channel utilization rate of the wireless network device based on interference values of all channels.
[0087] Based on the interference values of all channels, the wireless network device determines whether interference exists on each channel. If interference exists on a channel, the device determines that the channel is being used. For example, if a wireless network device includes 13 channels and the device can determine that 10 channels are being used based on the interference values of all channels, the device's channel utilization is 76.9%. If the device can determine that 11 channels are being used based on the interference values of all channels, the device's channel utilization is 84.6%.
[0088] S303: Adjusting the preset number of scans and the preset window length based on the channel utilization of the wireless network device.
[0089] The wireless network device adjusts the preset scanning times and the preset window length based on the channel utilization of the wireless network device.
[0090] In this embodiment, in response to the wireless network device being powered on for the first time, the wireless network device adjusts the preset number of scans and the preset window length based on the channel utilization of the wireless network device; the preset number of scans and the preset window length can be adjusted to improve the reliability of the wireless network device's next selection of a communication channel.
[0091] See Figure 4 As shown, Figure 4 yes Figure 3 FIG. 1 is a flow chart of an embodiment of step S303 in FIG.
[0092] Step S303 includes the following steps:
[0093] S401: Determine whether the channel utilization rate of the wireless network device is within a first preset range.
[0094] The wireless network device is configured with a first preset range and a second preset range. For example, the first preset range is greater than 80%, such as 81%-100%; the second preset range is greater than 50% and less than or equal to 80%, such as 51%-80%. In other embodiments, those skilled in the art may modify the first and second preset ranges based on actual needs.
[0095] The wireless network device determines whether the channel utilization of the wireless network device is within a first preset range; if so, that is, in response to the channel utilization of the wireless network device being within the first preset range, the process proceeds to step S402; if not, that is, in response to the channel utilization of the wireless network device not being within the first preset range, the process proceeds to step S404.
[0096] S402: Add a first value to a preset number of scans to obtain a first number of scans, and add a second value to a preset window length to obtain a first window length.
[0097] In response to the channel utilization rate of the wireless network device being within the first preset range, the wireless network device adds the first value to the preset scan times to obtain a first scan times, and adds the second value to the preset window length to obtain a first window length.
[0098] For example, the first value is 5 and the second value is 2; in response to the channel utilization rate of the wireless network device being within a first preset range, the wireless network device adds the first value (5) to the preset number of scans (5) to obtain a first number of scans (10), and adds the second value (3) to the preset window length (3) to obtain a first window length (5).
[0099] S403: Update the preset number of scans to the first number of scans, and update the preset window length to the first window length.
[0100] The wireless network device updates the preset number of scans to the first number of scans and the preset window length to the first window length, i.e., the first number of scans replaces the preset number of scans and the first window length replaces the preset window length. For example, the preset number of scans after the wireless network device is adjusted is 10, and the preset window length after the wireless network device is adjusted is 5.
[0101] S404: Determine whether the channel utilization rate of the wireless network device is within a second preset range.
[0102] The wireless network device determines whether the channel utilization of the wireless network device is within the second preset range; if so, that is, in response to the channel utilization of the wireless network device being within the second preset range, the process proceeds to step S405; if not, that is, in response to the channel utilization of the wireless network device not being within the second preset range, the process ends.
[0103] S405: Add the third value to the preset number of scans to obtain a second number of scans, and add the fourth value to the preset window length to obtain a second window length.
[0104] In response to the channel utilization rate of the wireless network device being within the second preset range, the wireless network device adds the third value to the preset scan times to obtain a second scan times, and adds the fourth value to the preset window length to obtain a second window length.
[0105] For example, the third value is 3 and the fourth value is 1; in response to the channel utilization rate of the wireless network device being within the second preset range, the wireless network device adds the third value (3) to the preset number of scans (5) to obtain a second number of scans (8), and adds the fourth value (1) to the preset window length (3) to obtain a second window length (4).
[0106] S406: Update the preset number of scans to a second number of scans, and update the preset window length to a second window length.
[0107] The wireless network device updates the preset number of scans to a second number of scans and the preset window length to the second window length, i.e., the second number of scans replaces the preset number of scans and the second window length replaces the preset window length. For example, the preset number of scans after the wireless network device is adjusted is 8, and the preset window length after the wireless network device is adjusted is 4.
[0108] The wireless network device of this embodiment adjusts the preset scanning times and the preset window length based on the channel utilization of the wireless network device; the preset scanning times and the preset window length can be adjusted to improve the reliability of the wireless network device in selecting a communication channel next time.
[0109] See Figure 5 As shown, Figure 5 yes Figure 1 Flowchart of step S103 in an embodiment. This embodiment is described based on the above-mentioned method for selecting a channel, and step S103 includes the following steps:
[0110] Step S501: Calculate score values of at least two channels based on interference values of at least two channels.
[0111] The wireless network device calculates score values for the at least two channels based on the interference values of the at least two channels. The wireless network device obtains a preset threshold range and obtains a maximum value from the preset threshold range. The wireless network device divides the interference value of the channel by the maximum value and multiplies the result by 100 to obtain the score value. The preset threshold range corresponds to the threshold range of the channel's idle channel assessment value.
[0112] For example, the preset threshold range of the idle channel evaluation value of the channel is 0-30dB, and the wireless network device obtains the maximum value of the preset threshold range as 30dB; the wireless network device divides the interference value by 30 and multiplies it by 100 to obtain the channel score value.
[0113] Step S502: From the score values of at least two channels, select the channel corresponding to the minimum score value as the communication channel.
[0114] The wireless network device calculates the score values of at least two channels in step S301, and selects the channel corresponding to the minimum score value from the score values of the at least two channels as the communication channel.
[0115] See Figure 6-8 As shown, Figure 6 This is a schematic diagram of scanning test of the channels of wireless network equipment; Figure 7 It is a test diagram of selecting a channel in the prior art; Figure 8This is a test diagram of selecting a channel by the channel selection method of the present application. In this embodiment, a wireless network device is scanned in the 5GHz frequency band, that is, all channels of the wireless network device are scanned in the 5GHz frequency band to obtain a scanning test diagram, such as Figure 6 As shown, the horizontal axis in the figure represents the channel of the wireless network device, such as channels 36, 40, 44, etc., and the vertical axis in the figure represents the interference value of the interfering device to the wireless network device.
[0116] like Figure 6 As shown, interference device 1 interferes with channels 36, 40, 44, and 48 of the wireless network device, interference device 2 interferes with channels 52, 56, 60, and 64 of the wireless network device, and interference device 3 interferes with channels 149, 153, 157, and 161 of the wireless network device. Interference device 3 has the least interference on the wireless network device.
[0117] The wireless network equipment in the prior art directly selects a channel as a communication channel according to the idle channel evaluation value of the channel, and obtains the test results as follows: Figure 7 In the 17 tests, the wireless network device selected channels including channel 64 (interfered by interference device 2) and channel 36 (interfered by interference device 1). Channel 64 and channel 36 are error channels, and the error rate of the wireless network device in the prior art is 11.76%.
[0118] The wireless network device selects a channel using the channel selection method of the above embodiment, and the test results are as follows: Figure 8 As shown in the figure, in 31 tests, the wireless network device selected channel 64 (interfered by interference device 2), which is an incorrect channel. Therefore, the error rate of channel selection using the above embodiment was only 3.23%. Compared to the error rate of 11.76% for wireless network devices in the prior art, this method can filter out transient interference on the channel, improving the reliability of communication channel selection.
[0119] The present application also provides a wireless network device, including a processing unit and multiple channels, wherein the processing unit selects a communication channel from the multiple channels based on the method disclosed in the above embodiment.
[0120] This application also provides a computer-readable storage medium, please continue to refer to Figure 9 , Figure 9 The computer-readable storage medium 60 stores program instructions 61, which, when executed by a processing unit, are used to implement the method of the above embodiment.
[0121] When the embodiments of the present application are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, computer device, or network device, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0122] The above description is only an implementation method of the present application and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the description and drawings of this application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for selecting a channel, characterized in that: Applied to a wireless network device, the wireless network device including multiple channels, the method comprising: Obtaining a preset number of scans, scanning the same channel among the multiple channels according to the preset number of scans to obtain multiple CCA values for the channel, wherein one CCA value is obtained by scanning the channel once; Performing sliding window filtering on the multiple CCA values of the channel to obtain an interference value of the channel; All steps are repeatedly performed to obtain interference values of at least two of the channels, and a communication channel is selected from the at least two channels based on the interference values of the at least two channels.
2. The method according to claim 1, characterized in that The step of performing sliding window filtering on the multiple CCA values of the channel to obtain the interference value of the channel includes: A preset window length is obtained, and a sliding window filtering process is performed on the multiple CCA values of the channel based on the preset window length to obtain an interference value of the channel.
3. The method according to claim 2, characterized in that The step of performing sliding window filtering on the multiple CCA values of the channel based on the preset window length includes: Calculating a mean value for all the CCA values within the preset window length; Updating the last CCA value within the preset window length to the mean value; Repeat all steps to obtain the interference value of the channel.
4. The method according to any one of claims 1 to 3, characterized in that The step of obtaining interference values of at least two of the channels and selecting a communication channel from the at least two channels based on the interference values of the at least two channels comprises: Obtaining interference values of all channels of the wireless network device; The communication channel is selected from the entire channels based on the interference values of the entire channels.
5. The method according to claim 4, characterized in that The method further comprises: In response to the wireless network device being powered on for the first time, obtaining a channel utilization rate of the wireless network device based on the interference values of all channels; The preset number of scans and the preset window length are adjusted based on the channel utilization of the wireless network device.
6. The method according to claim 5, characterized in that The step of adjusting the preset number of scans and the preset window length based on the channel utilization of the wireless network device includes: In response to a channel utilization rate of the wireless network device being within a first preset range, adding a first value to the preset number of scans to obtain a first number of scans, and adding a second value to the preset window length to obtain a first window length; The preset number of scans is updated to the first number of scans, and the preset window length is updated to the first window length.
7. The method according to claim 6, characterized in that The step of adjusting the preset number of scans and the preset window length based on the channel utilization of the wireless network device includes: In response to the channel utilization rate of the wireless network device being within a second preset range, adding a third value to the preset number of scans to obtain a second number of scans, and adding a fourth value to the preset window length to obtain a second window length; The preset number of scans is updated to the second number of scans, and the preset window length is updated to the second window length.
8. The method according to any one of claims 1 to 3, characterized in that The step of selecting a communication channel from at least two channels based on interference values of at least two channels comprises: Calculating score values of at least two of the channels based on interference values of at least two of the channels; From the score values of at least two of the channels, a channel corresponding to a minimum score value is selected as the communication channel.
9. A wireless network device, characterized in that: The method comprises a processing unit and a plurality of channels, wherein the processing unit selects a communication channel from the plurality of channels based on the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which is used to implement the method according to any one of claims 1 to 8 when executed by a processing unit.