CN114928415B - Multi-parameter networking method based on edge computing gateway link quality evaluation - Google Patents

Multi-parameter networking method based on edge computing gateway link quality evaluation Download PDF

Info

Publication number
CN114928415B
CN114928415B CN202210614999.3A CN202210614999A CN114928415B CN 114928415 B CN114928415 B CN 114928415B CN 202210614999 A CN202210614999 A CN 202210614999A CN 114928415 B CN114928415 B CN 114928415B
Authority
CN
China
Prior art keywords
link quality
gateway
data
edge computing
communication
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.)
Active
Application number
CN202210614999.3A
Other languages
Chinese (zh)
Other versions
CN114928415A (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.)
Wuhan University of Technology WUT
Original Assignee
Wuhan University of Technology WUT
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 Wuhan University of Technology WUT filed Critical Wuhan University of Technology WUT
Priority to CN202210614999.3A priority Critical patent/CN114928415B/en
Publication of CN114928415A publication Critical patent/CN114928415A/en
Application granted granted Critical
Publication of CN114928415B publication Critical patent/CN114928415B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B17/00Monitoring; Testing
    • H04B17/30Monitoring; Testing of propagation channels
    • H04B17/309Measuring or estimating channel quality parameters
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/004Artificial life, i.e. computing arrangements simulating life
    • G06N3/006Artificial life, i.e. computing arrangements simulating life based on simulated virtual individual or collective life forms, e.g. social simulations or particle swarm optimisation [PSO]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B17/00Monitoring; Testing
    • H04B17/30Monitoring; Testing of propagation channels
    • H04B17/309Measuring or estimating channel quality parameters
    • H04B17/318Received signal strength
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B17/00Monitoring; Testing
    • H04B17/30Monitoring; Testing of propagation channels
    • H04B17/309Measuring or estimating channel quality parameters
    • H04B17/336Signal-to-interference ratio [SIR] or carrier-to-interference ratio [CIR]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements
    • H04W24/08Testing, supervising or monitoring using real traffic
    • 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)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Biophysics (AREA)
  • General Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Biomedical Technology (AREA)
  • Electromagnetism (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Quality & Reliability (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本发明公开了一种基于边缘计算网关链路质量评估的多参数组网方法,包括:收集样本数据,并对样本数据进行预处理;基于AWOA‑BP神经网络构建链路质量评估模型,将经过预处理的样本数据输入链路质量评估模型进行训练,直到输出的误差减小到期望程度或者达到设定的学习迭代次数时完成训练,获取训练完的链路质量评估模型;采用载波检测多路访问CSMA和时分多路访问TDMA接入相结合的方式构建基于边缘计算的LoRa网络系统;基于训练完的链路质量评估模型对LoRa网络进行实时链路质量评估,识别链路质量的变化;基于链路质量的变化对LoRa网络的射频参数进行自适应更新,提高了LoRa网络的链路质量和资源利用率。

Figure 202210614999

The invention discloses a multi-parameter networking method based on edge computing gateway link quality assessment, including: collecting sample data and preprocessing the sample data; building a link quality assessment model based on the AWOA-BP neural network, which will pass through The preprocessed sample data is input into the link quality assessment model for training, and the training is completed until the output error is reduced to the expected level or the set number of learning iterations is reached, and the trained link quality assessment model is obtained; the carrier detection multi-channel A LoRa network system based on edge computing is built by combining access CSMA and time division multiple access TDMA access; based on the trained link quality assessment model, real-time link quality assessment is performed on the LoRa network to identify changes in link quality; The link quality change adaptively updates the radio frequency parameters of the LoRa network, improving the link quality and resource utilization of the LoRa network.

Figure 202210614999

Description

基于边缘计算网关链路质量评估的多参数组网方法Multi-parameter networking method based on edge computing gateway link quality assessment

技术领域technical field

本发明属于无线通信领域,特别是涉及一种基于边缘计算网关链路质量评估的多参数组网方法。The invention belongs to the field of wireless communication, in particular to a multi-parameter networking method based on edge computing gateway link quality evaluation.

背景技术Background technique

LoRa(Long Range Radio,远距离无线电)属于LPWAN(Low-Power Wide-AreaNetwork,低功率广域网络)技术的一种,其主要用于多节点、远距离、低功耗的应用现场,是一项在全球通信研究领域备受关注的技术。LoRa是一种典型的支持大规模低速率传输、远距离低功耗的新兴物联网技术,相比较同类型的无线通信技术,LoRa在覆盖范围、续航能力及使用成本等具有明显优势。在通信中,信道资源、时隙资源、能量资源等有限,实现资源的优化利用,提高网络容量和吞吐量是急需解决的难题。而现有的LoRa组网方案都是在LoRaWAN的协议基础上设计,缺乏对时间应用场景的考虑。现有技术中虽然提供了射频参数及其链路特性的参考值,但在实际应用中,无线链路的波动对链路特性的影响是无法预测的,链路特性对通信性能至关重要,影响更高层协议的设计与实现。针对LoRa链路存在的各种干扰,在网关处通过边缘计算对链路质量进行评估,识别链路变化,实现射频参数的自适应更新则成为了如今的一个难题,亟需一种方法来解决。LoRa (Long Range Radio, long-distance radio) is a kind of LPWAN (Low-Power Wide-AreaNetwork, low-power wide-area network) technology, which is mainly used in multi-node, long-distance, low-power application sites. A technology that has received much attention in the field of global communication research. LoRa is a typical emerging IoT technology that supports large-scale low-speed transmission and long-distance low power consumption. Compared with the same type of wireless communication technology, LoRa has obvious advantages in coverage, endurance and cost of use. In communication, channel resources, time slot resources, energy resources, etc. are limited, and it is an urgent problem to realize optimal utilization of resources and improve network capacity and throughput. The existing LoRa networking solutions are all designed on the basis of the LoRaWAN protocol, which lacks consideration of time application scenarios. Although reference values of radio frequency parameters and link characteristics are provided in the prior art, in practical applications, the impact of wireless link fluctuations on link characteristics is unpredictable, and link characteristics are crucial to communication performance. Influence the design and implementation of higher layer protocols. In view of the various interferences existing in the LoRa link, it has become a difficult problem to evaluate the link quality through edge computing at the gateway, identify link changes, and realize adaptive update of radio frequency parameters, and a method is urgently needed to solve it .

发明内容Contents of the invention

本发明的目的是提供一种基于边缘计算网关链路质量评估的多参数组网方法,以解决上述现有技术存在的问题。The purpose of the present invention is to provide a multi-parameter networking method based on edge computing gateway link quality assessment, so as to solve the above-mentioned problems in the prior art.

为实现上述目的,本发明提供了一种基于边缘计算网关链路质量评估的多参数组网方法,包括:To achieve the above purpose, the present invention provides a multi-parameter networking method based on edge computing gateway link quality assessment, including:

收集样本数据,并对所述样本数据进行预处理;Collect sample data and preprocess the sample data;

基于AWOA-BP神经网络构建链路质量评估模型,将经过预处理的所述样本数据输入所述链路质量评估模型进行训练,直到输出的误差减小到期望程度或者达到设定的学习迭代次数时完成训练,获取训练完的链路质量评估模型;Build a link quality assessment model based on the AWOA-BP neural network, and input the preprocessed sample data into the link quality assessment model for training until the output error is reduced to the desired level or reaches the set number of learning iterations The training is completed in time, and the trained link quality evaluation model is obtained;

采用载波检测多路访问CSMA和时分多路访问TDMA接入相结合的方式构建基于边缘计算的LoRa网络系统;The LoRa network system based on edge computing is constructed by combining carrier sense multiple access CSMA and time division multiple access TDMA access;

基于训练完的链路质量评估模型对所述LoRa网络进行实时链路质量评估,识别链路质量的变化;Carry out real-time link quality assessment to the LoRa network based on the trained link quality assessment model, and identify changes in link quality;

基于所述链路质量的变化对所述LoRa网络的射频参数进行自适应更新。Adaptively updating the radio frequency parameters of the LoRa network based on the change of the link quality.

可选的,所述样本数据包括:接收信号强度RSSI、信噪比SNR和丢包率PLR,所述PLR基于所述RSSI和所述SNR计算获得。Optionally, the sample data includes: received signal strength RSSI, signal-to-noise ratio SNR, and packet loss rate PLR, where the PLR is calculated based on the RSSI and the SNR.

可选的,对所述样本数据进行预处理的过程包括:采用了卡尔曼滤波法对所述RSSI和所述SNR进行滤波。Optionally, the process of preprocessing the sample data includes: using a Kalman filter method to filter the RSSI and the SNR.

可选的,在训练所述链路质量评估模型的过程中包括:Optionally, the process of training the link quality assessment model includes:

基于当前的鲸鱼种群分布自适应调整权重的大小;Adaptively adjust the size of the weight based on the current whale population distribution;

基于当前鲸鱼个体的适应度概率阈值自适应调整搜索策略。The search strategy is adaptively adjusted based on the fitness probability threshold of the current whale individual.

可选的,采用CSMA和TDMA接入相结合的方式构建基于边缘计算的LoRa网络系统的过程中:Optionally, in the process of building a LoRa network system based on edge computing by combining CSMA and TDMA access:

在信息传输前,所述CSMA通过信道监听和随机退避的方式降低通信冲突,其中所述CSMA的接入方式为通过竞争方式接入;Before information transmission, the CSMA reduces communication conflicts through channel monitoring and random backoff, wherein the access mode of the CSMA is access through contention;

通过所述TDMA划分时隙,基于划分完成后的时隙分配多节点的信道资源,在节点的采样周期内,使节点在各自的时隙中占用信道进行通信。Time slots are divided by the TDMA, channel resources of multiple nodes are allocated based on the divided time slots, and nodes are allowed to occupy channels in their respective time slots for communication within the sampling period of the nodes.

可选的,采用CSMA和TDMA接入相结合的方式构建基于边缘计算的LoRa网络系统的过程中还包括:所述LoRa网络系统采用星型结构,所述星型结构中包括若干个网关和若干个节点,所述网关包括控制子网关、通信子网关和网关MCU;Optionally, the process of constructing a LoRa network system based on edge computing by combining CSMA and TDMA access also includes: the LoRa network system adopts a star structure, and the star structure includes several gateways and several a node, the gateway includes a control sub-gateway, a communication sub-gateway and a gateway MCU;

通过所述控制子网关进行节点分配,请求数据帧的接收和回应,通过所述通信子网关接收数据包,并发送给所述网关MCU,通过所述网关MCU对所述数据包进行存储、转发和边缘计算,所述数据包包括分配请求包、同步请求包和周期采样数据包。Perform node allocation through the control sub-gateway, request data frame reception and response, receive data packets through the communication sub-gateway, and send them to the gateway MCU, store and forward the data packets through the gateway MCU and edge computing, the data packets include allocation request packets, synchronization request packets and periodic sampling data packets.

可选的,基于所述链路质量的变化对所述LoRa网络系统的射频参数进行自适应更新的过程中,通过所述网关MCU对所述链路质量的变化进行边缘计算,获取射频参数更新指令;Optionally, during the process of adaptively updating the radio frequency parameters of the LoRa network system based on changes in the link quality, the gateway MCU performs edge calculations on the changes in the link quality to obtain radio frequency parameter updates instruction;

将所述射频参数更新指令发送到所述控制子网关、所述通信子网关和节点中,对相应的射频参数进行更新,所述射频参数包括:频率和扩频因子、发射功率以及带宽。The radio frequency parameter update instruction is sent to the control sub-gateway, the communication sub-gateway and the node, and the corresponding radio frequency parameters are updated, and the radio frequency parameters include: frequency and spreading factor, transmission power and bandwidth.

本发明的技术效果为:Technical effect of the present invention is:

(1)针对RSSI、SNR与PLR之间存在的映射关系,提出基于改进的鲸鱼算法优化BP神经网络构建链路质量评估模型。通过自适应权重和搜索策略,提高鲸鱼算法的全局搜索能力和收敛速率,优化后的权值和阈值赋给BP神经网络进行训练,提高模型预测的准确性。(1) Aiming at the mapping relationship between RSSI, SNR and PLR, an improved whale algorithm is proposed to optimize the BP neural network to build a link quality assessment model. Through adaptive weights and search strategies, the global search ability and convergence rate of the whale algorithm are improved, and the optimized weights and thresholds are assigned to the BP neural network for training to improve the accuracy of model predictions.

(2)针对LoRa链路存在的各种干扰,在网关处通过边缘计算对链路质量进行评估,识别链路变化,实现射频参数的自适应更新,提高LoRa网络的链路质量和资源利用率。(2) For various interferences in the LoRa link, evaluate the link quality through edge computing at the gateway, identify link changes, realize adaptive update of radio frequency parameters, and improve the link quality and resource utilization of the LoRa network .

(3)设计了基于边缘计算的多模组LoRa网关系统,实现对终端设备的管理和链路质量的边缘计算,不受网络状态的约束,提高了LoRa网络的稳定性,同时基于物联网云平台对终端设置在线监测和管理。(3) A multi-module LoRa gateway system based on edge computing is designed to realize the management of terminal equipment and edge computing of link quality, which is not restricted by the network status and improves the stability of the LoRa network. At the same time, it is based on the IoT cloud The platform sets up online monitoring and management of terminals.

附图说明Description of drawings

构成本申请的一部分的附图用来提供对本申请的进一步理解,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings constituting a part of the application are used to provide further understanding of the application, and the schematic embodiments and descriptions of the application are used to explain the application, and do not constitute an improper limitation to the application. In the attached picture:

图1为本发明实施例中的AWOA进化曲线示意图;Fig. 1 is the schematic diagram of AWOA evolution curve in the embodiment of the present invention;

图2为本发明实施例中的预测值和真实值对比图,其中(a)为预测值和真实值示意图,(b)为预测值和真实值误差示意图;Fig. 2 is a comparison chart of predicted value and real value in the embodiment of the present invention, wherein (a) is a schematic diagram of predicted value and real value, and (b) is a schematic diagram of error between predicted value and real value;

图3为本发明实施例中的系统结构图;Fig. 3 is a system structure diagram in the embodiment of the present invention;

图4为本发明实施例中的跳频过程流程示意图;FIG. 4 is a schematic flow chart of a frequency hopping process in an embodiment of the present invention;

图5为本发明实施例中的发射功率更新过程示意图;FIG. 5 is a schematic diagram of a transmit power update process in an embodiment of the present invention;

图6为本发明实施例中的带宽更新过程示意图;FIG. 6 is a schematic diagram of a bandwidth update process in an embodiment of the present invention;

图7为本发明实施例中的节点程序流程图;Fig. 7 is a node program flow chart in the embodiment of the present invention;

图8为本发明实施例中的通信子网关程序流程图;FIG. 8 is a flow chart of the communication sub-gateway program in the embodiment of the present invention;

图9为本发明实施例中的网关MCU程序流程图;Fig. 9 is a flow chart of the gateway MCU program in the embodiment of the present invention;

图10为本发明实施例中的LoRa组网协议结构示意图。FIG. 10 is a schematic structural diagram of the LoRa networking protocol in the embodiment of the present invention.

具体实施方式Detailed ways

需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。It should be noted that, in the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and embodiments.

针对LoRa网络在各种环境下对资源分配不合理、无法识别链路变化等问题,本实施例提出基于边缘计算的组网方法,构建基于AWOA-BP神经网络的链路质量评估模型,通过实时的链路质量评估,识别链路质量的变化,进行射频参数自适应更新,提高通信的链路质量和资源利用率。Aiming at the unreasonable allocation of resources and the inability to identify link changes in the LoRa network in various environments, this embodiment proposes a networking method based on edge computing, and builds a link quality evaluation model based on the AWOA-BP neural network. Link quality assessment, identify changes in link quality, perform adaptive update of radio frequency parameters, and improve communication link quality and resource utilization.

本实施例中提供一种基于边缘计算网关链路质量评估的多参数组网方法,包括:This embodiment provides a multi-parameter networking method based on edge computing gateway link quality assessment, including:

对LoRa链路质量的评估是判断通信网络稳定与否的关键指标。通过对LoRa链路特性研究,分析LoRa通信的RSSI、SNR和PLR之间存在的关系,构建合适的链路质量评估模型。构建过程如下所示:The evaluation of the quality of the LoRa link is a key indicator to judge whether the communication network is stable or not. Through the study of LoRa link characteristics, the relationship between RSSI, SNR and PLR of LoRa communication is analyzed, and an appropriate link quality evaluation model is constructed. The build process looks like this:

LoRa通信的测试使用SX1276的射频收发器,在发射端以20dBm的发射功率向固定位置的接收端发送数据包,进行数据的采集。本次测试LoRa的射频参数如表1所设。The LoRa communication test uses the RF transceiver of SX1276 to send data packets to the receiving end at a fixed position at the transmitting end with a transmitting power of 20dBm for data collection. The RF parameters of this test LoRa are set in Table 1.

表1Table 1

Figure BDA0003673913120000051
Figure BDA0003673913120000051

每组测试,发送端连续发送500个数据包,接收端记录每次接收到数据包时RSSI和SNR,并计算其PLR。为了方便和统计PLR,在计算的过程中扩大100倍。为了保障数据的可靠性,在空旷的地方进行测试。不断改变发射端与接收端之间的距离,统计120组数据。在测试时发现,每组数据测得的RSSI和SNR并不是固定值,会出现抖动,所以需要对数据进行滤波减小噪声和干扰才能作为更准确的评估参数。For each set of tests, the sending end sends 500 data packets continuously, and the receiving end records RSSI and SNR each time a data packet is received, and calculates its PLR. In order to facilitate and count the PLR, it is enlarged by 100 times during the calculation process. In order to ensure the reliability of the data, test in an open place. Constantly change the distance between the transmitter and the receiver, and count 120 sets of data. During the test, it was found that the RSSI and SNR measured by each set of data are not fixed values, and there will be jitter, so the data needs to be filtered to reduce noise and interference to be used as more accurate evaluation parameters.

本发明以方差作为标准评判滤波效果,方差越小,表示滤波后的信号越稳定,滤波效果越好。通过表2中3种滤波方法的方差对比,可知卡尔曼滤波的方差要小,且滤波后的信号与原信号偏离较小,因此本发明中采用卡尔曼滤波对SNR、RSSI值进行滤波修正。发生丢包事件时,链路参数都比较小,因此缺失值采用滤波后的最小值填充。In the present invention, the variance is used as a standard to evaluate the filtering effect, and the smaller the variance is, the more stable the filtered signal is and the better the filtering effect is. Through the variance comparison of the three filtering methods in Table 2, it can be seen that the variance of the Kalman filter is smaller, and the deviation between the filtered signal and the original signal is small, so the Kalman filter is used in the present invention to filter and correct the SNR and RSSI values. When a packet loss event occurs, the link parameters are relatively small, so the missing value is filled with the minimum value after filtering.

表2Table 2

Figure BDA0003673913120000061
Figure BDA0003673913120000061

在测试中发现,当SNR小于-25dB或者RSSI小于-125dBm时,丢包率高达30%以上,且丢包率是随机变化的,因此直接判断链路质量为差。当SNR大于25dB或者RSSI大于-95dB时,丢包率低于0.4%,直接判断链路质量为好。因此本发明主要是对链路质量的过渡区进行评估。In the test, it is found that when the SNR is less than -25dB or the RSSI is less than -125dBm, the packet loss rate is as high as 30%, and the packet loss rate changes randomly, so it is directly judged that the link quality is poor. When the SNR is greater than 25dB or the RSSI is greater than -95dB, the packet loss rate is lower than 0.4%, and it is directly judged that the link quality is good. Therefore, the present invention mainly evaluates the transition zone of the link quality.

惯性权重是鲸鱼算法中重要的参数,在优化目标函数中起着重要的作用。当权重较大时,算法收敛速度快,搜索范围更广;反之,算法搜索的越细致,实现对最优解周围搜索。因此,权重的选择对提升鲸鱼算法的性能至关重要。单纯的线性权重调整没有考虑实际的收敛情况,迭代过程中会对算法的收敛速度造成干扰。基于此,考虑根据当前的鲸鱼种群分布来自适应调整权重的大小,权重计算式如下:The inertia weight is an important parameter in the whale algorithm and plays an important role in optimizing the objective function. When the weight is larger, the algorithm converges faster and the search range is wider; on the contrary, the algorithm searches more carefully and realizes searching around the optimal solution. Therefore, the choice of weights is crucial to improving the performance of the whale algorithm. The pure linear weight adjustment does not consider the actual convergence situation, which will interfere with the convergence speed of the algorithm during the iteration process. Based on this, consider adaptively adjusting the weight according to the current whale population distribution. The weight calculation formula is as follows:

w=λ1×(Pi w-Pi b)+λ2×(ub-lb)/t  (1)w=λ 1 ×(P i w -P i b )+λ 2 ×(ub-lb)/t (1)

式中:λ1、λ2为常数,t为此时的迭代次数;ub、lb为自变量上限和下限;Pi w、Pi b是当前最差和最优位置向量。根据种群位置自适应调整权重,改进的收缩包围和狩猎行为的位置更新式如下:In the formula: λ 1 , λ 2 are constants, t is the number of iterations at this time; ub, lb are the upper and lower limits of independent variables; P i w , P i b are the current worst and best position vectors. Adaptively adjust the weight according to the population position, and the position update formula of the improved shrinking encirclement and hunting behavior is as follows:

X(t+1)=w×X*(t)-AD                             (2)X(t+1)=w×X * (t)-AD (2)

X(t+1)=D'eblcos(2πl)+w×X*(t)                          (3)X(t+1)=D'e bl cos(2πl)+w×X * (t) (3)

自适应权重的调整,在算法迭代开始时,如果匹配到局部最优解,且最优和最差位置向量之间的差异很小,但λ2×(ub-lb)/t的值并不受当前种群分布的影响,也可以获得较大的权重w,从而使算法在初期不陷入小范围的搜索。随着鲸鱼迭代次数的增加,λ2×(ub-lb)/t的值逐渐变小,若此时算法未达到最优解,λ1×(Pi w-Pi w)的值在权重的比重起主导作用,使算法以较长的步长进行寻优。这样的权重由两个部分组成,后一部分调节算法陷入局部最优,前一部分在迭代次数较大时快速寻优,提高算法的收敛速度。这样的权重自适应兼顾对算法整体寻优和收敛速度的加强,根据当前的种群分布进行调整。For the adjustment of adaptive weights, at the beginning of the algorithm iteration, if the local optimal solution is matched, and the difference between the optimal and worst position vectors is small, but the value of λ 2 ×(ub-lb)/t does not Affected by the current population distribution, a larger weight w can also be obtained, so that the algorithm does not fall into a small-scale search in the early stage. As the number of iterations of the whale increases, the value of λ 2 ×(ub-lb)/t gradually decreases. If the algorithm does not reach the optimal solution at this time, the value of λ 1 ×(P i w -P i w ) in the weight The proportion of plays a leading role, making the algorithm optimize with a longer step size. Such a weight is composed of two parts. The latter part adjusts the algorithm to fall into local optimum, and the former part quickly seeks optimization when the number of iterations is large, so as to improve the convergence speed of the algorithm. This kind of weight self-adaptation takes into account the overall optimization of the algorithm and the enhancement of the convergence speed, and is adjusted according to the current population distribution.

为了提高在随机搜索过程中算法的寻优能力,根据当前鲸鱼个体的适应度概率阈值Q自适应调整搜索策略,概率阈值的计算式为:In order to improve the optimization ability of the algorithm in the random search process, the search strategy is adaptively adjusted according to the fitness probability threshold Q of the current individual whale. The calculation formula of the probability threshold is:

Figure BDA0003673913120000081
Figure BDA0003673913120000081

式中:favg是平均适应度值;fmax是适应度值的最大值;fmin是适应度值的最小值。当进行随机搜索时,以一个[0,1]之间的随机数q与计算的适应度概率阈值Q进行比较,若q<Q,鲸鱼个体按照式(5)执行位置更新,不改变其它个体位置;否则,鲸鱼个体按照式(2)执行位置更新。搜索策略的调整,在算法迭代开始时,可以在全局范围内生成一组随机解,避免迭代初期鲸鱼种群聚集而导致种群多样性的损失,提高了算法的整体搜索能力。In the formula: f avg is the average fitness value; f max is the maximum value of fitness value; f min is the minimum value of fitness value. When performing random search, a random number q between [0,1] is compared with the calculated fitness probability threshold Q. If q<Q, the whale individual performs position update according to formula (5), without changing other individuals position; otherwise, the individual whale executes position update according to formula (2). The adjustment of the search strategy can generate a set of random solutions on a global scale at the beginning of the algorithm iteration, avoiding the loss of population diversity caused by the aggregation of the whale population in the early stage of the iteration, and improving the overall search ability of the algorithm.

Xrand=Xjmin+r×(Xjmax-Xjmin)  (5)X rand =X jmin +r×(X jmax -X jmin ) (5)

式中:r为[0,1]之间的随机数,Xmax、Xmin为变量Xrand的最大值和最小值。In the formula: r is a random number between [0,1], X max and X min are the maximum and minimum values of the variable X rand .

为了测试和分析改进的自适应权重和自适应搜索策略的鲸鱼算法的性能,选择4个基本测试函数,如表3所示,其中f1、f2为单峰函数,f3、f4为多峰函数。测试中,与粒子群算法(Particle Swarm Optimization,PSO)、灰狼算法(GreyWolfOptimizer,GWO)和未改进的鲸鱼算法作比较,算法种群规模都设置为30,最大迭代次数为100。In order to test and analyze the performance of the whale algorithm with the improved adaptive weight and adaptive search strategy, four basic test functions are selected, as shown in Table 3, where f 1 and f 2 are unimodal functions, and f 3 and f 4 are multimodal function. In the test, compared with the particle swarm optimization (PSO), gray wolf algorithm (GreyWolfOptimizer, GWO) and the unimproved whale algorithm, the algorithm population size is set to 30, and the maximum number of iterations is 100.

表3table 3

Figure BDA0003673913120000082
Figure BDA0003673913120000082

Figure BDA0003673913120000091
Figure BDA0003673913120000091

通过对基本测试函数的优化曲线可以明显看出,改进的鲸鱼算法收敛速度和稳定度都有较大的提高,全局搜索能力更强,在对f1、f4函数的优化中,收敛到全局最优。验证了改进的鲸鱼算法的可行性和高性能。本发明以样本的均方误差为目标函数,使用改进的鲸鱼算法优化BP神经网络,将最优个体的权重和阈值参数分配给BP神经网络。图1为鲸鱼优化算法的进化曲线。From the optimization curve of the basic test function, it can be clearly seen that the improved whale algorithm has greatly improved the convergence speed and stability, and the global search ability is stronger. In the optimization of f1 and f4 functions, it converges to the global minimum excellent. The feasibility and high performance of the improved whale algorithm are verified. The invention takes the mean square error of the sample as the objective function, uses the improved whale algorithm to optimize the BP neural network, and assigns the optimal individual weight and threshold parameters to the BP neural network. Figure 1 shows the evolution curve of the whale optimization algorithm.

从上图可以看出,当鲸鱼算法迭代到42次时,已经达到均方误差的最小。使用LoRa单节点收集样本数据,进行卡尔曼滤波处理,获得的120组样本数据中,其中90%作为训练样本,10%作为测试样本,使用BP神经网络映射RSSI、SNR和PLR之间的关系。在MATLAB工具包中的BP神经网络中,设置RSSI和SNR为输入层,PLR为输出层,最大训练次数为1000,学习速率为0.01,隐含层根据式(6)进行多次循环训练,当训练的模型均方误差最小时确定为隐含层节点数。其中n表示输入层节点数,p表示输出层节点数,a为1~10之间的常数,m表示隐含层节点数。多次训练的结果表明隐含层为11时,训练模型的均方误差最小。为了更准确的对映射模型显示,BP神经网网络映射的PLR取值范围为0~40%。As can be seen from the figure above, when the whale algorithm iterates to 42 times, the minimum mean square error has been reached. The LoRa single node is used to collect sample data and processed by Kalman filter. Of the 120 sets of sample data obtained, 90% are used as training samples and 10% are used as test samples. The relationship between RSSI, SNR and PLR is mapped using BP neural network. In the BP neural network in the MATLAB toolkit, set RSSI and SNR as the input layer, PLR as the output layer, the maximum number of training times is 1000, the learning rate is 0.01, and the hidden layer is trained multiple times according to formula (6). The number of hidden layer nodes is determined when the mean square error of the trained model is the smallest. Among them, n represents the number of nodes in the input layer, p represents the number of nodes in the output layer, a is a constant between 1 and 10, and m represents the number of nodes in the hidden layer. The results of multiple training shows that when the hidden layer is 11, the mean square error of the training model is the smallest. In order to display the mapping model more accurately, the PLR value range of BP neural network mapping is 0-40%.

Figure BDA0003673913120000101
Figure BDA0003673913120000101

将测试样本代入训练模型进行预测输出,图2显示的是使用改进的鲸鱼算法优化BP神经网络模型前后预测值与真实值的对比,如图2(a)所示,为了进一步显示优化前后预测值的准确性,使用预测值与真实值的差作为误差,如图2(b)所示。Substituting the test sample into the training model to predict the output, Figure 2 shows the comparison between the predicted value and the real value before and after the BP neural network model is optimized using the improved whale algorithm, as shown in Figure 2(a), in order to further display the predicted value before and after optimization The accuracy of , using the difference between the predicted value and the true value as the error, as shown in Figure 2(b).

从图2中,得到基本的BP神经网络模型预测值与真实值之间的绝对误差可以达到3%,而经过鲸鱼算法优化的BP神经网络模型预测值与真实的绝对误差在1%以内。MATLAB计算优化前的平均绝对误差(mean absolute error,MAE)为0.92968%,平均绝对百分比误差(mean absolute percentage error,MAPE)是17.3618%,经过改进鲸鱼算法优化的BP神经网络模型计算的MAE和MAPE分别为0.28866%和10.048%,优化后的BP神经网络模型预测的准确性大大提高,对于链路的评估效果更好,更有研究和应用价值。From Figure 2, the absolute error between the predicted value of the basic BP neural network model and the real value can reach 3%, while the absolute error between the predicted value of the BP neural network model optimized by the whale algorithm and the real value is within 1%. MATLAB calculates the mean absolute error (mean absolute error, MAE) before optimization is 0.92968%, and the mean absolute percentage error (mean absolute percentage error, MAPE) is 17.3618%. The MAE and MAPE calculated by the BP neural network model optimized by the improved whale algorithm They are 0.28866% and 10.048% respectively. The prediction accuracy of the optimized BP neural network model is greatly improved, the evaluation effect of the link is better, and it has more research and application value.

本发明围绕LoRa网络的链路质量进行研究和分析。通过AWOA-BP神经网络训练RSSI、SNR和PLR之间的非线性映射模型,经测试AWOA-BP神经网络模型预测的准确性远高于BP神经网络。与一些现有技术使用的评估方法进行对比,AWOA-BP神经网络模型具有更好的预测效果和准确性,具有实际应用的可行性,可采用该模型对LoRa链路质量进行评估。The present invention researches and analyzes the link quality around the LoRa network. The nonlinear mapping model between RSSI, SNR and PLR is trained through the AWOA-BP neural network, and the prediction accuracy of the AWOA-BP neural network model is much higher than that of the BP neural network. Compared with the evaluation methods used in some existing technologies, the AWOA-BP neural network model has better prediction effect and accuracy, and is feasible for practical application. This model can be used to evaluate the quality of LoRa links.

在LoRaWAN协议中,上行通信节点采用的是ALOHA接入方式与网关通信,网关作为接入中心,各个节点与网关是相互独立通信。当信道中同时存在多个数据包时,有冲突产生,导致数据包丢失。此时,节点发送数据是不考虑当前通信信道是否空闲,丢包后,节点无法收到网关的响应,通信的时延性和稳定性较差。LoRaWAN协议常用的射频芯片SX1301有8个调制通道,但是其不能同时解调多个数据包,无法实现多路信道的同时通信,并发性较差,且扩频因子之间的不完美正交性增加了信道通信的干扰。LoRaWAN网络由于是随机接入的方式,节点容量越多越容易造成通信冲突,因此为了保障网络的稳定性,降低了网络规模。In the LoRaWAN protocol, the uplink communication node uses the ALOHA access method to communicate with the gateway. The gateway acts as the access center, and each node communicates independently with the gateway. When there are multiple data packets in the channel at the same time, a collision occurs, resulting in data packet loss. At this time, the node sends data without considering whether the current communication channel is idle. After the packet is lost, the node cannot receive the response from the gateway, and the communication delay and stability are poor. The radio frequency chip SX1301 commonly used in the LoRaWAN protocol has 8 modulation channels, but it cannot demodulate multiple data packets at the same time, and cannot realize simultaneous communication of multiple channels. The concurrency is poor, and the spreading factors are not perfect orthogonality. Increased channel communication interference. Since the LoRaWAN network is a random access method, the larger the node capacity, the easier it is to cause communication conflicts. Therefore, in order to ensure the stability of the network, the network scale is reduced.

鉴于LoRaWAN网络的不足之处,为了提高LoRa的网络容量和资源分配,自定义的LoRa网络使用选择时分多路访问TDMA(Time division multiple access)和载波检测多路访问CSMA(Carrier Sense Multiple Access)接入相结合的方式,用两种不同的方式来提高信道的利用率。自定义的LoRa网关采用8个射频模块组成8路信道,其中一路作为控制信道,负责对节点进行分配,六路作为通信信道,接收节点周期上传的数据,一路作为备用信道,处理应急通信,网络的系统架构如图3所示。In view of the shortcomings of the LoRaWAN network, in order to improve the network capacity and resource allocation of LoRa, the customized LoRa network uses TDMA (Time division multiple access) and CSMA (Carrier Sense Multiple Access) to connect. Into a combination of ways to improve channel utilization in two different ways. The custom LoRa gateway uses 8 radio frequency modules to form 8 channels, one of which is used as a control channel, which is responsible for assigning nodes, six channels are used as communication channels to receive data uploaded by nodes periodically, and one channel is used as a backup channel to handle emergency communications and network communication. The system architecture is shown in Figure 3.

为了实现节点的TDMA方式的通信,必须对节点的本地时钟进行同步,时间同步是分配固定时隙的前提。常用的时间同步方式包括卫星授时、网络授时、无线电授时,网络授时和卫星授时虽然精度较高,但是LoRa网络中,考虑到成本、协议和实际应用的适应能力,本发明选择的是无线电授时。在使用无线电授时时,会产生由于同步报文的发送而带来的同步精度的误差。本发明设计的LoRa网络结构是星型结构,节点与网关进行通信,为了使得同步简单有效,控制信道将节点分配后,节点与通信信道的子网关进行时间同步,由节点向网关发送同步请求,网关收到后回复本地时钟。为了减小同步报文发送带来的误差,采用双向同步算法,记录节点发送同步请求的本地时钟T1,接收到网关的同步时钟后记录本地时钟为T2,将二者的差值作为同步报文空中传输的补偿,即为In order to realize the communication of the TDMA mode of the node, the local clock of the node must be synchronized, and time synchronization is a prerequisite for allocating fixed time slots. Commonly used time synchronization methods include satellite time service, network time service, and radio time service. Although network time service and satellite time service have high precision, in the LoRa network, considering cost, protocol and practical application adaptability, the present invention selects radio time service. When using radio time service, there will be errors in synchronization accuracy due to the transmission of synchronization messages. The LoRa network structure designed by the present invention is a star structure, and the nodes communicate with the gateway. In order to make the synchronization simple and effective, after the control channel allocates the nodes, the nodes and the sub-gateways of the communication channel perform time synchronization, and the nodes send a synchronization request to the gateway. The gateway replies to the local clock after receiving it. In order to reduce the error caused by sending synchronization messages, a two-way synchronization algorithm is used to record the local clock T 1 of the node sending the synchronization request. After receiving the synchronization clock of the gateway, record the local clock as T 2 , and use the difference between the two as the synchronization The compensation for message transmission over the air is

RTC=Trec+(T2-T1)  (7)RTC=T rec +(T 2 -T 1 ) (7)

在进行时间同步后,节点就可以按照固定时隙进行数据的发送。但使用硬件时钟,晶振会出现漂移,偏差的不断积累会造成时间同步的失效,节点间相互冲突。时钟的偏差公式可以用如下式表示:After time synchronization, the nodes can send data according to fixed time slots. However, when using a hardware clock, the crystal oscillator will drift, and the continuous accumulation of deviations will cause the failure of time synchronization and conflicts between nodes. The clock deviation formula can be expressed as follows:

Δt=νt+tcs  (8)Δt=νt+t cs (8)

式中v表示节点的晶振漂移率,tcs表示节点同步偏差。随着时间的增加,偏差会越来越大,这时就需要进行时钟补偿校正,最实用的方式就是偏差超过一定精度范围再重新进行时间同步,维持同步精度。由于存在同步时钟偏差,因此时隙的划分要大于其传输时间。节点和网关之间的通信是双向的,节点固定周期上行传输采样数据,网关下行控制命令,因此设置时隙长度的最小值为:In the formula, v represents the crystal oscillator drift rate of the node, and t cs represents the node synchronization deviation. With the increase of time, the deviation will become larger and larger. At this time, clock compensation correction is required. The most practical way is to perform time synchronization again after the deviation exceeds a certain accuracy range to maintain synchronization accuracy. Due to the synchronous clock skew, the division of time slots is larger than its transmission time. The communication between the node and the gateway is two-way, the node transmits sampling data uplink at a fixed period, and the gateway downlinks the control command, so the minimum value of the time slot length is set as:

τmin=td+te+2max(Δt)  (9)τ min =t d +t e +2max(Δt) (9)

时隙长度τ和采样周期T决定了每个信道的节点容量:The slot length τ and sampling period T determine the node capacity of each channel:

Figure BDA0003673913120000121
Figure BDA0003673913120000121

采样周期是根据实际应用设置的,在网络中一般是固定的,因此时隙长度决定了节点容量。时隙长度的最小值是上下行传输时间加上2倍的时钟偏差,因此可以以信道中第一个同步节点发送同步请求到收到网关回复的时间间隔加上偏差作为时隙长度,同步请求和节点采样的数据长度相同,网关回复的长度与网关下行更新指令的长度相同,这样时隙长度划分最多,节点容量更大,网络的吞吐量最高。The sampling period is set according to the actual application and is generally fixed in the network, so the length of the time slot determines the capacity of the node. The minimum value of the time slot length is the uplink and downlink transmission time plus 2 times the clock deviation. Therefore, the time interval between the first synchronization node in the channel sending the synchronization request and receiving the gateway reply plus the deviation can be used as the time slot length. The synchronization request The length of the data sampled by the node is the same, and the length of the gateway's reply is the same as the length of the gateway's downlink update command. In this way, the time slot length is divided into the most, the node capacity is larger, and the throughput of the network is the highest.

LoRa网络的链路质量决定了其通信的稳定性和鲁棒性,为了能够实现网络有较好的通信质量,必须提高其链路质量。在通信的过程中,由于存在环境干扰,链路质量是多变的,为了保障通信的可靠性,可以更新射频参数来提高链路质量。在通信中,信道资源、时隙资源、能量资源等有限,实现资源的优化利用,提高网络容量和吞吐量是急需解决的难题。本发明提出的多信道的组网方法,有很高的抗干扰能力,能够在网关处通过边缘计算实现射频参数的自适应更新,提高资源利用率和链路质量。The link quality of the LoRa network determines the stability and robustness of its communication. In order to achieve better communication quality of the network, the link quality must be improved. In the process of communication, due to the existence of environmental interference, the link quality is changeable. In order to ensure the reliability of communication, the radio frequency parameters can be updated to improve the link quality. In communication, channel resources, time slot resources, energy resources, etc. are limited, and it is an urgent problem to realize optimal utilization of resources and improve network capacity and throughput. The multi-channel networking method proposed by the present invention has high anti-interference ability, and can realize self-adaptive updating of radio frequency parameters through edge calculation at the gateway, thereby improving resource utilization and link quality.

节点在加入网络后,首先是将节点根据链路质量分配到合适的信道。设计的8通道的网关,根据不同扩频因子的接收灵敏度覆盖范围不同,将控制信道的扩频因子设为12,覆盖范围最大,其余通信信道扩频因子设置从7~12,备用信道设为7,接收灵敏度是能够解析有用信号的最小接收功率,因此根据接收请求分配数据包读取的RSSI将节点分配到合适的信道。通过设置RSSI拐点值的方式,如下表4所示。After a node joins the network, it first assigns the node to an appropriate channel according to the link quality. The 8-channel gateway is designed, according to the different coverage of the receiving sensitivity of different spreading factors, the spreading factor of the control channel is set to 12, which has the largest coverage, the spreading factors of the other communication channels are set from 7 to 12, and the spare channel is set to 7. Receive sensitivity is the minimum received power that can resolve useful signals, so assign nodes to appropriate channels according to the RSSI read by the receive request allocation packet. By setting the RSSI inflection point value, as shown in Table 4 below.

表4Table 4

Figure BDA0003673913120000131
Figure BDA0003673913120000131

上表仅作为节点加入网络的分配策略,为了提高对信道分配的利用率,当前信道所接入的节点达到所有加入网络节点数量的1/2时,优先分配到其它信道。节点在通信信道工作时,通过实时统计和评估链路质量进行参数的自适应调整。节点在通信的过程中,容易受到各种干扰,信道链路变差,通信丢包率很大,因此需要改善节点通信的链路质量,自适应调整射频参数。测试邻频干扰时,相邻信道的载波频率差大于2MHz时,不易受到邻频干扰,因此对各个信道的频点规划如表5所示。The above table is only used as an allocation strategy for nodes joining the network. In order to improve the utilization rate of channel allocation, when the number of nodes connected to the current channel reaches 1/2 of all nodes joining the network, priority is allocated to other channels. When the node is working in the communication channel, the parameters are adaptively adjusted through real-time statistics and evaluation of the link quality. In the process of communication, nodes are vulnerable to various interferences, the channel link is degraded, and the communication packet loss rate is very high. Therefore, it is necessary to improve the link quality of node communication and adaptively adjust radio frequency parameters. When testing adjacent channel interference, when the carrier frequency difference of adjacent channels is greater than 2MHz, it is not easy to suffer from adjacent channel interference. Therefore, the frequency point planning for each channel is shown in Table 5.

表5table 5

Figure BDA0003673913120000141
Figure BDA0003673913120000141

从表5中可以看出,控制信道的频点只用一个,因为控制信道处理的是突发随机型业务,对于通信的稳定性并无高要求,大多数属于信道空闲状态。通信信道的扩频因子固定从7~12,载波频率有21个可变频点,为可修改参数。设计的LoRa网关与节点之间,主要是实现对工业设备的监控,并不需要频繁的上下行交互,为了降低功耗,节点只在时间同步时开启接收窗口,两者进行信息交互,因此所有的边缘计算都是在节点请求同步时。各个射频参数具体更新过程如下:It can be seen from Table 5 that only one frequency point is used for the control channel, because the control channel handles burst random services and does not have high requirements for communication stability, and most of them belong to the idle state of the channel. The spreading factor of the communication channel is fixed from 7 to 12, and the carrier frequency has 21 variable frequency points, which are modifiable parameters. The design between the LoRa gateway and the node is mainly to realize the monitoring of industrial equipment, and does not require frequent uplink and downlink interactions. In order to reduce power consumption, the node only opens the receiving window when the time is synchronized, and the two exchange information, so all Edge computing is performed when nodes request synchronization. The specific update process of each radio frequency parameter is as follows:

(1)频率和扩频因子自适应(1) Frequency and spreading factor adaptive

在LoRa网络通信的过程中,容易受到各种干扰或者节点终端超出子网关覆盖范围,根据式(12)增大扩频因子,LoRa模块的接收灵敏度更高,覆盖范围更远。因此,根据链路质量的变化,识别链路干扰,控制信道的子网关通过周期性频谱感知获取表5中除已用频点外的空闲可用频点,进行跳频,调节节点终端的频率和扩频因子来提高链路质量,具体流程如图4。In the process of LoRa network communication, it is vulnerable to various interferences or the node terminal exceeds the coverage of the sub-gateway. According to the formula (12), the spreading factor is increased, and the receiving sensitivity of the LoRa module is higher and the coverage is farther. Therefore, according to the change of link quality, link interference is identified, and the sub-gateway of the control channel obtains the free and available frequency points in Table 5 except the frequency points used in Table 5 through periodic spectrum sensing, performs frequency hopping, and adjusts the frequency and frequency of node terminals. The spreading factor is used to improve the link quality. The specific process is shown in Figure 4.

(2)发射功率自适应(2) Adaptive transmit power

通过对发射功率的研究分析,可以得知发射功率越大,信道的链路质量越好,但与此同时能量的消耗也越大,节点终端的生命周期越短。因此根据链路质量进行发射功率的调节,对于能量资源的分配很有必要,具体流程如图5所示。Through the research and analysis of the transmission power, it can be known that the greater the transmission power, the better the link quality of the channel, but at the same time, the greater the energy consumption, the shorter the life cycle of the node terminal. Therefore, it is necessary to adjust the transmission power according to the link quality for the allocation of energy resources. The specific process is shown in FIG. 5 .

(3)带宽自适应(3) Bandwidth adaptive

空中传输时间等于前导码和有效载荷的传输时间之和。前导码的长度是固定的,根据式(11),有效载荷的符号数由有效载荷的长度、扩频因子、编码率决定,因此当数据包的长度、扩频因子、编码率确定时,由符号周期TS的定义可以得到,空中传输时间与带宽成反比,传输时间随带宽增大而缩短。数据的传输时间越短,根据式(9)的最小时隙计算方法,t越小,则信道容量越大,信道的利用率更高,网关的吞吐量更高。增大带宽可以实现网络的扩容,但接收灵敏度会降低,降低链路质量,因此扩容是在链路质量较好时进行,如图6所示。The air transit time is equal to the sum of the preamble and payload transit times. The length of the preamble is fixed. According to formula (11), the number of symbols in the payload is determined by the length of the payload, the spreading factor, and the coding rate. Therefore, when the length of the data packet, the spreading factor, and the coding rate are determined, the The definition of the symbol period T S can be obtained, the transmission time in the air is inversely proportional to the bandwidth, and the transmission time shortens as the bandwidth increases. The shorter the data transmission time, according to the minimum slot calculation method of formula (9), the smaller t is, the larger the channel capacity is, the higher the utilization rate of the channel is, and the higher the throughput of the gateway is. Increasing the bandwidth can realize the expansion of the network, but the receiving sensitivity will decrease and the link quality will be reduced. Therefore, the expansion is performed when the link quality is good, as shown in Figure 6.

Figure BDA0003673913120000161
Figure BDA0003673913120000161

式中:npa表示有效载荷数据的符号数,PL为有效载荷长度;H表示使能报头,显式H=0,隐式H=1;当使用低速率优化时,DE表示是否开启低信息速率优化,开启则DE=1,否则DE=0。CR表示编码率,max表示最大的集合元素,ceil功能是返回不小于表达式的最小整数。In the formula: n pa represents the number of symbols of the payload data, PL is the length of the payload; H represents the enable header, explicit H=0, implicit H=1; when using low rate optimization, DE represents whether to enable low information Rate optimization, DE=1 if enabled, otherwise DE=0. CR represents the encoding rate, max represents the largest set element, and the ceil function returns the smallest integer not less than the expression.

符号周期TS定义为:The symbol period T S is defined as:

Figure BDA0003673913120000162
Figure BDA0003673913120000162

其中BW表示信号带宽,单位为Hz,SF表示扩频因子。Among them, BW represents the signal bandwidth in Hz, and SF represents the spreading factor.

S=-174+10lg B+NF-2.5SF+10  (12)S=-174+10lg B+NF-2.5SF+10 (12)

从上式可以得到,扩频因子和带宽共同决定LoRa的接收灵敏度。It can be obtained from the above formula that the spreading factor and the bandwidth jointly determine the receiving sensitivity of LoRa.

LoRa网络主要由网关和节点构成,组网的实现是节点接入到网关上,网关进行数据转发、存储和边缘计算对节点进行管理。其中网关由多路射频模块构成,组成多通道网络。网关和节点的程序流程如下所示:The LoRa network is mainly composed of gateways and nodes. The realization of the networking is that the nodes are connected to the gateway, and the gateway performs data forwarding, storage and edge computing to manage the nodes. The gateway is composed of multiple radio frequency modules to form a multi-channel network. The program flow for gateways and nodes is as follows:

(1)节点流程(1) Node process

节点主要实现的对工业设备信息的采样功能,本发明以采集温度信息为例。节点开启工作后,首先向控制子网关发送分配请求,收到配置命令后与通信子网关进行RTC时钟同步,采用TDMA的方式来实现多节点在同一子网关下的数据发送。节点如果是第一个接入到子网关的,会发送两次同步请求,根据节点计算的数据包传输时间来计算时隙长度。当多次同步失败后,节点重新接入控制子网关进行分配。在节点同步成功后,进行周期性的数据采集发送,当发送次数达到时钟漂移对时隙划分有较大影响时,重新进行时间同步。在节点工作的过程中,节点会收到网关的参数更新指令,修改射频参数,提高节点的通信质量。节点的程序流程图如图7所示。The node mainly realizes the sampling function of industrial equipment information, and the present invention takes the collection of temperature information as an example. After the node starts working, it first sends a distribution request to the control sub-gateway, and after receiving the configuration command, it performs RTC clock synchronization with the communication sub-gateway, and uses TDMA to realize data transmission of multiple nodes under the same sub-gateway. If the node is the first to access the sub-gateway, it will send two synchronization requests, and calculate the time slot length according to the data packet transmission time calculated by the node. After multiple synchronization failures, the node reconnects to the control sub-gateway for distribution. After the nodes are successfully synchronized, periodic data collection and transmission are carried out. When the number of transmissions reaches the clock drift that has a great impact on the division of time slots, time synchronization is performed again. During the working process of the node, the node will receive the parameter update command from the gateway, modify the radio frequency parameters, and improve the communication quality of the node. The program flow chart of the node is shown in Figure 7.

(2)网关流程(2) Gateway process

多通道的网关被分为控制子网关和通信子网关,控制子网关参与节点分配请求数据帧的接收和回应,只有数据的接收和发送,将接收数据包时SX1276读取的链路参数RSSI发给MCU。控制子网关在大多数时间是空闲的,还负责周期性频谱感知获取空闲信道。通信子网关的主要功能是维持一个以TDMA方式接入的星型网络,通信子网关的接收窗口是一直开启的,收到节点的数据后,发给网关MCU,由网关MCU来进行存储和处理。网关MCU将处理结果发给子网关,子网关根据数据包的类型进行操作。如图8是通信子网关的程序流程图。The multi-channel gateway is divided into a control sub-gateway and a communication sub-gateway. The control sub-gateway participates in the reception and response of the node allocation request data frame. Only the data is received and sent, and the link parameter RSSI read by the SX1276 when receiving the data packet is sent. to the MCU. The control sub-gateway is idle most of the time, and is also responsible for periodic spectrum sensing to obtain idle channels. The main function of the communication sub-gateway is to maintain a star network accessed by TDMA. The receiving window of the communication sub-gateway is always open. After receiving the data of the node, it is sent to the gateway MCU, which is stored and processed by the gateway MCU. . The gateway MCU sends the processing result to the sub-gateway, and the sub-gateway operates according to the type of the data packet. Figure 8 is a program flow chart of the communication sub-gateway.

网关MCU的功能主要是对数据的转发和边缘计算,程序流程如图9所示。网关采用Linux系统多线程并发的方式,子线程监控TCP协议连接状态,当检测到连接异常后,数据进行缓存,重新连接服务器。当网络连接正常,重新注册设备,将缓存数据转发给服务端,服务端可以下行指令对网关进行参数配置。主线程主要进行边缘计算,处理8路子网关转发上来的数据,实现网关的智能化,提高LoRa网络通信的可靠性和鲁棒性。主线程在收到分配请求后,根据物理层参数RSSI为节点分配通信信道,当节点为新加入到网络中的,需要向服务端发送设备注册帧,表示设备加入到网络中。当收到同步请求后,根据第一个接入到信道中的节点来计算时隙长度,实现对信道资源的最大化分配,然后根据链路质量进行射频参数自适应。根据边缘计算结果,将射频参数更新指令发给子网关和节点。当收到是周期采样数据,进行数据存储,发送到服务端。The functions of the gateway MCU are mainly data forwarding and edge computing, and the program flow is shown in Figure 9. The gateway adopts the multi-thread concurrent method of the Linux system. The sub-thread monitors the connection status of the TCP protocol. When an abnormal connection is detected, the data is cached and the server is reconnected. When the network connection is normal, re-register the device and forward the cached data to the server, and the server can configure parameters for the gateway with downlink commands. The main thread mainly performs edge computing, processes the data forwarded by the 8-way sub-gateway, realizes the intelligentization of the gateway, and improves the reliability and robustness of LoRa network communication. After receiving the allocation request, the main thread allocates a communication channel for the node according to the physical layer parameter RSSI. When the node is newly added to the network, it needs to send a device registration frame to the server to indicate that the device has joined the network. When the synchronization request is received, the time slot length is calculated according to the first node connected to the channel to realize the maximum allocation of channel resources, and then the radio frequency parameters are self-adapted according to the link quality. According to the edge computing results, the radio frequency parameter update command is sent to the sub-gateway and the node. When the data is periodically sampled, the data is stored and sent to the server.

基于边缘计算的组网参考了LoRaWAN协议中各类型通信帧的特点,以LoRa数据链路层通信为基础,满足工业自动化应用而制定的一套通信方案。组网协议结构如图10所示。The networking based on edge computing refers to the characteristics of various types of communication frames in the LoRaWAN protocol, and is based on LoRa data link layer communication to meet a set of communication solutions developed for industrial automation applications. The structure of the networking protocol is shown in Figure 10.

基于链路质量评估的参数优化更新的组网协议中,LoRa节点实现物理层传感器对工业设备信息的采集并通过SX1276射频芯片发送给子网关,由子网关将数据帧转发给网关MCU,进行数据的存储、转发和边缘计算。服务端和网关都对数据进行处理计算,进行节点管理和链路质量的计算,由前文得知,是对射频参数的自适应更新。数据由以太网传输给服务端,应用层对数据进行调用和显示。由前文中的节点和网关的程序流程可知,通信过程中,节点的上行数据包主要有三种,分别为分配请求包、同步请求包和周期采样数据包。具体的数据包结构以表6周期数据包为例,分配请求包和同步请求包与之长度相同,其中节点位后4个字节补零。通过包类型判断数据包的功能,CRC校验位确保数据传输的完整性和正确性。In the networking protocol based on the parameter optimization and update of the link quality evaluation, the LoRa node realizes the collection of industrial equipment information by the physical layer sensor and sends it to the sub-gateway through the SX1276 RF chip, and the sub-gateway forwards the data frame to the gateway MCU for data processing. Store, forward and edge computing. Both the server and the gateway process and calculate data, and perform node management and link quality calculations. As we know from the above, it is an adaptive update of radio frequency parameters. The data is transmitted to the server by Ethernet, and the application layer calls and displays the data. It can be seen from the program flow of the node and the gateway in the previous article that during the communication process, there are mainly three types of uplink data packets of the nodes, which are allocation request packets, synchronization request packets, and periodic sampling data packets. For the specific data packet structure, take the periodic data packet in Table 6 as an example. The allocation request packet and the synchronization request packet have the same length, and the 4 bytes after the node bit are filled with zeros. The function of the data packet is judged by the packet type, and the CRC check bit ensures the integrity and correctness of the data transmission.

表6Table 6

Figure BDA0003673913120000181
Figure BDA0003673913120000181

网关收到节点的分配请求和同步请求后,回复反馈指令,对于周期采样数据,网关只进行数据的存储和处理计算,不进行下行通信。因此,下行通信的数据包主要有三种,分配命令、同步命令和参数更新指令。下行通信的所有数据包长度也是相同的,为了维持TDMA接入方式的准确性,减少通信冲突的发生。以分配数据包结构表7为例,参数更新指令与之相同,同步命令将中间的八个字节换成子网关的RTC时钟信息,包类型区别数据包的功能。After the gateway receives the allocation request and synchronization request from the node, it replies to the feedback command. For the periodic sampling data, the gateway only performs data storage, processing and calculation, and does not perform downlink communication. Therefore, there are mainly three types of data packets for downlink communication, namely allocation commands, synchronization commands and parameter update commands. The length of all data packets in the downlink communication is also the same, in order to maintain the accuracy of the TDMA access method and reduce the occurrence of communication conflicts. Take the allocation data packet structure Table 7 as an example, the parameter update instruction is the same, the synchronization command replaces the middle eight bytes with the RTC clock information of the sub-gateway, and the packet type distinguishes the function of the data packet.

表7Table 7

Figure BDA0003673913120000191
Figure BDA0003673913120000191

除了网关与节点上下行通信的信息协议外,网关与服务器之间是基于TCP/IP协议的数据交互。网关将收到的数据进行处理打包通过网口发送给服务器,服务器对数据进行存储和调用显示。在服务端可以发送下行指令对网关进行参数配置,根据实际应用需求,更改网关的节点容量、采样周期、同步周期、时隙长度等,数据包的格式与上文相似,只是每一位功能不同。In addition to the information protocol for uplink and downlink communication between the gateway and the nodes, the data interaction between the gateway and the server is based on the TCP/IP protocol. The gateway processes and packages the received data and sends it to the server through the network port, and the server stores and calls the data for display. The server can send downlink instructions to configure the parameters of the gateway. According to the actual application requirements, the node capacity, sampling period, synchronization period, time slot length, etc. of the gateway can be changed. The format of the data packet is similar to the above, but the function of each bit is different. .

本实施例中,主要实现了对链路质量的评估,构建基于AWOA-BP神经网络的链路质量评估模型,对比分析了评估的准确性和实用性;根据链路质量的多参数自适应更新的组网方法。In this embodiment, the evaluation of the link quality is mainly realized, the link quality evaluation model based on the AWOA-BP neural network is constructed, and the accuracy and practicability of the evaluation are compared and analyzed; according to the multi-parameter adaptive update of the link quality networking method.

以上所述,仅为本申请较佳的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应该以权利要求的保护范围为准。The above is only a preferred embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any person familiar with the technical field can easily conceive of changes or changes within the technical scope disclosed in this application Replacement should be covered within the protection scope of this application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims (3)

1. A multi-parameter networking method based on edge computing gateway link quality assessment is characterized by comprising the following steps:
collecting sample data and preprocessing the sample data;
the sample data includes: receiving signal strength RSSI, signal-to-noise ratio SNR and packet loss rate PLR, and based on the number of data packets sent by a sending end, recording the RSSI and the SNR when the data packets are received each time by a receiving end, and calculating the PLR;
the process of preprocessing the sample data comprises the following steps: filtering the RSSI and the SNR by adopting a Kalman filtering method;
constructing a link quality evaluation model based on an AWOA-BP neural network, inputting the preprocessed sample data into the link quality evaluation model for training until the output error is reduced to an expected degree or reaches a set learning iteration number, and finishing training to obtain the trained link quality evaluation model;
in the process of training the link quality assessment model, the following steps are included: self-adaptively adjusting the weight based on the current whale population distribution; adaptively adjusting a search strategy based on the fitness probability threshold of the current whale individual;
an edge computing-based LoRa network system is constructed by adopting a mode of combining Carrier Sense Multiple Access (CSMA) and Time Division Multiple Access (TDMA) access;
performing real-time link quality evaluation on the LoRa network based on the trained link quality evaluation model, and identifying the change of the link quality;
carrying out self-adaptive updating on the radio frequency parameters of the LoRa network based on the change of the link quality;
the process of constructing the LoRa network system based on edge calculation by adopting a mode of combining CSMA and TDMA access also comprises the following steps: the LoRa network system adopts a star structure, the star structure comprises a plurality of gateways and a plurality of nodes, and the gateways comprise control sub-gateways, communication sub-gateways and gateway MCU;
and performing node distribution through the control sub-gateway, requesting the receiving and responding of data frames, receiving a data packet through the communication sub-gateway, sending the data packet to the gateway MCU, and performing storage, forwarding and edge calculation on the data packet through the gateway MCU, wherein the data packet comprises a distribution request packet, a synchronization request packet and a periodic sampling data packet.
2. The multi-parameter networking method based on edge computing gateway link quality assessment according to claim 1, wherein in the process of constructing the LoRa network system based on edge computing by adopting a combination of CSMA and TDMA access:
before information transmission, the CSMA reduces communication conflict in a channel monitoring and random back-off mode, wherein the access mode of the CSMA is access in a competition mode;
and dividing time slots through the TDMA, distributing channel resources of multiple nodes based on the divided time slots, and enabling the nodes to occupy channels in respective time slots for communication in a sampling period of the nodes.
3. The multi-parameter networking method based on edge computing gateway link quality assessment according to claim 1, wherein in the process of adaptively updating the radio frequency parameters of the LoRa network system based on the change of the link quality, the change of the link quality is edge computed by the gateway MCU to obtain a radio frequency parameter updating instruction;
sending the radio frequency parameter updating instruction to the control sub-gateway, the communication sub-gateway and the node, and updating corresponding radio frequency parameters, wherein the radio frequency parameters include: frequency and spreading factor, transmit power, and bandwidth.
CN202210614999.3A 2022-06-01 2022-06-01 Multi-parameter networking method based on edge computing gateway link quality evaluation Active CN114928415B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210614999.3A CN114928415B (en) 2022-06-01 2022-06-01 Multi-parameter networking method based on edge computing gateway link quality evaluation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210614999.3A CN114928415B (en) 2022-06-01 2022-06-01 Multi-parameter networking method based on edge computing gateway link quality evaluation

Publications (2)

Publication Number Publication Date
CN114928415A CN114928415A (en) 2022-08-19
CN114928415B true CN114928415B (en) 2023-04-07

Family

ID=82813354

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210614999.3A Active CN114928415B (en) 2022-06-01 2022-06-01 Multi-parameter networking method based on edge computing gateway link quality evaluation

Country Status (1)

Country Link
CN (1) CN114928415B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117834472B (en) * 2023-12-29 2024-09-24 山东中全智通信息科技有限公司 Internet of things card monitoring management method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010069238A1 (en) * 2008-12-19 2010-06-24 中国科学院沈阳自动化研究所 Communication method for mesh and star topology structure wireless sensor network
CN106162844A (en) * 2016-06-03 2016-11-23 西安电子科技大学 Implementation method based on the MAC protocol for wireless sensor networks of LoRa
CN110049562A (en) * 2019-03-13 2019-07-23 中兴克拉科技(苏州)有限公司 A kind of LoRaWAN Internet of Things for supporting TDMA to access
CN112700060A (en) * 2021-01-08 2021-04-23 佳源科技股份有限公司 Station terminal load prediction method and prediction device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110087206B (en) * 2019-04-26 2021-12-21 南昌航空大学 Method for evaluating link quality by adopting generalized regression neural network
GB201914149D0 (en) * 2019-10-01 2019-11-13 Cork Institute Of Tech A method for estimating the uplink data rate in mobile communications
CN111132337B (en) * 2019-12-19 2023-04-07 中科芯集成电路有限公司 Lora communication method combining TDMA (time division multiple Access) and CSMA (Carrier sense multiple Access) mechanisms
US20230177349A1 (en) * 2020-06-01 2023-06-08 Intel Corporation Federated learning optimizations
US20210383207A1 (en) * 2020-06-04 2021-12-09 Ramot At Tel-Aviv University Ltd. Active selection and training of deep neural networks for decoding error correction codes
CN113158543B (en) * 2021-02-02 2023-10-24 浙江工商大学 Intelligent prediction method for software defined network performance

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010069238A1 (en) * 2008-12-19 2010-06-24 中国科学院沈阳自动化研究所 Communication method for mesh and star topology structure wireless sensor network
CN106162844A (en) * 2016-06-03 2016-11-23 西安电子科技大学 Implementation method based on the MAC protocol for wireless sensor networks of LoRa
CN110049562A (en) * 2019-03-13 2019-07-23 中兴克拉科技(苏州)有限公司 A kind of LoRaWAN Internet of Things for supporting TDMA to access
CN112700060A (en) * 2021-01-08 2021-04-23 佳源科技股份有限公司 Station terminal load prediction method and prediction device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于LoRa的农田信息无线采集方案设计;孙天柱等;《计算机测量与控制》(第08期);全文 *
基于贴近度等级的链路质量评估方法;张和杰等;《计算机工程与科学》(第11期);全文 *

Also Published As

Publication number Publication date
CN114928415A (en) 2022-08-19

Similar Documents

Publication Publication Date Title
Correia et al. Transmission power control techniques for wireless sensor networks
Di Marco et al. Modeling IEEE 802.15. 4 networks over fading channels
CN102868598A (en) Control device and control method
Muthanna et al. Cognitive control models of multiple access IoT networks using LoRa technology
Lehong et al. A survey of LoRaWAN adaptive data rate algorithms for possible optimization
CN114928415B (en) Multi-parameter networking method based on edge computing gateway link quality evaluation
Wang et al. Reliability optimization for channel resource allocation in multihop wireless network: A multigranularity deep reinforcement learning approach
Fedullo et al. Adaptive LoRaWAN transmission exploiting reinforcement learning: The industrial case
Sharma et al. Analysing mobile random early detection for congestion control in mobile ad-hoc network
Hazarika et al. iSFA: Intelligent SF Allocation Approach for LoRa-Based Mobile and Static End Devices
Dimakis et al. GreenLoRaWAN: An energy efficient and resilient LoRaWAN communication protocol
Zhang et al. An adaptive distributed scheduling algorithm for ieee 802.15. 4e tsch protocol
Aggarwal et al. QoS based spreading factor assignment for LoRaWAN networks in IoT applications
Guo [Retracted] Low‐Latency and High‐Concurrency 5G Wireless Sensor Network Assists Innovation in Ideological and Political Education in Colleges and Universities
Afroz et al. QX-MAC: Improving QoS and Energy Performance of IoT-based WSNs using Q-Learning
Liu et al. RO‐RAW: Run‐Time Restricted Access Window Optimization in IEEE 802.11 ah Network with Extended Kalman Filter
Chincoli et al. Predictive power control in wireless sensor networks
Lohier et al. A cost function for QoS-aware routing in multi-tier wireless multimedia sensor networks
Sun et al. Confidence interval based model predictive control of transmit power with reliability constraint
Karthisha et al. ContikiMAC for wireless sensor network monitoring application
Rezazadeh et al. Improving fault tolerance of lorawan with predicting packet collision
Kannan Pre-channel scheduling and Priority-based reservation in medium access control for industrial wireless sensor network applications
Rukmani et al. Enhanced channel allocation scheme for cross layer management in wireless network based on interference management
Chen et al. Lmlora: Enhancing link performance for mobile lora networks
Wang et al. A collision-reducible adaptive data rate algorithm for low-cost LoRa gateways

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