[go: up one dir, main page]

CN116470944A - Antenna selection method - Google Patents

Antenna selection method Download PDF

Info

Publication number
CN116470944A
CN116470944A CN202310437775.4A CN202310437775A CN116470944A CN 116470944 A CN116470944 A CN 116470944A CN 202310437775 A CN202310437775 A CN 202310437775A CN 116470944 A CN116470944 A CN 116470944A
Authority
CN
China
Prior art keywords
data sequence
value
antenna
preset
difference
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202310437775.4A
Other languages
Chinese (zh)
Other versions
CN116470944B (en
Inventor
张博
詹昭城
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Espressif Systems Shanghai Co Ltd
Original Assignee
Espressif Systems Shanghai Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Espressif Systems Shanghai Co Ltd filed Critical Espressif Systems Shanghai Co Ltd
Priority to CN202310437775.4A priority Critical patent/CN116470944B/en
Publication of CN116470944A publication Critical patent/CN116470944A/en
Application granted granted Critical
Publication of CN116470944B publication Critical patent/CN116470944B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B7/00Radio transmission systems, i.e. using radiation field
    • H04B7/02Diversity systems; Multi-antenna system, i.e. transmission or reception using multiple antennas
    • H04B7/04Diversity systems; Multi-antenna system, i.e. transmission or reception using multiple antennas using two or more spaced independent antennas
    • H04B7/06Diversity systems; Multi-antenna system, i.e. transmission or reception using multiple antennas using two or more spaced independent antennas at the transmitting station
    • H04B7/0602Diversity systems; Multi-antenna system, i.e. transmission or reception using multiple antennas using two or more spaced independent antennas at the transmitting station using antenna switching
    • H04B7/0608Antenna selection according to transmission parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B7/00Radio transmission systems, i.e. using radiation field
    • H04B7/02Diversity systems; Multi-antenna system, i.e. transmission or reception using multiple antennas
    • H04B7/04Diversity systems; Multi-antenna system, i.e. transmission or reception using multiple antennas using two or more spaced independent antennas
    • H04B7/08Diversity systems; Multi-antenna system, i.e. transmission or reception using multiple antennas using two or more spaced independent antennas at the receiving station
    • H04B7/0802Diversity systems; Multi-antenna system, i.e. transmission or reception using multiple antennas using two or more spaced independent antennas at the receiving station using antenna selection
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本申请公开了一种用于为具有多个天线的通信设备选择工作天线的方法,其包括对当前工作天线连续采样以获得采样值,并将其加入至采用FIFO模式的第一数据序列的队尾;计算当前第一数据序列中的采样值的平均值并加入至采用FIFO模式的第二数据序列的队尾;判断当前第二数据序列中的第N个平均值与更新前的第二数据序列中的第一个平均值之间的第一差值是否超过预设第一阈值;如果超过则启动定时监测,并在其持续时间内重复执行上述步骤以更新第一和第二数据序列;以及判断定时监测结束时的第二数据序列中的第N个平均值与定时监测开启时的第二数据序列中的第一个平均值之间的第二差值是否超过预设第二阈值;如果超过则触发重新选择另一天线作为工作天线。

The present application discloses a method for selecting a working antenna for a communication device with multiple antennas, which includes continuously sampling the current working antenna to obtain sampled values, and adding them to the end of the first data sequence using FIFO mode; calculating the average value of the sampled values in the current first data sequence and adding it to the tail of the second data sequence using FIFO mode; judging whether the first difference between the Nth average value in the current second data sequence and the first average value in the second data sequence before updating exceeds the preset first threshold value; The above-mentioned steps are to update the first and second data sequences; and whether the second difference between the Nth average value in the second data sequence when the timing monitoring ends and the first average value in the second data sequence when the timing monitoring is turned on exceeds the preset second threshold; if it exceeds, another antenna is triggered to be reselected as the working antenna.

Description

一种天线选择方法An Antenna Selection Method

技术领域technical field

本申请涉及无线通信技术领域,尤其涉及一种用于为具有多个天线的通信设备选择工作天线的方法以及通信设备。The present application relates to the technical field of wireless communication, and in particular to a method for selecting a working antenna for a communication device with multiple antennas and the communication device.

背景技术Background technique

天线是无线基础设施的重要组成部分之一,用于接收或传输信号。在一方面,天线将发射器的电压转换为无线电信号,在另一方面,天线从空气中拾取无线电信号并将其转换为电压,以便在接收器中恢复。Antennas are one of the essential components of wireless infrastructure, used to receive or transmit signals. On the one hand, the antenna converts the transmitter's voltage into a radio signal, and on the other hand, the antenna picks up the radio signal from the air and converts it into a voltage for recovery in the receiver.

传统的通信设备通常采用单个发射天线和单个接收天线的传统技术。然而,天线性能会极大地影响用户使用电子通信设备的无线能力。例如,假如天线的性能无法满足通信要求,则可能会导致呼叫失败或者数据传输速率下降等。为了最大化无线通信系统的性能和通信容量,使得天线性能满足设计标准,逐渐演变为采用多个发射天线和多个接收天线的多天线系统。因此,通信设备中往往配置有多个天线,以在需要时通过对天线的切换,从而保证通信质量。Conventional communication devices typically employ conventional technology of a single transmit antenna and a single receive antenna. However, antenna performance can greatly affect a user's wireless ability to use an electronic communication device. For example, if the performance of the antenna cannot meet the communication requirements, it may cause the call to fail or the data transmission rate to drop. In order to maximize the performance and communication capacity of the wireless communication system and make the antenna performance meet the design criteria, it has gradually evolved into a multi-antenna system using multiple transmit antennas and multiple receive antennas. Therefore, a communication device is often configured with multiple antennas, so as to ensure communication quality by switching the antennas when necessary.

目前现有的天线切换算法包括周期性地比较多个天线的信号强度,以找到当前最优的信号强度并实时切换天线以收发数据包。然而,这种方案会导致天线切换过于频繁,一方面增加了通信设备的工作负荷,另一方面也会导致通信质量的不稳定。具体而言,这种现有的技术方案存在以下缺陷:(1)需要频繁地分别监测各个天线的信号强度大小,并根据各个天线的信号强度大小或者其之间的差异以决定是否进行天线切换;(2)由于工作天线不能长期稳定在一个天线上,在每次切换天线之后,数据的传输都要重新进行协商,以找到当前适配的传输速度。因此,这将导致数据吞吐量在一个较低的水平。(3)天线信号强度的变化受到多种因素的影响,除了环境变化之外,还有可能受到人为干扰。而在一些实际应用场景中,如果当期天线信号强度发生变化只是由于人为因素而引起的,例如人正好站在特定位置而干扰了天线的收发性能,但等人离开之后,这种干扰很快就会恢复正常,此时在这种情况下并不需要切换天线。Currently existing antenna switching algorithms include periodically comparing signal strengths of multiple antennas to find the current optimal signal strength and switching antennas in real time to send and receive data packets. However, this solution will lead to too frequent switching of the antenna, which increases the workload of the communication device on the one hand, and also leads to unstable communication quality on the other hand. Specifically, this existing technical solution has the following defects: (1) It is necessary to frequently monitor the signal strength of each antenna separately, and decide whether to perform antenna switching according to the signal strength of each antenna or the difference between them; (2) Since the working antenna cannot be stable on one antenna for a long time, after each antenna is switched, the data transmission must be re-negotiated to find the currently adapted transmission speed. Therefore, this will result in a lower level of data throughput. (3) The change of antenna signal strength is affected by many factors, in addition to environmental changes, there may be human interference. However, in some practical application scenarios, if the current antenna signal strength changes are only caused by human factors, for example, a person happens to stand in a specific position and interferes with the transceiver performance of the antenna, but after the person leaves, the interference will soon return to normal. In this case, there is no need to switch the antenna.

因此,希望能够提供一种避免因人为导致的干扰而引起的频繁的天线切换、并且提高数据传输吞吐量的天线选择的改进方式。Therefore, it is desirable to provide an improved method of antenna selection that avoids frequent antenna switching due to human-induced interference and improves data transmission throughput.

应理解,上述所列举的技术问题仅作为示例而非对本发明的限制,本发明并不限于同时解决上述所有技术问题的技术方案。本发明的技术方案可以实施为解决上述或其他技术问题中的一个或多个。It should be understood that the technical problems listed above are only examples rather than limitations to the present invention, and the present invention is not limited to a technical solution that simultaneously solves all the above technical problems. The technical solutions of the present invention can be implemented to solve one or more of the above or other technical problems.

发明内容Contents of the invention

为解决上述和其他问题,本申请提供了一种用于为具有多个天线的通信设备选择工作天线的方法。To address the above and other problems, the present application provides a method for selecting a working antenna for a communication device having multiple antennas.

具体的,该方法包括对当前工作天线的信号质量指标值进行连续采样以获得采样值,并执行以下步骤:步骤(A),响应于获得最新的采样值,将最新的采样值加入至采用先进先出模式的第一数据序列的队尾,以更新第一数据序列,其中第一数据序列包括连续M个采样值;步骤(B),计算当前第一数据序列中的M个采样值的平均值并加入至采用先进先出模式的第二数据序列的队尾,以更新第二数据序列,其中第二数据序列包括N个平均值;步骤(C),判断当前第二数据序列中的第N个平均值与更新前的第二数据序列中的第一个平均值之间的第一差值是否超过预设第一阈值;步骤(D),响应于第一差值超过预设第一阈值,启动持续时间为T的定时监测,并在持续时间内,重复执行步骤(A)和步骤(B),以更新第一数据序列和第二数据序列;以及,判断定时监测结束时的第二数据序列中的第N个平均值与定时监测开启时的第二数据序列中的第一个平均值之间的第二差值是否超过预设第二阈值;步骤(E),响应于第二差值超过预设第二阈值,触发通信设备重新选择另一天线作为工作天线。Specifically, the method includes continuously sampling the signal quality index value of the current working antenna to obtain the sampled value, and performing the following steps: Step (A), in response to obtaining the latest sampled value, adding the latest sampled value to the tail of the first data sequence using the first-in-first-out mode to update the first data sequence, wherein the first data sequence includes M consecutive sample values; N average values; Step (C), judging whether the first difference between the Nth average value in the current second data sequence and the first average value in the second data sequence before updating exceeds the preset first threshold; Step (D), in response to the first difference exceeding the preset first threshold, start the timing monitoring with a duration of T, and within the duration, repeatedly perform steps (A) and steps (B) to update the first data sequence and the second data sequence; Whether the second difference between the first average values exceeds the preset second threshold; step (E), in response to the second difference exceeding the preset second threshold, triggering the communication device to reselect another antenna as the working antenna.

优选地,在步骤(E)中,响应于第二差值超过预设第二阈值,获取定时监测结束时的第一数据序列,计算第一数据序列中的M个采样值的波动指标,并判断第二差值与波动指标的k倍值之间的第三差值是否超过预设第三阈值,其中k为经验系数;以及,响应于第三差值超过预设第三阈值,触发通信设备重新选择另一天线作为工作天线。进一步优选地,波动指标包括第一数据序列中的首尾采样值的差值、或者第一数据序列中的所有采样值的方差、标准差、极差、变异系数中的任意一种或其组合。Preferably, in step (E), in response to the second difference exceeding the preset second threshold, the first data sequence at the end of the timing monitoring is obtained, the fluctuation index of M sample values in the first data sequence is calculated, and it is judged whether the third difference between the second difference and k times of the fluctuation index exceeds the preset third threshold, where k is an empirical coefficient; and, in response to the third difference exceeding the preset third threshold, the communication device is triggered to reselect another antenna as the working antenna. Further preferably, the fluctuation index includes the difference between the first and last sample values in the first data sequence, or any one of variance, standard deviation, range, and coefficient of variation of all sample values in the first data sequence or a combination thereof.

进一步优选地,重新选择工作天线包括:测量多个天线的信号质量指标值,并选择其中具有最佳信号质量指标值的天线作为通信设备的工作天线。Further preferably, reselecting the working antenna includes: measuring signal quality index values of multiple antennas, and selecting the antenna with the best signal quality index value as the working antenna of the communication device.

进一步优选地,在重新选择通信设备的工作天线后,清空第一数据序列和第二数据序列。Further preferably, after the working antenna of the communication device is reselected, the first data sequence and the second data sequence are cleared.

进一步优选地,信号质量指标值包括接收信号强度指示(RSSI)、丢包率、信噪比(SNR)、误码率(BER)、速率、发射功率中的任意一种或其组合。Further preferably, the signal quality index value includes any one or a combination of received signal strength indication (RSSI), packet loss rate, signal-to-noise ratio (SNR), bit error rate (BER), rate, and transmit power.

优选地,在步骤(A)中,还执行以下操作:判断第一数据序列是否已满,并且,响应于第一数据序列已满,从第一数据序列移除位于第一数据序列的队首的采样值,并将最新的采样值加入至第一数据序列的队尾,以更新第一数据序列。Preferably, in step (A), the following operations are also performed: judging whether the first data sequence is full, and, in response to the first data sequence being full, removing the sampling value at the head of the first data sequence from the first data sequence, and adding the latest sampling value to the tail of the first data sequence to update the first data sequence.

优选地,在步骤(B)中,还执行以下操作:判断第二数据序列是否已满,并且,响应于第二数据序列已满,从第二数据序列移除位于第二数据序列的队首的平均值,并将当前第一数据序列中的M个采样值的平均值加入至第二数据序列的队尾。Preferably, in step (B), the following operations are also performed: judging whether the second data sequence is full, and, in response to the fact that the second data sequence is full, removing the average value at the head of the second data sequence from the second data sequence, and adding the average value of the M sampling values in the current first data sequence to the tail of the second data sequence.

进一步优选地,响应于信号质量指标值为接收信号强度指示,在步骤(A)之前对采样值应用滤波器进行滤波以去除噪点。Further preferably, in response to the signal quality index value being the received signal strength indication, before step (A), apply a filter to the sampled value to remove noise.

进一步优选地,滤波器包括卡尔曼滤波器或其他滤波器中的任意一种。Further preferably, the filter includes a Kalman filter or any one of other filters.

在另一方面,本申请还提供了一种通信设备,包括相互耦合的存储模块、运行模块、定时监测模块以及天线选择模块;其中,存储模块用于存储采用先进先出模式的第一数据序列以及采用先进先出模式的第二数据序列;运行模块被配置为执行以下操作:对当前工作天线的信号质量指标值进行连续采样以获得采样值;响应于获得最新的采样值,将最新的采样值加入至第一数据序列的队尾,以更新第一数据序列,其中第一数据序列包括连续M个采样值;计算当前第一数据序列中的M个采样值的平均值并加入至第二数据序列的队尾,以更新第二数据序列,其中第二数据序列包括N个平均值;判断当前第二数据序列中的第N个平均值与更新前的第二数据序列中的第一个平均值之间的第一差值是否超过预设第一阈值;运行模块还被配置为响应于第一差值超过预设第一阈值,触发定时监测模块的运行;定时监测模块被配置为执行以下操作:启动持续时间为T的定时监测,并在持续时间内,继续执行连续采样,并相应地更新第一数据序列和第二数据序列;以及判断定时监测结束时的第二数据序列中的第N个平均值与定时监测开启时的第二数据序列中的第一个平均值之间的第二差值是否超过预设第二阈值;定时监测模块还被配置为响应于第二差值超过预设第二阈值,触发天线选择模块的运行;天线选择模块被配置为:重新选择另一天线作为工作天线。In another aspect, the present application also provides a communication device, including a storage module coupled to each other, an operation module, a timing monitoring module, and an antenna selection module; wherein the storage module is used to store the first data sequence adopting the first-in-first-out mode and the second data sequence adopting the first-in-first-out mode; the operation module is configured to perform the following operations: continuously sample the signal quality index value of the current working antenna to obtain a sample value; in response to obtaining the latest sample value, add the latest sample value to the tail of the first data sequence to update the first data sequence, wherein the first data sequence includes M consecutive sample values; The average value of the M sampling values in the first data sequence is added to the tail of the second data sequence to update the second data sequence, wherein the second data sequence includes N average values; whether the first difference between the Nth average value in the current second data sequence and the first average value in the second data sequence before updating exceeds the preset first threshold; the operation module is also configured to trigger the operation of the timing monitoring module in response to the first difference exceeding the preset first threshold; , and correspondingly update the first data sequence and the second data sequence; and determine whether the second difference between the Nth average value in the second data sequence when the timing monitoring ends and the first average value in the second data sequence when the timing monitoring starts exceeds a preset second threshold; the timing monitoring module is also configured to trigger the operation of the antenna selection module in response to the second difference exceeding the preset second threshold; the antenna selection module is configured to: reselect another antenna as a working antenna.

优选地,定时监测模块进一步被配置为:响应于第二差值超过预设第二阈值,获取定时监测结束时的第一数据序列,计算第一数据序列中的M个采样值的波动指标,并判断第二差值与波动指标的k倍值之间的第三差值是否超过预设第三阈值,其中k为经验系数;以及,响应于第三差值超过预设第三阈值,触发天线选择模块的运行。Preferably, the timing monitoring module is further configured to: in response to the second difference exceeding the preset second threshold, acquire the first data sequence at the end of the timing monitoring, calculate the fluctuation index of the M sampling values in the first data sequence, and determine whether the third difference between the second difference and k times the fluctuation index exceeds a preset third threshold, where k is an empirical coefficient; and, in response to the third difference exceeding the preset third threshold, trigger the operation of the antenna selection module.

在又一方面,本申请还提供了一种通信设备,其包括:包括至少两个天线以及耦合到至少两个天线的收发器的无线电路;以及被配置成控制无线电路以从至少两个天线中选择工作天线的控制电路,其中控制电路被配置成执行根据本申请的各个实施例的方法的步骤。In yet another aspect, the present application also provides a communication device, comprising: a wireless circuit comprising at least two antennas and a transceiver coupled to the at least two antennas; and a control circuit configured to control the wireless circuit to select a working antenna from the at least two antennas, wherein the control circuit is configured to perform the steps of the method according to various embodiments of the present application.

在再一方面,本申请还提供了一种存储指令的计算机可读存储介质,该指令在由处理器执行时配置为执行如上所述的任一方法。In yet another aspect, the present application also provides a computer-readable storage medium storing instructions configured to perform any of the above-mentioned methods when executed by a processor.

本申请的方法通过对当前工作天线的信号的采样监测,并与该天线的历史数据进行判断,从而实现了在不切换工作天线的情况下预测环境的变化,并在必要时重新选择工作天线。本申请所提供的方法,提高了具有多天线的通信设备的数据吞吐量,在保障稳定的数据传输的前提下,避免了不必要的频繁天线切换。特别地,本申请的方法在判断过程中仅使用少量的存储空间,且计算简单。本申请的方法可以过滤人为对天线信号的干扰,以进一步保证了数据的传输稳定。The method of the present application monitors the signal of the current working antenna and judges it with the historical data of the antenna, so as to predict the change of the environment without switching the working antenna, and reselect the working antenna when necessary. The method provided by the present application improves the data throughput of a communication device with multiple antennas, and avoids unnecessary frequent antenna switching under the premise of ensuring stable data transmission. In particular, the method of the present application only uses a small amount of storage space in the judgment process, and the calculation is simple. The method of the present application can filter the artificial interference to the antenna signal, so as to further ensure the stability of data transmission.

附图说明Description of drawings

在下文中,将基于实施例参考附图进一步解释本申请。Hereinafter, the present application will be further explained based on the embodiments with reference to the accompanying drawings.

图1示意性地示出适用本申请实施例提供的方法的通信系统;Figure 1 schematically shows a communication system to which the method provided by the embodiment of the present application is applied;

图2示意性地示出了根据本申请的方法的一种具体实施方式的流程图;Fig. 2 schematically shows a flow chart according to a specific embodiment of the method of the present application;

图3示意性地示出根据本申请的方法的第一数据序列和第二数据序列的示例的示意图;Fig. 3 schematically shows a schematic diagram of an example of a first data sequence and a second data sequence according to the method of the present application;

图4示意性地示出根据本申请的方法的另一具体实施方式的流程图;Fig. 4 schematically shows a flow chart according to another embodiment of the method of the present application;

图5示意性地示出根据本申请的实施例提供的通信设备500的结构示意图;FIG. 5 schematically shows a schematic structural diagram of a communication device 500 provided according to an embodiment of the present application;

图6A和图6B分别示意性地示出根据本申请实施例的通信设备的状态机的示意流程图和另一示例流程图;FIG. 6A and FIG. 6B schematically show a schematic flow chart and another example flow chart of a state machine of a communication device according to an embodiment of the present application;

图7示意性地示出根据本申请实施例提供的通信设备700的结构示意图;FIG. 7 schematically shows a schematic structural diagram of a communication device 700 provided according to an embodiment of the present application;

图8示意性地示出根据本申请的实施例的一个具体示例。Fig. 8 schematically shows a specific example of an embodiment according to the present application.

具体实施方式Detailed ways

以下将结合附图和具体的实施方式,对本申请的方法和装置进行详细说明。应理解,附图所示以及下文所述的实施例仅仅是说明性的,而不作为对本申请的限制。The method and device of the present application will be described in detail below with reference to the accompanying drawings and specific implementation manners. It should be understood that the embodiments shown in the drawings and described below are for illustrative purposes only, and are not intended to limit the application.

为了便于理解本申请实施例,下面以图1示出的通信系统为例,详细说明适用本申请实施例提供的方法的通信系统。如图1所示,该通信系统100可以包括至少一个终端通信设备,例如图1中所示的终端通信设备102,其也可以为配置于该终端通信设备中的芯片;以及至少一个网络设备,例如例如图1中示出为基站的网络设备102,也可以为配置于该网络设备中的芯片。在另外一些示例中,网络设备102可以是路由器设备。In order to facilitate understanding of the embodiment of the present application, the following uses the communication system shown in FIG. 1 as an example to describe in detail the communication system applicable to the method provided by the embodiment of the present application. As shown in FIG. 1, the communication system 100 may include at least one terminal communication device, such as the terminal communication device 102 shown in FIG. 1, which may also be a chip configured in the terminal communication device; and at least one network device, such as the network device 102 shown as a base station in FIG. 1, may also be a chip configured in the network device. In other examples, network device 102 may be a router device.

终端通信设备102可以具有多个天线,以向外部传输信号或从外部接收信号。作为示例而非限制,终端通信设备可以通过天线开关用以选择不同的天线。在一个示例中,在终端通信设备最多支持16根天线的情况下,天线开关最多可以由四个地址管脚Antenna_select[0:3]进行控制。通过向该四个地址管脚输入不同的值,以选择不同的天线。例如,向四个地址管脚的输入值为“0b1011”表示选中天线11作为当前的工作天线。作为示例,地址管脚Antenna_select[0:3]的默认值可以设置为“0b0000”,以表示默认选择天线0作为当前的工作天线。在另一个示例中,终端通信设备仅支持2根天线,并通过两个地址管脚Antenna_select[0:1]进行控制,其中地址管脚的输入值为“0b01”表示选中天线0,输入值“0b10”表示选中天线1。在这种情况下,输入值“0b00”和“0b11”为非法值。作为示例,所选中的天线作为当前的工作天线,用于接收或发送数据。The terminal communication device 102 may have multiple antennas to transmit signals to or receive signals from the outside. As an example and not a limitation, the terminal communication device may use an antenna switch to select different antennas. In an example, when the terminal communication device supports up to 16 antennas, the antenna switch can be controlled by up to four address pins Antenna_select[0:3]. Different antennas can be selected by inputting different values to the four address pins. For example, the input value to the four address pins is "0b1011", indicating that the antenna 11 is selected as the current working antenna. As an example, the default value of the address pin Antenna_select[0:3] may be set to "0b0000", which indicates that antenna 0 is selected as the current working antenna by default. In another example, the terminal communication device only supports 2 antennas, which are controlled by two address pins Antenna_select[0:1], where the input value of the address pin is "0b01" indicating that antenna 0 is selected, and the input value of "0b10" indicates that antenna 1 is selected. In this case, the input values "0b00" and "0b11" are illegal values. As an example, the selected antenna is used as a current working antenna for receiving or sending data.

在通信设备配置为执行自动选择天线时,可以根据信道状态信息、天线信号等因素自动选择最合适的天线作为工作天线。然而,一方面这种方法需要获取多个天线的信号情况,以便做出选择,因此消耗的资源较大;另外一方面,如果频繁切换天线,则可能导致数据传输的不稳定,同时,也会出现一些因人为干扰而导致的不必要的天线切换。When the communication device is configured to perform automatic antenna selection, the most suitable antenna can be automatically selected as the working antenna according to factors such as channel state information and antenna signals. However, on the one hand, this method needs to obtain the signal conditions of multiple antennas in order to make a selection, so it consumes a lot of resources; on the other hand, if the antennas are switched frequently, it may lead to unstable data transmission, and at the same time, some unnecessary antenna switching caused by human interference will also occur.

有鉴于此,本申请提供一种用于为具有多个天线的通信设备选择工作天线的方法。根据本申请的方法,提供了避免因人为导致的干扰而引起的频繁的天线切换、并且提高数据传输吞吐量的天线选择的改进方式。以下结合多个实施例和具体示例加以说明。In view of this, the present application provides a method for selecting a working antenna for a communication device with multiple antennas. According to the method of the present application, an improved way of antenna selection that avoids frequent antenna switching due to human-induced interference and improves data transmission throughput is provided. The following will be described in conjunction with multiple embodiments and specific examples.

实施例1Example 1

图2示出了根据本申请的方法的一种具体实施方式的流程图。根据本实施例的方法,对当前工作天线的信号质量指标值进行连续采样以获得采样值。作为示例而非限制,信号质量指标值可以包括接收信号强度指示(RSSI)、丢包率、信噪比(SNR)、误码率(BER)、速率、发射功率中的任意一种或其组合。其中,连续采样可以采用固定周期或者非固定周期的采样方式。作为示例,可以采用固定周期的采样方式,例如每隔100毫秒获取当前工作天线的信号质量指标值,例如当前工作天线的信号强度。值得注意的是,在通信领域,接收信号强度指示(RSSI)是无线信号在传播过程中逐渐衰减后,接收端天线接收到的信号强度的指示,RSSI是一个相对值,通常以dBm为单位,表示接收到的信号强度与1毫瓦(mW)的参考功率之间的比率,并且RSSI值越大,表示接收到的信号越强。接收信号强度指示受到多种因素的影响,如传输距离、障碍物、天气等。Fig. 2 shows a flow chart of a specific embodiment of the method according to the present application. According to the method of this embodiment, the signal quality index value of the current working antenna is continuously sampled to obtain the sampled value. As an example and not a limitation, the signal quality indicator value may include any one or a combination of received signal strength indication (RSSI), packet loss rate, signal-to-noise ratio (SNR), bit error rate (BER), rate, and transmit power. Wherein, the continuous sampling may adopt a fixed-period or non-fixed-period sampling manner. As an example, a fixed-period sampling manner may be adopted, for example, the signal quality index value of the current working antenna, such as the signal strength of the current working antenna, may be acquired every 100 milliseconds. It is worth noting that in the field of communication, the Received Signal Strength Indicator (RSSI) is an indication of the signal strength received by the antenna at the receiving end after the wireless signal gradually attenuates during propagation. RSSI is a relative value, usually in dBm, indicating the ratio between the received signal strength and the reference power of 1 milliwatt (mW), and the larger the RSSI value, the stronger the received signal. The received signal strength indication is affected by many factors, such as transmission distance, obstacles, weather, etc.

在持续采样的情况下,依次执行以下步骤202至步骤210,以选择天线。在另一种实施例中,考虑到采样值的数据可能存在噪点,可选地在执行步骤202至步骤210之前,采用滤波器进行预处理,以过滤掉噪点。优选地,每次获得新的采样值时都先进行滤波。可选地,滤波器可以为卡尔曼滤波器、均值滤波器、IIR滤波器、抖动滤波器或其他滤波器中的任意一种。可选地,当采样值为当前工作天线的丢包率时,则无需应用滤波器进行预处理。In the case of continuous sampling, the following steps 202 to 210 are performed in sequence to select an antenna. In another embodiment, considering that there may be noise in the sampled value data, optionally, before performing steps 202 to 210, a filter is used for preprocessing to filter out the noise. Preferably, filtering is performed each time a new sample value is obtained. Optionally, the filter may be any one of Kalman filter, mean value filter, IIR filter, jitter filter or other filters. Optionally, when the sampling value is the packet loss rate of the current working antenna, there is no need to apply a filter for preprocessing.

在步骤202中,响应于获得最新的采样值,将最新的采样值加入至采用先进先出模式的第一数据序列的队尾,以更新第一数据序列,其中第一数据序列包括连续M个采样值。In step 202, in response to obtaining the latest sampled value, add the latest sampled value to the tail of the first data sequence using the first-in-first-out mode to update the first data sequence, wherein the first data sequence includes M consecutive sampled values.

优选地,步骤202还包括判断第一数据序列是否已满,并且,响应于第一数据序列已满,从第一数据序列移除位于第一数据序列的队首的采样值,并将最新的采样值加入至第一数据序列的队尾,以更新第一数据序列。Preferably, step 202 also includes judging whether the first data sequence is full, and, in response to the first data sequence being full, removing the sampling value at the head of the first data sequence from the first data sequence, and adding the latest sampling value to the tail of the first data sequence to update the first data sequence.

在步骤204中,计算当前第一数据序列中的M个采样值的平均值并加入至采用先进先出模式的第二数据序列的队尾,以更新第二数据序列,其中第二数据序列包括N个平均值。In step 204, calculate the average value of the M sampling values in the current first data sequence and add it to the tail of the second data sequence using the first-in-first-out mode to update the second data sequence, wherein the second data sequence includes N average values.

优选地,步骤204还包括判断第二数据序列是否已满,并且,响应于第二数据序列已满,从第二数据序列移除位于第二数据序列的队首的平均值,并将当前第一数据序列中的M个采样值的平均值加入至第二数据序列的队尾。Preferably, step 204 also includes judging whether the second data sequence is full, and, in response to the fact that the second data sequence is full, removing the average value at the head of the second data sequence from the second data sequence, and adding the average value of the M sampling values in the current first data sequence to the tail of the second data sequence.

在步骤206中,判断当前第二数据序列中的第N个平均值与更新前的第二数据序列中的第一个平均值之间的第一差值是否超过预设第一阈值;In step 206, it is judged whether the first difference between the Nth average value in the current second data sequence and the first average value in the second data sequence before updating exceeds a preset first threshold;

在步骤208中,响应于第一差值超过预设第一阈值,启动持续时间为T的定时监测,并在持续时间内,重复执行步骤202和步骤204,以更新第一数据序列和第二数据序列;以及,判断定时监测结束时的第二数据序列中的第N个平均值与定时监测开启时的第二数据序列中的第一个平均值之间的第二差值是否超过预设第二阈值。值得注意的是,持续时间T的设置可以根据经验调整。优选地,考虑到如果是由人为干扰,例如人经过通信设备,而导致的信号波动,此类波动通常的存续时间不超过秒级别,因此,例如,T可以设置为6秒。In step 208, in response to the first difference exceeding the preset first threshold, start timing monitoring with a duration of T, and within the duration, repeatedly execute steps 202 and 204 to update the first data sequence and the second data sequence; and determine whether the second difference between the Nth average value in the second data sequence when the timing monitoring ends and the first average value in the second data sequence when the timing monitoring starts exceeds a preset second threshold. It is worth noting that the setting of the duration T can be adjusted empirically. Preferably, considering that signal fluctuations are caused by human interference, such as people passing by the communication device, the duration of such fluctuations usually does not exceed a second level, so, for example, T can be set to 6 seconds.

在步骤210中,响应于第二差值超过预设第二阈值,触发通信设备重新选择另一天线作为工作天线。In step 210, in response to the second difference exceeding the preset second threshold, the communication device is triggered to reselect another antenna as the working antenna.

优选地,重新选择工作天线包括:测量多个天线的信号质量指标值,并选择其中具有最佳信号质量指标值的天线作为通信设备的工作天线。Preferably, reselecting the working antenna includes: measuring signal quality index values of multiple antennas, and selecting the antenna with the best signal quality index value as the working antenna of the communication device.

优选地,在重新选择通信设备的工作天线后,清空第一数据序列和第二数据序列。Preferably, after the working antenna of the communication device is reselected, the first data sequence and the second data sequence are cleared.

作为示例而非限制,针对不同的应用场景,可以将M和N分别设置为不同的数值。例如在办公室场景中,由于经常有人走动而产生干扰,所以可以将M和N的数值设置得更大一些,而在一些环境变化不大的场景中,例如工厂,则可以将M和N的数值设置得更小一些。此外,除了考虑应用场景之外,设置M和N的数值还可以考虑通信设备的内存大小。由于通常通信设备为嵌入式设备,其内存空间受限,因此M和N的数值不宜设置得过大。可选地,在复杂环境中M可以设置为15,而在相对简单的环境中M则可以为5至10中的任一数值。As an example but not a limitation, M and N may be set to different values for different application scenarios. For example, in an office scene, the values of M and N can be set to be larger because people often move around and cause interference. In some scenes where the environment does not change much, such as a factory, the values of M and N can be set to be smaller. In addition, in addition to considering the application scenario, setting the values of M and N may also consider the memory size of the communication device. Since communication devices are usually embedded devices with limited memory space, the values of M and N should not be set too large. Optionally, M may be set to 15 in a complex environment, while M may be any value from 5 to 10 in a relatively simple environment.

作为示例,图3示出了根据上述图2中的方法的步骤的第一数据序列和第二数据序列的示例的示意图。其中,获得当前工作天线的信号质量指标值的最新采样值记为x。在步骤202中,判断该第一数据序列L1是否已满;如果是,则根据步骤202,将最新采样值加入至第一数据序列L1的队尾,并将该序列中原先的队首的数据从序列中移除;如果第一数据序列未满,则直接将最新采样值加入智第一数据序列的队尾。以图3的示例为例,该第一数据序列L1已包括M个采样值an1、an2、...anM,即第一数据序列已满。响应于获得最新采样值x,根据方法中的步骤202更新第一数据序列L′1为an2、an3、...an(M+1),其中原先的队首的数据an1从该第一数据序列中被移除,且最新采样值x被加入至该第一数据序列的队尾,即an(M+1)等于x。在步骤204中,计算该第一数据序列中的M个采样值的平均值。以图3的示例为例,更新前的第二数据序列L2已满,并包括N个平均值avg1、avg2、...avgN,其中avgN为更新前的第一数据序列中的M个采样值an1、an2、...anM的平均值。在根据步骤204更新后,更新后的第二数据序列L′2包括avg2、avg3、...avgN+1,其中,avgN+1对应于更新后的第一数据序列中的M个采样值an2、an3、...an(M+1)的平均值。在步骤206中,判断当前第二数据序列中的第N个平均值,即avgN+1,与更新前的第二数据序列中的第一个平均值,即avg1,两者之间的第一差值,并判断该第一差值是否超过预设的第一阈值,该第一差值可以标记为Diff1。如果第一差值超过预设的第一阈值,则其指示天线的运行状态可能已经发生变化。因此,启动持续时间为T的定时监测,在该持续时间内,持续获取最新的采样值,并重复执行如上所述的步骤202和步骤204,以不断更新第一数据序列和第二数据序列,直至定时监测结束。作为示例,在定时监测开启的T0时刻,第一数据序列为其包括M个采样值,例如记为anx0、an(x0+1)、...an(x0+M-1),并且第二数据序列为/>其包括N个平均值第二数据序列,其包括N个平均值,avgy0、avgy0+1、...avgy0+N-1。在定时监测结束的T1时刻,获得更新的第一数据序列为/>其包括M个采样值,例如记为anx1、an(x1+1)、...an(x1+M-1),并且获得更新的第二数据序列为/>其包括N个平均值,avgy1、avgy1+1、...avgy1+N-1,并且其中avgy1+N-1等于更新的第一数据序列为/>中的M个采样值的平均值。在步骤208中,还包括判断定时监测结束时的第二数据序列中的第N个平均值,例如示例中的avgy1+N-1,与定时监测开启时的第二数据序列中的第一个平均值,例如示例中的avgy0,两者之间的第二差值是否超过预设第二阈值,该第二差值可以标记为Diff2。响应于该第二差值超过预设第二阈值,则触发通信设备重新选择另一天线作为工作天线。As an example, FIG. 3 shows a schematic diagram of an example of a first data sequence and a second data sequence according to the steps of the above-mentioned method in FIG. 2 . Wherein, the latest sampling value for obtaining the signal quality index value of the current working antenna is denoted as x. In step 202, it is judged whether the first data sequence L1 is full; if so, according to step 202, the latest sampled value is added to the tail of the first data sequence L1 , and the data of the original head of the queue in the sequence is removed from the sequence; if the first data sequence is not full, the latest sampled value is directly added to the tail of the first data sequence. Taking the example in FIG. 3 as an example, the first data sequence L 1 already includes M sampling values an1 , an2 , . . . anM , that is, the first data sequence is full. In response to obtaining the latest sampled value x, update the first data sequence L′ 1 according to step 202 in the method as a n2 , a n3 , . . . In step 204, the average value of M sample values in the first data sequence is calculated. Taking the example in Fig. 3 as an example, the second data sequence L2 before updating is full and includes N average values avg 1 , avg 2 , ... avg N , where avg N is the average value of M sampling values a n1 , a n2 , ... a nM in the first data sequence before updating. After updating according to step 204 , the updated second data sequence L′ 2 includes avg 2 , avg 3 , . . . In step 206, determine the first difference between the Nth average value in the current second data sequence, i.e. avg N+1 , and the first average value in the second data sequence before updating, i.e. avg 1 , and determine whether the first difference value exceeds a preset first threshold value, and the first difference value can be marked as Diff 1 . If the first difference exceeds the preset first threshold, it indicates that the operating state of the antenna may have changed. Therefore, the timing monitoring with a duration of T is started, and during this duration, the latest sampling value is continuously obtained, and the above-mentioned steps 202 and 204 are repeatedly executed to continuously update the first data sequence and the second data sequence until the timing monitoring ends. As an example, at time T0 when timing monitoring is turned on, the first data sequence is It includes M sample values, for example denoted as a nx0 , a n(x0+1) , ... a n(x0+M-1) , and the second data sequence is /> It comprises a second data sequence of N average values, which comprises N average values, avg y0 , avg y0+1 , . . . avg y0+N-1 . At time T1 when the regular monitoring ends, the first updated data sequence obtained is /> It includes M sampling values, for example marked as a nx1 , a n(x1+1) ,...a n(x1+M-1) , and the updated second data sequence is /> It includes N average values, avg y1 , avg y1+1 , ... avg y1+N-1 , and where avg y1+N-1 is equal to the updated first data sequence is /> The average value of the M sample values in . In step 208, it also includes determining whether the second difference between the Nth average value in the second data sequence when the timing monitoring ends, such as avg y1+N-1 in the example, and the first average value in the second data sequence when the timing monitoring starts, such as avg y0 in the example, exceeds a preset second threshold value, and the second difference value can be marked as Diff 2 . In response to the second difference exceeding the preset second threshold, the communication device is triggered to reselect another antenna as the working antenna.

实施例1的具体示例Concrete example of embodiment 1

在根据上述实施例1的方法的一个具体示例中,采用固定周期的采样方式,每隔100毫秒获取一次当前工作天线的信号质量指标值的采样值。第一数据序列中包括10个采样值,即M等于10;第二数据序列中包括25个平均值,即N等于25。预设第一阈值设置为2.4dB,预设第二阈值设置为3.5dB。In a specific example of the method according to the above-mentioned embodiment 1, the sampling value of the signal quality index value of the current working antenna is acquired once every 100 milliseconds by adopting a fixed-period sampling manner. The first data sequence includes 10 sample values, that is, M is equal to 10; the second data sequence includes 25 average values, that is, N is equal to 25. The preset first threshold is set to 2.4dB, and the preset second threshold is set to 3.5dB.

例如,在一个示例中,定时监测周期设置为6秒,在步骤208中获得第二差值为4dB,其超过预设第二阈值3.5dB,因此,触发通信设备重新选择另一天线作为工作天线。For example, in one example, the timing monitoring period is set to 6 seconds, and the second difference value obtained in step 208 is 4dB, which exceeds the preset second threshold of 3.5dB. Therefore, the communication device is triggered to reselect another antenna as the working antenna.

实施例2Example 2

根据上述实施例1,为了进一步地有效避免由人为干扰导致的不必要的天线切换,本申请提供了另一用于天线选择的方法。如图4,示出了根据本申请的方法的另一具体实施方式的流程图。According to the first embodiment above, in order to further effectively avoid unnecessary antenna switching caused by man-made interference, the present application provides another method for antenna selection. FIG. 4 shows a flow chart of another specific embodiment of the method according to the present application.

根据本实施例的方法,对当前工作天线的信号质量指标值进行连续采样以获得采样值,并依次执行以下步骤402至步骤410,以选择天线。According to the method of this embodiment, the signal quality index value of the currently working antenna is continuously sampled to obtain the sampled value, and the following steps 402 to 410 are executed in order to select an antenna.

在步骤402中,响应于获得最新的采样值,将最新的采样值加入至采用先进先出模式的第一数据序列的队尾,以更新第一数据序列,其中第一数据序列包括连续M个采样值。In step 402, in response to obtaining the latest sampled value, add the latest sampled value to the tail of the first data sequence using the first-in-first-out mode to update the first data sequence, wherein the first data sequence includes M consecutive sampled values.

优选地,步骤402还包括判断第一数据序列是否已满,并且,响应于第一数据序列已满,从第一数据序列移除位于第一数据序列的队首的采样值,并将最新的采样值加入至第一数据序列的队尾,以更新第一数据序列。Preferably, step 402 also includes judging whether the first data sequence is full, and, in response to the first data sequence being full, removing the sampling value at the head of the first data sequence from the first data sequence, and adding the latest sampling value to the tail of the first data sequence to update the first data sequence.

在步骤404中,计算当前第一数据序列中的M个采样值的平均值并加入至采用先进先出模式的第二数据序列的队尾,以更新第二数据序列,其中第二数据序列包括N个平均值。In step 404, the average value of the M sample values in the current first data sequence is calculated and added to the tail of the second data sequence using the first-in-first-out mode to update the second data sequence, wherein the second data sequence includes N average values.

优选地,步骤404还包括判断第二数据序列是否已满,并且,响应于第二数据序列已满,从第二数据序列移除位于第二数据序列的队首的平均值,并将当前第一数据序列中的M个采样值的平均值加入至第二数据序列的队尾。Preferably, step 404 also includes judging whether the second data sequence is full, and, in response to the fact that the second data sequence is full, removing the average value at the head of the second data sequence from the second data sequence, and adding the average value of the M sampling values in the current first data sequence to the tail of the second data sequence.

在步骤406中,判断当前第二数据序列中的第N个平均值与更新前的第二数据序列中的第一个平均值之间的第一差值是否超过预设第一阈值;In step 406, it is judged whether the first difference between the Nth average value in the current second data sequence and the first average value in the second data sequence before updating exceeds a preset first threshold;

在步骤408中,响应于第一差值超过预设第一阈值,启动持续时间为T的定时监测,并在持续时间内,重复执行步骤402和步骤404,以更新第一数据序列和第二数据序列;以及,判断定时监测结束时的第二数据序列中的第N个平均值与定时监测开启时的第二数据序列中的第一个平均值之间的第二差值是否超过预设第二阈值;In step 408, in response to the first difference exceeding the preset first threshold, start the timing monitoring with a duration of T, and within the duration, repeatedly execute steps 402 and 404 to update the first data sequence and the second data sequence; and determine whether the second difference between the Nth average value in the second data sequence when the timing monitoring ends and the first average value in the second data sequence when the timing monitoring starts exceeds the preset second threshold;

在步骤410中,响应于第二差值超过预设第二阈值,获取定时监测结束时的第一数据序列,计算第一数据序列中的M个采样值的波动指标,并判断第二差值与波动指标的k倍值之间的第三差值是否超过预设第三阈值,其中k为经验系数;以及,响应于第三差值超过预设第三阈值,触发通信设备重新选择另一天线作为工作天线。其中,作为示例而非限制,波动指标包括第一数据序列中的首尾采样值的差值、或者第一数据序列中的所有采样值的方差、标准差、极差、变异系数中的任意一种或其组合。优选地,为了尽量减少数据传输时所需的额外资源,采用方差作为波动指标。作为示例,其中k为经验系数,其可根据第二差值和波动指标的历史值确定。在一个示例中,k可以取值为0.05或0.1或其他数值。In step 410, in response to the second difference exceeding the preset second threshold, obtain the first data sequence at the end of the timing monitoring, calculate the fluctuation index of the M sampling values in the first data sequence, and judge whether the third difference between the second difference and k times the fluctuation index exceeds the preset third threshold, where k is an empirical coefficient; and, in response to the third difference exceeding the preset third threshold, trigger the communication device to reselect another antenna as the working antenna. Wherein, as an example and not a limitation, the fluctuation index includes the difference between the first and last sampled values in the first data sequence, or any one or a combination of the variance, standard deviation, range, and coefficient of variation of all sampled values in the first data sequence. Preferably, in order to minimize the additional resources required for data transmission, the variance is used as the fluctuation index. As an example, where k is an empirical coefficient, which can be determined according to the second difference and the historical value of the volatility index. In an example, k may take a value of 0.05 or 0.1 or other numerical values.

作为示例,给出根据本实施例2的方法的进一步步骤。如上所述,作为示例,在定时监测开启的T0时刻,第一数据序列为其包括M个采样值,例如记为anx0、an(x0+1)、...an(x0+M-1),并且第二数据序列为/>其包括N个平均值第二数据序列,其包括N个平均值,avgy0、avgy0+1、...avgy0+N-1,其中y0+N-1=x0。在定时监测结束的T1时刻,获得更新的第一数据序列为/>其包括M个采样值,例如记为anx1、an(x1+1)、...an(x1+M-1),并且获得更新的第二数据序列为/>其包括N个平均值,avgy1、avgy1+1、...avgy1+N-1,并且其中avgy1+N-1等于更新的第一数据序列为/>中的M个采样值的平均值,即其中y1+N-1=x1。在步骤408中,还包括判断定时监测结束时的第二数据序列中的第N个平均值,例如示例中的avgy1+N-1,与定时监测开启时的第二数据序列中的第一个平均值,例如示例中的avgy0,两者之间的第二差值是否超过预设第二阈值,该第二差值标记为Dif2。响应于该第二差值超过预设第二阈值,获取定时监测结束时的第一数据序列,即/>其包括M个采样值,例如记为anx1、an(x1+1)、...an(x1+M-1),并计算该序列中的M个采样值的波动指标,例如方差。以波动指标为方差为例,将该M个采样值的波动指标记为/>在步骤410中,进一步包括判断第二差值Diff2与波动指标/>的k倍值之间的第三差值是否超过预设第三阈值,其中第三差值标记为Diff3As an example, further steps of the method according to Embodiment 2 are given. As mentioned above, as an example, at time T0 when timing monitoring is turned on, the first data sequence is It includes M sample values, for example denoted as a nx0 , a n(x0+1) , ... a n(x0+M-1) , and the second data sequence is /> It comprises a second data sequence of N average values, which comprises N average values, avg y0 , avg y0+1 , . . . avg y0+N-1 , where y 0 +N-1=x 0 . At time T1 when the regular monitoring ends, the first updated data sequence obtained is /> It includes M sampling values, for example marked as a nx1 , a n(x1+1) ,...a n(x1+M-1) , and the updated second data sequence is /> It includes N average values, avg y1 , avg y1+1 , ... avg y1+N-1 , and where avg y1+N-1 is equal to the updated first data sequence is /> The average value of the M sampling values in , that is, where y 1 +N-1=x 1 . In step 408, it also includes determining whether the second difference between the Nth average value in the second data sequence when the timing monitoring ends, such as avg y1+N-1 in the example, and the first average value in the second data sequence when the timing monitoring starts, such as avg y0 in the example, exceeds a preset second threshold, and the second difference is marked as Dif 2 . In response to the second difference exceeding the preset second threshold, the first data sequence at the end of the timing monitoring is obtained, that is, /> It includes M sampling values, for example denoted as a nx1 , a n(x1+1) , . Taking the fluctuation index as the variance as an example, the fluctuation index of the M sampling values is denoted as /> In step 410, it further includes judging the second difference Diff 2 and the fluctuation index /> Whether the third difference between k times of values exceeds a preset third threshold, where the third difference is marked as Diff 3 .

实施例2的具体示例Concrete example of embodiment 2

在根据上述实施例2的方法的一个具体示例中,采用固定周期的采样方式,每隔100毫秒获取一次当前工作天线的信号质量指标值的采样值。第一数据序列中包括10个采样值,即M等于10;第二数据序列中包括25个平均值,即N等于25。预设第一阈值设置为2.4dB,预设第二阈值设置为3.5dB,以及预设第三阈值设置为3.5dB。此外,经验系数k设置为0.1。In a specific example of the method according to the above-mentioned embodiment 2, the sampling value of the signal quality index value of the current working antenna is acquired once every 100 milliseconds by adopting a fixed-period sampling manner. The first data sequence includes 10 sample values, that is, M is equal to 10; the second data sequence includes 25 average values, that is, N is equal to 25. The preset first threshold is set to 2.4dB, the preset second threshold is set to 3.5dB, and the preset third threshold is set to 3.5dB. In addition, the empirical coefficient k is set to 0.1.

例如,在一个示例中,定时监测周期设置为6秒,在步骤408中获得第二差值Diff2为4dB,其超过预设第二阈值,因此,继续获取定时监测结束时的第一数据序列中的10个采样值的波动指标此处为方差,其值为15dB。因此,在步骤410中,判断第二差值与波动指标的k倍值之间的第三差值为/>因此,未超过预设第三阈值。由此,在该示例中,不触发通信设备重新选择另一天线作为工作天线。For example, in one example, the timing monitoring period is set to 6 seconds, and the second difference Diff 2 obtained in step 408 is 4dB, which exceeds the preset second threshold, therefore, continue to acquire the fluctuation index of the 10 sample values in the first data sequence when the timing monitoring ends Here is the variance with a value of 15dB. Therefore, in step 410, it is judged that the third difference between the second difference and k times of the volatility index is /> Therefore, the preset third threshold is not exceeded. Thus, in this example, the communication device is not triggered to reselect another antenna as the working antenna.

在该示例中,假设一种场景,工作人员来到工作台前操作设备,可能会给通信设备带来干扰,尽管其不太可能在6秒内离开,但在这种人为干扰并非长时间的,因此在这种场景中不必然需要切换天线。尽管工作人员的出现会导致在定时监测启动和结束时的平均值的第二差值增大,其指示环境可能已经发生变化。但是,由于工作人员在操作机器时一般会产生至少轻微幅度的动作,例如,其身体的摆动会造成工作天线的采样值的波动,因此第一数据序列中的采样值的波动比较大。由此,根据本申请的实施例,根据上述步骤410,通过判断第二差值与波动指标的k倍值之间的第三差值是否超过预设第三阈值,可以有效排除人为干扰导致的不必要的天线切换,避免了频繁切换天线。In this example, assume a scenario where a worker comes to the workbench to operate the equipment, which may cause interference to the communication equipment. Although it is unlikely to leave within 6 seconds, such man-made interference is not for a long time, so it is not necessary to switch the antenna in this scenario. Although the presence of a worker would cause a second difference in the average value at the start and end of the timed monitoring to increase, this is an indication that the environment may have changed. However, since the workers generally have at least slight movements when operating the machine, for example, the swing of their body will cause fluctuations in the sampling values of the working antenna, so the fluctuations in the sampling values in the first data sequence are relatively large. Therefore, according to the embodiment of the present application, according to the above step 410, by judging whether the third difference between the second difference and the k-fold value of the fluctuation index exceeds the preset third threshold, unnecessary antenna switching caused by man-made interference can be effectively eliminated, and frequent antenna switching is avoided.

值得注意的是,本申请的各个实施例的方法,其在执行过程中所需的存储空间极少,且计算量小,仅需轻量级的存储空间和处理能力即可实现本申请的方法。It is worth noting that the methods of the various embodiments of the present application require very little storage space and a small amount of calculation during execution, and the method of the present application can be realized only with light storage space and processing power.

实施例3Example 3

图5是本申请实施例提供的具有至少两个天线的通信设备500的结构示意图。该终端设备500可应用于如图1所示的系统中,以执行上述方法实施例中的方法。FIG. 5 is a schematic structural diagram of a communication device 500 provided with at least two antennas according to an embodiment of the present application. The terminal device 500 may be applied to the system shown in FIG. 1 to execute the methods in the foregoing method embodiments.

如图所示,该通信设备包括包含至少两个天线502以及耦合到两个天线的收发器504的无线电路、以及可与该无线电路互相通信的控制电路506,其中控制电路506被配置为控制该无线电路,以从该至少两个天线502中选择工作天线。收发器输出的数据或控制信令可以通过天线发送出去,或通过天线接收数据或控制信令。可选地,该通信设备还可以包括存储器508。其中,控制电路506、收发器504和存储器508之间可以通过内部连接通路互相通信,以传递控制和/或数据信号。As shown, the communication device includes a wireless circuit comprising at least two antennas 502 and a transceiver 504 coupled to the two antennas, and a control circuit 506 intercommunicable with the wireless circuit, wherein the control circuit 506 is configured to control the wireless circuit to select an active antenna from the at least two antennas 502. The data or control signaling output by the transceiver can be sent out through the antenna, or the data or control signaling can be received through the antenna. Optionally, the communication device may further include a memory 508 . Wherein, the control circuit 506, the transceiver 504 and the memory 508 may communicate with each other through an internal connection path to transmit control and/or data signals.

其中,控制电路506被配置为:(1)对当前工作天线的信号质量指标值进行连续采样以获得采样值;(2)响应于获得最新的采样值,将最新的采样值加入至采用先进先出模式的第一数据序列的队尾,以更新第一数据序列,其中第一数据序列包括连续M个采样值;(3)计算当前第一数据序列中的M个采样值的平均值并加入至采用先进先出模式的第二数据序列的队尾,以更新第二数据序列,其中第二数据序列包括N个平均值;(4)判断当前第二数据序列中的第N个平均值与更新前的第二数据序列中的第一个平均值之间的第一差值是否超过预设第一阈值;(5)响应于第一差值超过预设第一阈值,启动持续时间为T的定时监测,并在持续时间内,继续执行连续采样,并相应地更新第一数据序列和第二数据序列;以及,判断定时监测结束时的第二数据序列中的第N个平均值与定时监测开启时的第二数据序列中的第一个平均值之间的第二差值是否超过预设第二阈值;(6)响应于第二差值超过预设第二阈值,触发控制电路重新选择另一天线作为工作天线。Wherein, the control circuit 506 is configured to: (1) continuously sample the signal quality index value of the current working antenna to obtain the sampled value; (2) in response to obtaining the latest sampled value, add the latest sampled value to the tail of the first data sequence using the FIFO mode to update the first data sequence, wherein the first data sequence includes M consecutive sample values; (4) judging whether the first difference between the Nth average value in the current second data sequence and the first average value in the second data sequence before updating exceeds the preset first threshold; (5) in response to the first difference exceeding the preset first threshold, start the timing monitoring with a duration of T, and within the duration, continue to perform continuous sampling, and update the first data sequence and the second data sequence accordingly; exceeding the preset second threshold; (6) in response to the second difference exceeding the preset second threshold, triggering the control circuit to reselect another antenna as the working antenna.

可选地,上述(6)可以实施为:响应于第二差值超过预设第二阈值,获取定时监测结束时的第一数据序列,计算第一数据序列中的M个采样值的波动指标,并判断第二差值与波动指标的k倍值之间的第三差值是否超过预设第三阈值,其中k为经验系数;以及,响应于第三差值超过预设第三阈值,触发控制电路重新选择另一天线作为工作天线。Optionally, the above (6) may be implemented as: in response to the second difference exceeding the preset second threshold, acquiring the first data sequence at the end of the timing monitoring, calculating the fluctuation index of M sample values in the first data sequence, and judging whether the third difference between the second difference and k times the fluctuation index exceeds the preset third threshold, where k is an empirical coefficient; and, in response to the third difference exceeding the preset third threshold, triggering the control circuit to reselect another antenna as the working antenna.

应当理解的是,图5所示的终端设备500还能够实现图2至图4中任一方法实施例中的相应流程。具体可参见上述方法实施例中的描述,为避免重复,此处适当省略详细描述。It should be understood that the terminal device 500 shown in FIG. 5 can also implement a corresponding process in any method embodiment in FIG. 2 to FIG. 4 . For details, reference may be made to the descriptions in the foregoing method embodiments, and detailed descriptions are appropriately omitted here to avoid repetition.

实施例4Example 4

在另一个实施例中,用于实现本申请的方法实施例的通信设备可以配置有具有多个状态的状态机。如图6A所示,示出了根据本申请实施例的通信设备的状态机的示意流程图。In another embodiment, the communication device for implementing the method embodiment of the present application may be configured with a state machine having multiple states. As shown in FIG. 6A , it shows a schematic flowchart of a state machine of a communication device according to an embodiment of the present application.

在该实施例中,通信设备至少可以包括三种状态,天线选择状态、运行采样状态以及定时监测状态。以下具体描述通信设备的具体工作流程:In this embodiment, the communication device may include at least three states, antenna selection state, running sampling state and timing monitoring state. The following specifically describes the specific workflow of the communication device:

(1)通信设备在通电后开机(602),并进入天线选择状态(604)。作为示例,在处于天线选择状态时,通信设备测量其配置的多个天线的信号质量指标值,并选择其中具有最佳信号质量指标值的天线作为通信设备的工作天线。例如,选择具有最高的接收信号强度指示(RSSI)或者信噪比(SNR)的天线作为工作天线。作为示例,信号质量指标值还可以使用丢包率、误码率(BER)、速率、发射功率中的任意一种,或以上任意多种的组合。(1) The communication device starts up after being powered on (602), and enters the antenna selection state (604). As an example, when in the antenna selection state, the communication device measures the signal quality index values of multiple antennas configured by it, and selects the antenna with the best signal quality index value as the working antenna of the communication device. For example, the antenna with the highest Received Signal Strength Indicator (RSSI) or Signal-to-Noise Ratio (SNR) is selected as the working antenna. As an example, the signal quality index value may also use any one of packet loss rate, bit error rate (BER), rate, and transmission power, or any combination of the above.

(2)通信设备在确定工作天线之后,进入运行采样状态(606)。作为示例,在处于运行采样状态时,通信设备对当前工作天线的信号质量指标值进行连续采样以获得采样值。例如,以固定周期的方式进行采样。例如,每隔100毫秒获取一次当前工作天线的信号质量指标值。可选地,还可以应用滤波器对采样值进行滤波,以去除噪点。(2) After the communication device determines the working antenna, it enters the running sampling state (606). As an example, when in the running sampling state, the communication device continuously samples the signal quality indicator value of the currently working antenna to obtain the sampled value. For example, sampling is performed in a fixed-period manner. For example, the signal quality index value of the currently working antenna is acquired every 100 milliseconds. Optionally, a filter may also be applied to the sampled values to remove noise.

(3)通信设备在每获得一次最新的采样值后,更新第一数据序列和第二数据序列,并触发执行第一判断(608)。其中,将最新的采样值加入至采用先进先出模式的第一数据序列的队尾,以更新第一数据序列,其中所述第一数据序列包括连续M个采样值。其中,计算当前第一数据序列中的M个采样值的平均值并加入至采用先进先出模式的第二数据序列的队尾,以更新第二数据序列,其中第二数据序列包括N个平均值。其中,所执行的第一判断用于判断当前第二数据序列中的第N个平均值与更新前的第二数据序列中的第一个平均值之间的第一差值是否超过预设第一阈值。(3) The communication device updates the first data sequence and the second data sequence each time the latest sampling value is obtained, and triggers the execution of the first judgment (608). Wherein, the latest sampling value is added to the tail of the first data sequence using the first-in-first-out mode to update the first data sequence, wherein the first data sequence includes M continuous sampling values. Wherein, the average value of the M sampling values in the current first data sequence is calculated and added to the tail of the second data sequence using the first-in-first-out mode to update the second data sequence, wherein the second data sequence includes N average values. Wherein, the executed first judgment is used to judge whether the first difference between the Nth average value in the current second data sequence and the first average value in the second data sequence before updating exceeds a preset first threshold.

(4)如果第一差值未超过预设第一阈值,则通信设备继续返回运行采样状态(606)。否则,当第一差值超过预设第一阈值时,在通信设备进入定时监测状态(610),该定时监测状态的持续时间为预先设定的时间T。当设备处于定时监测状态期间,通信设备仍对当前工作天线的信号质量指标值进行连续采样以获得采样值,并且响应于每次获取到最新的采样值,更新第一数据序列和第二数据序列。其中,将最新的采样值加入至采用先进先出模式的第一数据序列的队尾,以更新第一数据序列。其中,计算当前第一数据序列中的M个采样值的平均值并加入至采用先进先出模式的第二数据序列的队尾,以更新第二数据序列。(4) If the first difference does not exceed the preset first threshold, the communication device continues to return to the running sampling state (606). Otherwise, when the first difference exceeds the preset first threshold, the communication device enters a timing monitoring state (610), and the duration of the timing monitoring state is a preset time T. When the device is in the regular monitoring state, the communication device still continuously samples the signal quality index value of the current working antenna to obtain sampled values, and updates the first data sequence and the second data sequence in response to obtaining the latest sampled value each time. Wherein, the latest sampling value is added to the tail of the first data sequence adopting the first-in-first-out mode, so as to update the first data sequence. Wherein, the average value of the M sampling values in the current first data sequence is calculated and added to the tail of the second data sequence using the first-in-first-out mode, so as to update the second data sequence.

(5)在定时检测状态结束时,触发执行第二判断(612)。其中,第二判断用于判断定时监测结束时的第二数据序列中的第N个平均值与定时监测开启时的第二数据序列中的第一个平均值之间的第二差值是否超过预设第二阈值。(5) When the timing detection state ends, trigger the execution of the second judgment (612). Wherein, the second judgment is used to judge whether the second difference between the Nth average value in the second data sequence when the timing monitoring ends and the first average value in the second data sequence when the timing monitoring starts exceeds a preset second threshold.

(6)如果第二差值未超过预设第二阈值,则通信设备继续返回运行采样状态(606)。否则,当第二差值超过预设第二阈值时,在通信设备进入天线选择状态(604),以重新选择另一天线作为工作天线。(6) If the second difference does not exceed the preset second threshold, the communication device continues to return to the running sampling state (606). Otherwise, when the second difference exceeds the preset second threshold, the communication device enters the antenna selection state (604) to reselect another antenna as the working antenna.

如图6B所示,示出了根据本申请实施例的通信设备的状态机的另一示意流程图。其中,在上述执行第二判断(612)之后,上述(6)可以实施为:如果第二差值未超过预设第二阈值,则通信设备继续返回运行采样状态(606)。否则,当第二差值超过预设第二阈值时,则触发执行第三判断(614)。其中,第三判断用于获取定时监测结束时的第一数据序列,计算第一数据序列中的M个采样值的波动指标,并判断第二差值与波动指标的k倍值之间的第三差值是否超过预设第三阈值,其中k为经验系数。如果第三差值未超过预设第三阈值,则通信设备继续返回运行采样状态(606)。否则,当第三差值超过预设第三阈值时,在通信设备进入天线选择状态(604),以重新选择另一天线作为工作天线。As shown in FIG. 6B , another schematic flowchart of a state machine of a communication device according to an embodiment of the present application is shown. Wherein, after the above-mentioned execution of the second judgment (612), the above-mentioned (6) may be implemented as: if the second difference does not exceed the preset second threshold, the communication device continues to return to the running sampling state (606). Otherwise, when the second difference exceeds the preset second threshold, a third judgment is triggered (614). Wherein, the third judgment is used to obtain the first data sequence at the end of the timing monitoring, calculate the fluctuation index of the M sampling values in the first data sequence, and judge whether the third difference between the second difference and k times of the fluctuation index exceeds the preset third threshold, where k is an empirical coefficient. If the third difference does not exceed the preset third threshold, the communication device continues to return to the running sampling state (606). Otherwise, when the third difference exceeds the preset third threshold, the communication device enters the antenna selection state (604), so as to reselect another antenna as the working antenna.

实施例5Example 5

图7是本申请实施例提供的通信设备700的结构示意图。该通信设设备700具有至少两个天线。如图7所示,通信设备700包括相互耦合的存储模块、运行模块、定时监测模块以及天线选择模块;各模块之间可以通过通信总线相互进行数据通信。FIG. 7 is a schematic structural diagram of a communication device 700 provided by an embodiment of the present application. The communication device 700 has at least two antennas. As shown in FIG. 7 , the communication device 700 includes a storage module, an operation module, a timing monitoring module, and an antenna selection module coupled to each other; the modules can communicate with each other through a communication bus.

其中,存储模块用于存储采用先进先出模式的第一数据序列以及采用先进先出模式的第二数据序列。Wherein, the storage module is used for storing the first data sequence adopting the first-in-first-out mode and the second data sequence adopting the first-in-first-out mode.

其中,运行模块被配置为执行以下操作:(1)对当前工作天线的信号质量指标值进行连续采样以获得采样值;响应于获得最新的采样值,将最新的采样值加入至第一数据序列的队尾,以更新第一数据序列,其中第一数据序列包括连续M个采样值;(2)计算当前第一数据序列中的M个采样值的平均值并加入至第二数据序列的队尾,以更新第二数据序列,其中第二数据序列包括N个平均值;(3)判断当前第二数据序列中的第N个平均值与更新前的第二数据序列中的第一个平均值之间的第一差值是否超过预设第一阈值。进一步的,运行模块还被配置为响应于第一差值超过所述预设第一阈值,触发定时监测模块的运行。可选地,运行模块还可以被配置为,响应于获得最新的采样值,对采样值应用滤波器进行滤波,以过滤噪点。Wherein, the operation module is configured to perform the following operations: (1) continuously sample the signal quality index value of the current working antenna to obtain sampled values; in response to obtaining the latest sampled value, add the latest sampled value to the tail of the first data sequence to update the first data sequence, wherein the first data sequence includes M consecutive sampled values; Whether the first difference between the first average value and the first average value in the second data sequence before updating exceeds the preset first threshold. Further, the running module is further configured to trigger the running of the timing monitoring module in response to the first difference exceeding the preset first threshold. Optionally, the running module may also be configured to, in response to obtaining the latest sampled value, apply a filter to the sampled value to filter noise.

其中,定时监测模块被配置为执行以下操作:(1)启动持续时间为T的定时监测,并在持续时间内,继续执行连续采样,并相应地更新第一数据序列和第二数据序列;以及(2)判断定时监测结束时的第二数据序列中的第N个平均值与定时监测开启时的第二数据序列中的第一个平均值之间的第二差值是否超过预设第二阈值。定时监测模块还被配置为响应于所述第二差值超过所述预设第二阈值,触发天线选择模块的运行。Wherein, the timing monitoring module is configured to perform the following operations: (1) start timing monitoring with a duration of T, and continue to perform continuous sampling during the duration, and update the first data sequence and the second data sequence accordingly; and (2) judge whether the second difference between the Nth average value in the second data sequence when the timing monitoring ends and the first average value in the second data sequence when the timing monitoring is turned on exceeds a preset second threshold. The timing monitoring module is further configured to trigger operation of the antenna selection module in response to the second difference exceeding the preset second threshold.

在另一个实施例中,定时监测模块进一步被配置为执行以下操作:响应于第二差值超过预设第二阈值,获取定时监测结束时的第一数据序列,计算第一数据序列中的M个采样值的波动指标,并判断第二差值与波动指标的k倍值之间的第三差值是否超过预设第三阈值,其中k为经验系数;以及,响应于第三差值超过预设第三阈值,触发天线选择模块的运行。In another embodiment, the timing monitoring module is further configured to perform the following operations: in response to the second difference exceeding the preset second threshold, acquire the first data sequence at the end of the timing monitoring, calculate the fluctuation index of the M sampling values in the first data sequence, and determine whether the third difference between the second difference and k times the fluctuation index exceeds a preset third threshold, where k is an empirical coefficient; and, in response to the third difference exceeding the preset third threshold, trigger the operation of the antenna selection module.

其中,天线选择模块被配置为:重新选择另一天线作为工作天线。可选地,天线选择模块被配置为:测量所述至少两个天线的信号质量指标值,并选择其中具有最佳信号质量指标值的天线作为通信设备的工作天线。其中,信号质量指标值包括接收信号强度指示(RSSI)、丢包率、信噪比(SNR)、误码率(BER)、速率、发射功率中的任意一种或其组合。Wherein, the antenna selection module is configured to: reselect another antenna as the working antenna. Optionally, the antenna selection module is configured to: measure signal quality index values of the at least two antennas, and select the antenna with the best signal quality index value as the working antenna of the communication device. Wherein, the signal quality index value includes received signal strength indicator (RSSI), packet loss rate, signal-to-noise ratio (SNR), bit error rate (BER), rate, transmit power, or any one or combination thereof.

示例example

参考图8,以下具体介绍根据本申请的实施例的一个示例。Referring to FIG. 8 , an example of an embodiment according to the present application is specifically introduced below.

通信设备在经过初始化之后,获取各个天线的信号质量指标值,例如各天线的RSSI值,以确定当前信号质量指标值最佳的天线,并将其作为当前的工作天线。After initialization, the communication device acquires the signal quality index value of each antenna, such as the RSSI value of each antenna, to determine the antenna with the best current signal quality index value, and use it as the current working antenna.

通信设备在运行过程中,采用固定周期为100毫秒的采样方式,获取当前工作天线的信号质量指标值的采样值,并将最新的采样值加入至采用先进先出模式的第一数据序列的队尾。在图8中,第一数据序列可以采用第一滑动窗口的方式提取和保存,即第一滑动窗口的大小设置为第一数据序列中的默认的采样值的数量M。在图8的示例中,第一数据序列中包括10个采样值,因此,第一滑动窗口的大小也设置为10。每获取一个新的采样值,则第一滑动窗口向右移动一位,以采用先进先出的模式提取和保存当前第一数据序列的采样值。值得注意的是,在不同的应用场景中,M的值可以设置不同的数值,例如在办公室场景中,经常有人走动而产生干扰,因此可以把M的值设置得大一些,而在一些环境变化不大的场景中,例如工厂,则可以调小M的数值。During the operation of the communication device, the sampling method with a fixed period of 100 milliseconds is used to obtain the sampling value of the signal quality index value of the current working antenna, and the latest sampling value is added to the tail of the first data sequence using the first-in-first-out mode. In FIG. 8 , the first data sequence may be extracted and saved in the manner of a first sliding window, that is, the size of the first sliding window is set to the default number M of sampling values in the first data sequence. In the example of FIG. 8 , the first data sequence includes 10 sample values, therefore, the size of the first sliding window is also set to 10. Every time a new sampling value is obtained, the first sliding window is moved to the right by one bit, so as to extract and save the current sampling value of the first data sequence in a first-in-first-out mode. It is worth noting that in different application scenarios, the value of M can be set to a different value. For example, in an office scene, people often walk around and cause interference, so the value of M can be set higher. In some scenes where the environment does not change much, such as a factory, the value of M can be reduced.

进一步的,对当前第一滑动窗口中的第一数据序列中的所有采样值计算其平均值,并将该平均值保存值第二数据序列。其中,第二数据序列包含N个平均值。作为示例,第二数据序列可以采用第二滑动窗口的方式进行提取和保存。如图8所示,第二数据序列中包括25个平均值,因此,第二滑动窗口的大小也设置为25。第一数据序列每更新一次,则计算获得一个新的平均值,因此第二滑动窗口向右移动一位,以采用先进先出的模式提取和保存当前最新的平均值。Further, an average value is calculated for all sampling values in the first data sequence in the current first sliding window, and the average value is saved as the second data sequence. Wherein, the second data sequence includes N average values. As an example, the second data sequence may be extracted and stored in a second sliding window manner. As shown in FIG. 8 , the second data sequence includes 25 average values, therefore, the size of the second sliding window is also set to 25. Every time the first data sequence is updated, a new average value is calculated and obtained, so the second sliding window is moved to the right by one bit to extract and save the current latest average value in a first-in-first-out mode.

根据本申请的实施例的方法,第二数据序列每次更新后,均触发判断当前第二数据序列中的最后一个平均值(即第N个平均值)与更新前的第二数据序列中的第一个平均值之间的第一差值是否超过预设第一阈值。如果超过,则启动定时监测。According to the method of the embodiment of the present application, after each update of the second data sequence, it is triggered to judge whether the first difference between the last average value in the current second data sequence (that is, the Nth average value) and the first average value in the second data sequence before the update exceeds the preset first threshold. If exceeded, start timing monitoring.

以图8的示例为例,在T0时刻,确定当前第二数据序列中的最后一个平均值,即avg26,与更新前的第二数据序列中的第一个平均值,即avg1,二者之间的第一差值,并判断该第一差值是否超过预设第一阈值。在图8的示例中,在T0时刻,该第一差值超过预设第一阈值。第一差值超过预设第一阈值,表示当前采样值出现波动,但其可能是由暂态的干扰导致,也可能是由于环境变化导致,而如果是前者,因为暂态的干扰可能会在很短的时间内消除,因此不一定需要切换天线。因此,为了进一步确认该变化产生的原因,在T0时刻开启定时监测功能,该定时监测的持续时间为T。例如,在一种示例中,T设置为6秒。在定时监测开始时,对应的第一数据序列为an26至an35,更新的第二数据序列为avg2至avg26。在定时监测阶段,继续持续采样并以上述相同的方式不断更新第一数据序列和第二数据序列。Taking the example in FIG. 8 as an example, at time T0, determine the first difference between the last average value in the current second data sequence, i.e. avg 26 , and the first average value in the second data sequence before updating, i.e. avg 1 , and determine whether the first difference value exceeds the preset first threshold. In the example of FIG. 8 , at time T0, the first difference exceeds a preset first threshold. The first difference exceeds the preset first threshold, indicating that the current sampling value fluctuates, but it may be caused by transient interference, or it may be caused by environmental changes. If it is the former, because the transient interference may be eliminated in a short period of time, it is not necessarily necessary to switch the antenna. Therefore, in order to further confirm the cause of the change, the timing monitoring function is turned on at T0, and the duration of the timing monitoring is T. For example, in one example, T is set to 6 seconds. When the timing monitoring starts, the corresponding first data sequence is a n26 to a n35 , and the updated second data sequence is avg 2 to avg 26 . In the timing monitoring phase, continuous sampling is continued and the first data sequence and the second data sequence are continuously updated in the same manner as above.

直至定时监测结束时,更新的第一数据序列为an86至an95,更新的第二数据序列为avg62至avg86。判断定时监测结束时的第二数据序列中的第N个平均值(在此示例中为avg86)与定时监测开启时的第二数据序列中的第一个平均值之间(在此示例中为avg2)的第二差值是否超过预设第二阈值。如果未超过预设第二阈值,则表示导致第一差值的信号变化为暂态的,其可能是干扰信号。例如,干扰信号在定时监测的持续时间内消除了,天线恢复到正常状态,天线所处环境并未改变,因此,不需要触发重新选择工作天线。以实际场景为例,例如人快速经过通信设备,会在经过的瞬间导致第一差值变大,但通过定时监测后,第二差值并未超过预设第二阈值,因此,判定为短期的干扰,不需要切换工作天线。如果,定时监测结束时第二差值仍超过预设第二阈值,则表示干扰源仍旧存在,此时可以触发重新选择工作天线。Until the timing monitoring ends, the updated first data sequence is a n86 to a n95 , and the updated second data sequence is avg 62 to avg 86 . Determine whether the second difference between the Nth average value (avg 86 in this example) in the second data series when the timing monitoring ends and the first average value in the second data series when the timing monitoring starts (avg 2 in this example) exceeds a preset second threshold. If it does not exceed the preset second threshold, it means that the signal change causing the first difference is transient, which may be an interference signal. For example, the interference signal is eliminated within the duration of the regular monitoring, the antenna returns to a normal state, and the environment where the antenna is located has not changed, therefore, there is no need to trigger reselection of the working antenna. Taking the actual scene as an example, for example, when a person passes by a communication device quickly, the first difference will become larger at the moment of passing, but after regular monitoring, the second difference does not exceed the preset second threshold. Therefore, it is judged as short-term interference and there is no need to switch the working antenna. If, when the timing monitoring ends, the second difference still exceeds the preset second threshold, it indicates that the interference source still exists, and at this time, reselection of the working antenna may be triggered.

在另一示例中,即使定时监测结束时第二差值仍超过预设第二阈值,仍需进一步判定该干扰源是否为人引起的干扰,则可以进一步获取定时监测结束时的第一数据序列,计算第一数据序列中的M个采样值的波动指标,并判断第二差值与波动指标的k倍值之间的第三差值是否超过预设第三阈值。以图8的示例为例,定时监测结束时的第一数据序列为an86至an95,判断该第一数据序列中的M个采样值的方差。并计算第二差值与该方差的k倍值之间的第三差值是否超过预设第三阈值。在另一示例中,波动指标可以采用第一数据序列中的队首和队尾的采样值的差值,在图8的示例中则为an95与an86的差值。使用第一数据序列中的首尾采样值的差值代替方差作为波动指标,可以降低算法的复杂度,减少内存空间占用。In another example, even if the second difference value still exceeds the preset second threshold at the end of the timing monitoring, it is still necessary to further determine whether the interference source is interference caused by humans, then the first data sequence at the end of the timing monitoring can be further obtained, the fluctuation index of the M sampling values in the first data sequence is calculated, and it is judged whether the third difference between the second difference and k times of the fluctuation index exceeds the preset third threshold. Taking the example in FIG. 8 as an example, the first data sequence at the end of the timing monitoring is a n86 to a n95 , and the variance of the M sampling values in the first data sequence is judged. And calculate whether the third difference between the second difference and k times of the variance exceeds the preset third threshold. In another example, the fluctuation index may use the difference between the sampling values of the head and tail of the queue in the first data sequence, which is the difference between a n95 and a n86 in the example of FIG. 8 . Using the difference between the first and last sampling values in the first data sequence instead of the variance as the fluctuation index can reduce the complexity of the algorithm and reduce the memory space occupied.

如果第三差值未超过预设第三阈值,则不需要重新选择工作天线。一种对应于此的场景可以是工作人员来到操作台前进行操作,且6秒内并未离开,干扰了通讯设备的天线信号,6秒内未离开。但是,由于工作人员在操作机器时不可能一动不动,其身体的摆动可能造成信号强度值的波动,因此这种情况下仍然属于干扰信号,而不是环境变化,所以不需要切换天线。因此,通过第三差值的判断,可以识别长时间的因人为干扰而导致的天线变化,但这种情况下,并不需要切换天线。If the third difference does not exceed the preset third threshold, there is no need to reselect the working antenna. A scenario corresponding to this may be that a staff member comes to the console for operation and does not leave within 6 seconds, which interferes with the antenna signal of the communication device and does not leave within 6 seconds. However, since the staff cannot remain still while operating the machine, the swing of their body may cause fluctuations in the signal strength value, so this situation is still an interference signal rather than a change in the environment, so there is no need to switch the antenna. Therefore, through the determination of the third difference, it is possible to identify the antenna change caused by man-made interference for a long time, but in this case, there is no need to switch the antenna.

相反地,如果第三差值超过预设第三阈值,则表示定时监测前后的信号存在较为稳定的误差,并且第一数据序列中的采样值的方差较小,因此可以判断环境发生了变化,例如路由器位置发生了变化或者通信设备的位置发生了变化。因此,需要重新选择工作天线。在重新选择工作天线之后,由于之前的工作天线的历史数据不再具有参考意义,因此清空第一数据序列和第二数据序列。Conversely, if the third difference exceeds the preset third threshold, it means that there is a relatively stable error in the signal before and after the timing monitoring, and the variance of the sampling value in the first data sequence is small, so it can be judged that the environment has changed, for example, the position of the router or the position of the communication device has changed. Therefore, it is necessary to reselect the working antenna. After the working antenna is reselected, since the historical data of the previous working antenna is no longer of reference significance, the first data sequence and the second data sequence are cleared.

此外,本申请还公开了一种存储有指令的计算机可读存储介质,该指令在由处理器执行时配置为执行根据本申请所公开的方法实施例的各个方法。In addition, the present application also discloses a computer-readable storage medium storing instructions, and the instructions are configured to execute various methods according to the method embodiments disclosed in the present application when executed by a processor.

综上所述,本申请实施例的技术方案可以应用于各种通信系统,例如Wi-Fi通信系统、蓝牙通信系统、5G通信系统、NR通信系统等,还可以应用于未来网络,如6G系统甚至未来系统。In summary, the technical solutions of the embodiments of the present application can be applied to various communication systems, such as Wi-Fi communication systems, Bluetooth communication systems, 5G communication systems, NR communication systems, etc., and can also be applied to future networks, such as 6G systems or even future systems.

根据本申请的上述各个实施例的方法,可以屏蔽掉人为的干扰因素,避免频繁切换天线而导致的通信质量变差。此外,本方法为轻量级的方法,其所需的数据存储量和计算量小、而且无需定期扫描各天线的信号质量,仅针对当前工作天线的状况进行采样监测,即可在需要时触发寻找最优的天线进行数据传输,因此,保障了数据传输的吞吐量可以长期保持在一个相对稳定的值。根据本申请的技术方案,在无需增加任何的硬件成本的前提下,可通过软件算法解决现存的技术难点。According to the methods of the foregoing embodiments of the present application, man-made interference factors can be shielded, and communication quality deterioration caused by frequent switching of antennas can be avoided. In addition, this method is a lightweight method, which requires less data storage and calculation, and does not need to periodically scan the signal quality of each antenna. It only needs to sample and monitor the status of the current working antenna, and it can be triggered to find the optimal antenna for data transmission when needed. Therefore, the throughput of data transmission can be maintained at a relatively stable value for a long time. According to the technical solution of the present application, existing technical difficulties can be solved through software algorithms without increasing any hardware costs.

虽然出于本公开的目的已经描述了本申请各方面的各种实施例,但是不应理解为将本公开的教导限制于这些实施例。在一个具体实施例中公开的特征并不限于该实施例,而是可以和不同实施例中公开的特征进行组合。例如,在一个实施例中描述的根据本申请的方法的一个或多个特征和/或操作,亦可单独地、组合地或整体地应用在另一实施例中。本领域技术人员应理解,还存在可能的更多可选实施方式和变型,可以对上述系统进行各种改变和修改,而不脱离由本申请权利要求所限定的范围。While various embodiments of aspects of the application have been described for the purposes of this disclosure, it should not be construed to limit the teachings of the disclosure to these embodiments. Features disclosed in a specific embodiment are not limited to that embodiment, but can be combined with features disclosed in different embodiments. For example, one or more features and/or operations of the method according to the present application described in one embodiment may also be applied individually, in combination or as a whole in another embodiment. Those skilled in the art should understand that there are more possible alternative implementations and modifications, and various changes and modifications can be made to the above system without departing from the scope defined by the claims of the present application.

Claims (17)

1. A method for selecting an operating antenna for a communication device having a plurality of antennas, comprising:
continuously sampling the signal quality index value of the current working antenna to obtain a sampling value, and executing the following steps:
step (A): in response to obtaining a latest sampling value, adding the latest sampling value to the tail of a first data sequence in a first-in first-out mode to update the first data sequence, wherein the first data sequence comprises continuous M sampling values;
Step (B): calculating the average value of M sampling values in the current first data sequence and adding the average value to the tail of a second data sequence in a first-in first-out mode so as to update the second data sequence, wherein the second data sequence comprises N average values;
step (C): judging whether a first difference value between an Nth average value in the current second data sequence and a first average value in the second data sequence before updating exceeds a preset first threshold value;
step (D): in response to the first difference exceeding the preset first threshold, initiating timing monitoring for a duration T, and repeating steps (a) and (B) for the duration to update the first and second data sequences; and judging whether a second difference value between an Nth average value in the second data sequence at the end of the timing monitoring and a first average value in the second data sequence at the start of the timing monitoring exceeds a preset second threshold value;
step (E): and triggering to reselect another antenna to be an operating antenna in response to the second difference exceeding the preset second threshold.
2. The method of claim 1, wherein the step of determining the position of the substrate comprises,
Step (E) comprises: responding to the second difference value exceeding the preset second threshold value, acquiring a first data sequence when the timing monitoring is finished, calculating fluctuation indexes of M sampling values in the first data sequence, and judging whether a third difference value between the second difference value and a k times value of the fluctuation indexes exceeds a preset third threshold value, wherein k is an empirical coefficient; and triggering to reselect another antenna as an operating antenna in response to the third difference exceeding the preset third threshold.
3. The method of claim 2, wherein the step of determining the position of the substrate comprises,
the fluctuation index comprises a difference value of head and tail sampling values in the first data sequence, or any one of variance, standard deviation, range and variation coefficient of all sampling values in the first data sequence, or a combination thereof.
4. The method of claim 1, wherein the step of determining the position of the substrate comprises,
step (a) further comprises: determining whether the first data sequence is full, and in response to the first data sequence being full, removing sample values located at the head of the first data sequence from the first data sequence and adding the latest sample values to the tail of the first data sequence to update the first data sequence.
5. The method of claim 1, wherein the step of determining the position of the substrate comprises,
step (B) further comprises: determining whether the second data sequence is full, and in response to the second data sequence being full, removing an average value located at a head of a queue of the second data sequence from the second data sequence, and adding an average value of M sampling values in the current first data sequence to a tail of the second data sequence.
6. A method according to claim 1 or 2, characterized in that,
the re-selecting the operational antenna includes: the signal quality index values of the plurality of antennas are measured, and the antenna having the best signal quality index value therein is selected as an operating antenna of the communication device.
7. The method of claim 6, wherein the step of providing the first layer comprises,
after re-selecting the working antenna of the communication device, the first data sequence and the second data sequence are emptied.
8. The method of claim 6, wherein the step of providing the first layer comprises,
the signal quality index value includes any one of a Received Signal Strength Indication (RSSI), a packet loss rate, a signal-to-noise ratio (SNR), a Bit Error Rate (BER), a rate, a transmission power, or a combination thereof.
9. The method of claim 8, wherein the step of determining the position of the first electrode is performed,
and in response to the signal quality indicator value being a received signal strength indication, applying a filter to the first data sequence to filter to remove noise.
10. The method of claim 9, wherein the step of determining the position of the substrate comprises,
the filter includes any one of a kalman filter or other filter.
11. A communication device, comprising:
a wireless circuit comprising at least two antennas and a transceiver coupled to the at least two antennas; and
control circuitry configured to control the wireless circuitry to select an operating antenna from the at least two antennas, wherein the control circuitry is configured to:
continuously sampling the signal quality index value of the current working antenna to obtain a sampling value;
in response to obtaining a latest sampling value, adding the latest sampling value to the tail of a first data sequence in a first-in first-out mode to update the first data sequence, wherein the first data sequence comprises continuous M sampling values;
calculating the average value of M sampling values in the current first data sequence and adding the average value to the tail of a second data sequence in a first-in first-out mode so as to update the second data sequence, wherein the second data sequence comprises N average values;
Judging whether a first difference value between an Nth average value in the current second data sequence and a first average value in the second data sequence before updating exceeds a preset first threshold value;
in response to the first difference exceeding the preset first threshold, starting timing monitoring with duration T, continuing to perform continuous sampling within the duration, and correspondingly updating the first data sequence and the second data sequence; and judging whether a second difference value between an Nth average value in the second data sequence at the end of the timing monitoring and a first average value in the second data sequence at the start of the timing monitoring exceeds a preset second threshold value;
and triggering the control circuit to reselect another antenna as an operating antenna in response to the second difference exceeding the preset second threshold.
12. The communication device of claim 11, wherein the control circuit is further configured to:
responding to the second difference value exceeding the preset second threshold value, acquiring a first data sequence when the timing monitoring is finished, calculating fluctuation indexes of M sampling values in the first data sequence, and judging whether a third difference value between the second difference value and a k times value of the fluctuation indexes exceeds a preset third threshold value, wherein k is an empirical coefficient; the method comprises the steps of,
And triggering the control circuit to reselect another antenna as a working antenna in response to the third difference exceeding the preset third threshold.
13. A communication device according to claim 11 or 12, characterized in that,
the re-selecting the operational antenna includes: the signal quality indicator values of the at least two antennas are measured and the antenna with the best signal quality indicator value is selected as the operating antenna of the communication device.
14. The communication device of claim 13, wherein the communication device is configured to,
the signal quality index value includes any one of a Received Signal Strength Indication (RSSI), a packet loss rate, a signal-to-noise ratio (SNR), a Bit Error Rate (BER), a rate, a transmission power, or a combination thereof.
15. A communication device, characterized in that,
the device comprises a storage module, an operation module, a timing monitoring module and an antenna selection module which are mutually coupled;
the storage module is used for storing a first data sequence in a first-in first-out mode and a second data sequence in the first-in first-out mode;
the execution module is configured to perform the following operations:
continuously sampling the signal quality index value of the current working antenna to obtain a sampling value;
In response to obtaining a latest sample value, adding the latest sample value to a tail of the first data sequence to update the first data sequence, wherein the first data sequence comprises consecutive M sample values;
calculating the average value of M sampling values in the current first data sequence and adding the average value to the tail of the second data sequence to update the second data sequence, wherein the second data sequence comprises N average values;
judging whether a first difference value between an Nth average value in the current second data sequence and a first average value in the second data sequence before updating exceeds a preset first threshold value;
the operation module is further configured to trigger operation of the timing monitoring module in response to the first difference exceeding the preset first threshold;
the timing monitoring module is configured to:
starting timing monitoring with duration time T, continuously executing continuous sampling within the duration time, and correspondingly updating the first data sequence and the second data sequence; and
judging whether a second difference value between an Nth average value in the second data sequence at the end of the timing monitoring and a first average value in the second data sequence at the start of the timing monitoring exceeds a preset second threshold value;
The timing monitoring module is further configured to trigger operation of the antenna selection module in response to the second difference exceeding the preset second threshold;
the antenna selection module is configured to: another antenna is reselected as the active antenna.
16. The communication device of claim 15, wherein the communication device is configured to,
the timing monitoring module is further configured to: responding to the second difference value exceeding the preset second threshold value, acquiring a first data sequence when the timing monitoring is finished, calculating fluctuation indexes of M sampling values in the first data sequence, and judging whether a third difference value between the second difference value and a k times value of the fluctuation indexes exceeds a preset third threshold value, wherein k is an empirical coefficient; and triggering the operation of the antenna selection module in response to the third difference exceeding the preset third threshold.
17. A computer-readable storage medium storing instructions that, when executed by a processor,
the instructions, when executed by a processor, are configured to perform the method of any of claims 1 to 10.
CN202310437775.4A 2023-04-21 2023-04-21 Antenna selection method Active CN116470944B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310437775.4A CN116470944B (en) 2023-04-21 2023-04-21 Antenna selection method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310437775.4A CN116470944B (en) 2023-04-21 2023-04-21 Antenna selection method

Publications (2)

Publication Number Publication Date
CN116470944A true CN116470944A (en) 2023-07-21
CN116470944B CN116470944B (en) 2025-07-22

Family

ID=87174978

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310437775.4A Active CN116470944B (en) 2023-04-21 2023-04-21 Antenna selection method

Country Status (1)

Country Link
CN (1) CN116470944B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1998019401A1 (en) * 1996-10-25 1998-05-07 Northern Telecom Limited Impairment determination for a diversity antenna selection process
WO1999065160A1 (en) * 1998-06-05 1999-12-16 Siemens Information And Communication Networks Spa Spatio-temporal equalisation using cholesky factorisation and systolic arrays
US20030016174A1 (en) * 1999-01-08 2003-01-23 Trueposition, Inc. System and method for interference cancellation in a location calculation, for use in a wireless location system
US20050095987A1 (en) * 2003-10-31 2005-05-05 Lyons Daniel J. Error vector magnitude selection diversity metric for ofdm
US20070140361A1 (en) * 2005-09-03 2007-06-21 Stephen Beales Method and system for detecting transmitted data signal quality and integrity
US7480234B1 (en) * 2003-10-31 2009-01-20 Cisco Technology, Inc. Initial timing estimation in a wireless network receiver
CN110278010A (en) * 2019-06-13 2019-09-24 Oppo广东移动通信有限公司 Antenna switching method, antenna switching device, storage medium and electronic equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1998019401A1 (en) * 1996-10-25 1998-05-07 Northern Telecom Limited Impairment determination for a diversity antenna selection process
WO1999065160A1 (en) * 1998-06-05 1999-12-16 Siemens Information And Communication Networks Spa Spatio-temporal equalisation using cholesky factorisation and systolic arrays
US20030016174A1 (en) * 1999-01-08 2003-01-23 Trueposition, Inc. System and method for interference cancellation in a location calculation, for use in a wireless location system
US20050095987A1 (en) * 2003-10-31 2005-05-05 Lyons Daniel J. Error vector magnitude selection diversity metric for ofdm
US7480234B1 (en) * 2003-10-31 2009-01-20 Cisco Technology, Inc. Initial timing estimation in a wireless network receiver
US20070140361A1 (en) * 2005-09-03 2007-06-21 Stephen Beales Method and system for detecting transmitted data signal quality and integrity
CN110278010A (en) * 2019-06-13 2019-09-24 Oppo广东移动通信有限公司 Antenna switching method, antenna switching device, storage medium and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈剑;徐晓铁;吴建平;李贺武;: "能耗感知的MIMO天线配置模式选择算法", 解放军理工大学学报(自然科学版), no. 02, 15 April 2013 (2013-04-15), pages 152 - 157 *

Also Published As

Publication number Publication date
CN116470944B (en) 2025-07-22

Similar Documents

Publication Publication Date Title
US8379608B2 (en) Radio communication method, radio communication system and wireless terminal
KR20100121609A (en) System and method for adaptive power conservation based on traffic profiles
US9191874B2 (en) Advanced network characterization and migration
CN108234224B (en) Available bandwidth detection method and device
US20200145890A1 (en) Channel switching method and apparatus, and communication device
US8379557B2 (en) Method and apparatus for controlling sleep mode in wireless communication networks
US20140194125A1 (en) Methods implementing a configuration of drx and measurement in a ue and an enodeb equipment
US8526398B2 (en) Communication terminal and communication method
CN107046693A (en) A wireless router and method for switching frequency bands for access terminals
US20230362824A1 (en) Method and apparatus for optimizing power consumption of 5g terminal during concurrency of services, device, and medium
EP2699043B1 (en) Modem and network searching method thereof
WO2024230328A1 (en) Data transmission method, apparatus and system, electronic device and storage medium
CN109587716A (en) A kind of data communications method, apparatus and system
CN116437410A (en) Frequency band switching method, device and computer-readable storage medium
CN119421133A (en) Communication method and device for vehicle-mounted wireless communication terminal and autonomous driving vehicle
CN104301121A (en) Control method, control device and optical transceiver
BR102012028349B1 (en) METHOD TO MANAGE MOBILE RADIO RESOURCES TO IMPROVE PACKAGE RECEPTION
CN116470944A (en) Antenna selection method
CN107148042A (en) The method for detecting abnormality and system of a kind of AP equipment
CN106922006B (en) Network preferred mode switching method and device
CN109714833A (en) A kind of data communications method, apparatus and system
CN110505037B (en) Network interface communication rate matching method, device, equipment and storage medium
CN111918343A (en) Network switching method and device and computer storage medium
CN118734007A (en) Artificial intelligence AI model verification method and communication equipment
CN115038135B (en) Cell residence method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant