Multi-terminal gateway connection performance optimization method and system
The SPI high-speed communication drivers and distributed cooperative systems optimize LoRa gateway performance in high-load scenarios, improving communication efficiency and stability by dynamically allocating resources and reducing interference.
Patent Information
- Application Number
- CN202510471280.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-15
- Publication Date
- 2025-07-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing LoRa gateways show obvious performance bottlenecks in high-load connection environments, especially when the number of terminals increases dramatically, it is difficult to ensure communication distance and stable access capabilities at the same time. The traditional gateway architecture cannot efficiently handle multi-terminal connection requests, resulting in a decline in access latency and communication quality.
Through the SPI high-speed communication driver configuration and the 8-channel parallel spread spectrum factor monitoring mechanism, multi-channel frequency resource allocation and dynamic power control are realized, combined with a distributed collaboration system and particle swarm optimization algorithm, resource allocation and beamforming between gateways are optimized, and network status is dynamically adjusted to improve signal coverage and transmission quality.
It improves the concurrent processing capability of the gateway for multiple terminal devices, optimizes spectrum resource utilization, reduces channel interference, ensures stable communication, and extends equipment working time, especially in complex environments and long-distance communication scenarios.
Smart Images

Figure CN120321674A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of gateway performance optimization, and particularly to a method and system for optimizing the connection performance of a multi-terminal gateway. Background Art
[0002] With the explosive growth of Internet of Things applications, LoRa (Long Range), as a low-power wide-area network communication technology, has been widely used in fields such as smart cities, smart industries, and smart agriculture. However, the existing LoRa gateway technology faces many challenges. Currently, LoRa gateways show obvious performance bottlenecks in high-load connection environments. Especially when the number of connected terminals increases sharply, it is difficult for the gateway to ensure both communication distance and stable access capabilities at the same time. This problem seriously restricts the large-scale deployment of the Internet of Things and the expansion of application scenarios.
[0003] Traditional LoRa gateways mainly rely on centralized architectures and static resource allocation strategies, lacking effective software processing mechanisms to handle multi-device access scenarios. At the gateway control level, existing technologies cannot efficiently process multi-terminal connection requests, resulting in increased terminal access latency and degraded communication quality. At the same time, the coverage range and processing capabilities of a single gateway have physical limitations and are difficult to adapt to complex and changing Internet of Things application environments. Especially in areas with severe signal interference or dense terminals, the gateway performance degrades significantly. Summary of the Invention
[0004] This application provides a method and system for optimizing the connection performance of a multi-terminal gateway, thereby realizing the dynamic optimization allocation of resources between gateways, avoiding overloading of a single gateway, and improving the signal coverage range and transmission quality.
[0005] In the first aspect of this application, a method for optimizing the connection performance of a multi-terminal gateway is provided. The method for optimizing the connection performance of a multi-terminal gateway includes: Set the SPI bus parameters of the gateway hardware to obtain an SPI high-speed communication driver configuration, and perform multi-channel frequency resource allocation to obtain multiple channel configuration items; Perform parallel spreading factor monitoring on the multiple channel configuration items to obtain spreading factor dynamic adjustment data; Monitor the gateway network connection status according to the spreading factor dynamic adjustment data to obtain a network status monitoring result; Input the network status monitoring result into a distributed cooperation system for gateway cooperation group division to obtain a gateway resource allocation plan.
[0006] In the second aspect of this application, a system for optimizing the connection performance of a multi-terminal gateway is provided. The system for optimizing the connection performance of a multi-terminal gateway includes: A setting module, configured to set the SPI bus parameters of the gateway hardware to obtain an SPI high-speed communication driver configuration, and perform multi-channel frequency resource allocation to obtain multiple channel configuration items; A listening module, configured to perform parallel spreading factor listening on the multiple channel configuration items to obtain spreading factor dynamic adjustment data; A monitoring module, configured to monitor the gateway network connection status according to the spreading factor dynamic adjustment data to obtain a network status monitoring result; A partitioning module, configured to input the network status monitoring result into a distributed cooperation system to perform gateway cooperation group partitioning to obtain a gateway resource allocation scheme.
[0007] Compared with the prior art, the present application has the following beneficial effects: Through the SPI high-speed communication driver configuration and the 8-channel parallel spreading factor listening mechanism, the concurrent processing ability of the gateway for multiple terminal devices is greatly improved, enabling a single gateway to serve more terminal devices simultaneously, and solving the problem of performance degradation of traditional gateways in high-load scenarios. Based on the multi-channel frequency resource allocation table and the dynamic power control mechanism, fine-grained management of spectrum resources is achieved, the spectrum utilization efficiency is improved, channel interference is reduced, and the gateway can support stable communication of more terminal devices under limited spectrum resources. Through the network connection status monitoring and adaptive adjustment system, network anomalies are detected and responded to in real time, and the optimal network interface is automatically switched to ensure that the gateway maintains a stable network connection in various complex environments and improves the overall reliability of the system. Relying on the distributed multi-gateway cooperation system, based on the stochastic learning automata algorithm and the game theory model, dynamic optimization allocation of resources between gateways is realized, avoiding overloading of a single gateway, balancing the load distribution of the entire network, and improving the overall performance of the system. Through the precise calculation of beamforming parameters by the particle swarm optimization algorithm, signal directional enhancement is achieved, significantly improving the signal coverage range and transmission quality, especially performing well in complex environments and long-distance communication scenarios, and effectively solving the problem of weak signals in edge areas. Based on the dynamic power control and beamforming technologies, the gateway can accurately adjust the transmission power and direction according to the distribution of terminal devices and signal quality, minimizing energy consumption while ensuring communication quality and extending the working time of the device. Description of the Drawings
[0008] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0009] The structures, proportions, sizes, etc. depicted in the accompanying drawings of this specification are only used to cooperate with the content disclosed in the specification for those skilled in this technology to understand and read, and are not used to limit the limiting conditions under which the present invention can be implemented. Therefore, they do not have substantial technical significance. Any modification of the structure, change in the proportional relationship, or adjustment of the size, without affecting the effects that the present invention can produce and the purposes that can be achieved, should still fall within the scope covered by the technical content disclosed in the present invention.
[0010] Figure 1 is a schematic flowchart of a method for optimizing the connection performance of a multi-terminal gateway provided by an embodiment of the present invention; Figure 2 is a schematic block diagram of the structure of a multi-terminal gateway connection performance optimization system provided by an embodiment of the present invention. Detailed implementation manners
[0011] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0012] The flowcharts shown in the accompanying drawings are only illustrative examples, and do not necessarily include all contents and operations / steps, nor do they necessarily need to be executed in the described order. For example, some operations / steps can also be decomposed, combined, or partially merged. Therefore, the actual execution order may be changed according to the actual situation.
[0013] It should also be understood that the terms used in this specification of the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in this specification of the present application and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" are intended to include the plural forms.
[0014] It should be further understood that the term "and / or" used in this specification of the present application and the appended claims refers to any combination and all possible combinations of one or more of the related listed items, and includes these combinations. Please refer to Figure 1 , an embodiment of the method for optimizing the connection performance of a multi-terminal gateway in the embodiments of the present application includes: Step 100: Set the SPI bus parameters of the gateway hardware to obtain an SPI high-speed communication driver configuration, and perform multi-channel frequency resource allocation to obtain multiple channel configuration items; It can be understood that the execution subject of this application can be a multi-terminal gateway connection performance optimization system, or it can also be a terminal or a server, and specific limitations are not made here. In this embodiment of the application, the server is taken as an example of the execution subject for illustration.
[0015] Specifically, the SPI communication rate of the gateway hardware is set. According to the hardware platform used and actual needs, a suitable rate is selected to ensure the stability and high speed of communication. By setting the SPI communication rate, the basic parameters of the SPI bus are determined. A dedicated SPI device node is created for the SX1302 chip based on the basic parameters of the SPI bus. As an important part of the LoRa gateway, the SX1302 chip is responsible for processing tasks related to wireless communication. By creating a dedicated SPI device node, the chip is ensured to work efficiently in SPI communication and to share the SPI bus between multiple devices. The transmission mode is set for the SPI device control structure. The setting of the transmission mode is related to the efficiency of data transmission. Selecting a suitable mode can maximize the communication rate and ensure stable data transmission. By configuring the SPI transmission mode, the processing method of the data stream is optimized to meet the needs of multi-channel communication. According to the selected transmission mode, a dedicated DMA channel is allocated for SPI transmission to obtain a memory access channel mapping. The allocation of DMA channels enables data to be directly transmitted between memory and devices without CPU processing, thereby improving data transmission efficiency and reducing CPU burden. In this process, by allocating a dedicated DMA channel to each channel, fast data transmission is ensured, interference between different devices is avoided, and the overall system performance is improved. Adjust the SPI interrupt priority based on the memory access channel mapping. SPI interrupt is the key mechanism for handling various events that occur during data transmission, and the interrupt priority setting determines how the system responds and handles these events when multiple interrupt events occur. By reasonably adjusting the SPI interrupt priority, it is ensured that various interrupts are efficiently handled in complex multi-device connection scenarios, and the response speed and processing capability of the system are improved. The adjustment of the interrupt priority needs to comprehensively consider the system load, task priority and communication requirements to ensure that the performance will not be degraded due to untimely interrupt processing during data transmission. The interrupt processing configuration is solidified into the system startup script, so that each time the system starts, the SPI communication driver configuration is automatically loaded and effective, avoiding the tediousness and errors of manual configuration, and ensuring the communication efficiency and performance stability each time the system starts. By writing the interrupt processing configuration, SPI transmission mode and DMA channel allocation into the startup script, the SPI high-speed communication driver configuration is obtained to ensure that the system can run with the optimal configuration after startup, thereby reducing the configuration time at system startup and improving the overall efficiency of the system. Multi-channel frequency resource allocation is performed based on the SPI high-speed communication driver configuration, so that in different communication environments, frequency resources are reasonably shared between channels to avoid frequency conflicts and interference. Through reasonable resource allocation, the gateway's processing capacity is effectively improved when multiple devices are connected, so that each device can be stably connected and the communication quality is guaranteed. When performing this task, frequency resources are intelligently allocated according to the system's hardware configuration, the required communication bandwidth, and the connection requirements of the terminal device.Multiple channel configuration items are obtained through multi-channel frequency resource allocation.
[0016] According to the SPI high-speed communication driver configuration, the channels are divided into two groups of physical radio frequency front-ends. The frequency resources of the gateway need to be reasonably divided to ensure signal stability and efficient transmission. During this process, the channels are divided into the radio_0 channel group and the radio_1 channel group. Through division, hardware resources are utilized to avoid resource conflicts, and an independent frequency range is allocated to each group to ensure that each radio frequency front-end can work with optimal performance. The frequency range of the radio_0 channel group is set, with a frequency range from 904.1 MHz to 905.3 MHz and a channel interval of 0.4 MHz. Through this setting, sufficient frequency intervals are ensured between each channel to avoid signal interference. At the same time, a reasonable spectrum is allocated to each channel according to communication requirements to improve the frequency utilization rate of the entire system. At the same time, for the radio_1 channel group, a similar frequency configuration is performed, with the frequency range set to 905.5 MHz to 905.9 MHz and also maintaining a channel interval of 0.4 MHz. This setting is relatively independent of the radio_0 channel group, which helps to optimize frequency resources, ensure that the signals of the two radio frequency front-ends do not interfere with each other, and guarantee the communication quality of each radio frequency front-end. Through the frequency setting and channel interval adjustment of the two physical radio frequency front-ends, effective resource allocation in different frequency bands can be achieved, interference can be reduced, and the overall communication ability can be enhanced. According to the set frequency range, a set of spreading factor (SF) values is specified for each channel. The spreading factor is a key parameter in LoRa communication, which determines the signal modulation method and data transmission rate. According to the first set of frequency allocation parameters (the frequency setting of the radio_0 channel group) and the second set of frequency allocation parameters (the frequency setting of the radio_1 channel group), a set of spreading factor values from SF7 to SF12 is specified for each channel to obtain a signal modulation parameter table. The dynamic power control parameters and channel reception sensitivity offset of the preset power level range are configured for the signal modulation parameter table to obtain signal strength control data. The dynamic power control parameters of the preset power level range can dynamically adjust the transmission power, thereby automatically adjusting the signal strength according to different network environments and communication requirements, and avoiding communication quality problems caused by too weak or too strong signals. The channel reception sensitivity offset is set to adapt to signal attenuation in different environments during signal transmission, ensuring that the signal can be stably detected at the receiving end. Based on the signal strength control data, a signal strength indication compensation coefficient is set to further optimize the signal reception effect. Through fine-tuning of the signal strength, it is ensured that the receiving end accurately decodes the signal, reducing signal attenuation or interference caused by environmental factors, and obtaining multiple channel configuration items.
[0017] Step 200: Conduct parallel spreading factor monitoring on multiple channel configuration items to obtain spreading factor dynamic adjustment data; Specifically, initialize the spreading factor scanning table according to multiple channel configuration items to obtain a set of listening parameters for SF5 to SF12. Initializing the spreading factor scanning table can configure a suitable spreading factor for each channel and efficiently monitor the signals of each channel. Configure each channel according to the initialized spreading factor scanning table to ensure a stable binding relationship between each channel and the radio interface and be able to handle different intermediate frequency offsets. The binding relationship between the radio interface and the channel determines the signal transmission path and method, while the intermediate frequency offset affects the signal frequency adjustment. Based on the set listening parameter set and the binding relationship between the channel and the radio interface, perform parallel scanning on 8 physical channels. At the same time, perform spreading factor listening on multiple channels to improve the overall monitoring efficiency, obtain the mapping relationship of 64 logical channels, and through these mapping relationships, map the signals on multiple physical channels to the logical channels, so that each logical channel corresponds to an optimized spreading factor configuration. This mapping relationship can effectively allocate and manage frequency resources and reduce interference. Analyze the current network load and terminal device distribution according to the logical channel mapping relationship. Determine which combination of channels and spreading factors can provide optimal performance according to the actual network conditions. When the network load is high, some channels will cause a decrease in data transmission efficiency due to congestion, and when the terminal device distribution is uneven, the signal quality in some areas is poor. By analyzing the current network load and terminal device distribution, formulate an SF priority allocation strategy to dynamically adjust the allocation of spreading factors, so as to effectively improve the communication performance of the entire network. Perform conflict detection on the SF priority allocation strategy to ensure that there is no conflict or interference between different logical channels when multiple spreading factors are used in parallel. When multiple spreading factors work in parallel, different signals will interfere with each other in the same frequency band, affecting the communication quality. Through conflict detection, discover and solve these potential interference problems to ensure the stability and efficiency of signal transmission, and obtain an SF conflict data report. Implement time slot scheduling and allocation based on the SF conflict data report, allocate the network load to different time slots, and manage the signal transmission within each time slot according to the priority to avoid resource conflicts, thereby improving the overall efficiency of the system. Through these time slot schedulings, the spreading factor is dynamically adjusted according to the network situation to ensure efficient operation under different load conditions, and obtain spreading factor dynamic adjustment data.
[0018] Step 300: Monitor the gateway network connection status according to the spreading factor dynamic adjustment data to obtain a network status monitoring result; It should be noted that a timing polling mechanism is established based on the dynamic adjustment of the spreading factor data to periodically check the LORA_INTERFACE variable and obtain the changes in the interface status in real time. Through timing polling, the status information of the LORA communication interface is collected regularly and these data are stored in the interface status change record for subsequent analysis and adjustment. The AP_DISABLED flag in the wireless configuration file is detected according to the interface status change record, and this flag is used to indicate the functional status of the wireless network. By detecting the interface status change record, it is judged whether the current wireless communication is working properly, and the network functional status data is extracted accordingly. If it is detected that the AP_DISABLED flag is activated, it indicates that the wireless network function is restricted and further measures need to be taken for recovery or adjustment. Based on the obtained network functional status data, different monitoring strategies are implemented for the three different network interface types of Ethernet (wired Ethernet), WLAN (wireless local area network), and LTE (cellular mobile network). There are significant differences in the reliability, bandwidth, latency, etc. of different network interfaces in actual applications, and targeted strategies are adopted to evaluate their connectivity. For example, for Ethernet, it is judged whether the network is normal by detecting the physical link status and IP address allocation; for WLAN, the stability is evaluated by combining parameters such as signal strength and connection duration; while for LTE, the connection quality is judged by detecting indicators such as cellular signal strength and base station handover frequency. Through the differential monitoring strategy, the connectivity indicators of multiple interfaces are effectively obtained. The failure count statistics is performed on the multi-interface connectivity indicators to obtain the value sequence of the fail_cnt variable. The fail_cnt variable is used to record the number of network connection failures and is updated dynamically over time. If a certain network interface continuously experiences connection failures within a certain time range, the value of the fail_cnt variable will increase accordingly, indicating that there are problems with the stability of this interface and further optimization measures need to be taken. By real-time monitoring the value of the fail_cnt variable, the stability of the network connection is evaluated and the corresponding recovery mechanism is triggered when necessary. The color and blinking mode of the LED indicator are controlled according to the value sequence of the fail_cnt variable to achieve visual output of the status. For example, if the value of the fail_cnt variable is low, the LED light is kept green and on constantly, indicating that the network status is good; if the value of the fail_cnt variable reaches a certain medium level, the LED light is set to blink yellow to prompt the user to pay attention to network fluctuations; while when the value of the fail_cnt variable exceeds the preset high threshold, the LED light is switched to red and set to a fast blinking mode to warn that the network connection has become seriously unstable and fault troubleshooting needs to be carried out immediately. Based on the comparison result between the value sequence of the fail_cnt variable and the preset threshold, the switching operation of the network interface is performed.If the fail_cnt value of a certain network interface continues to rise and exceeds the preset threshold, the network switching mechanism is automatically triggered to switch from the current unstable interface to a more reliable backup interface. For example, when the WLAN connection quality deteriorates, it automatically switches to the Ethernet or LTE network to ensure the continuity of data transmission. The network switching strategy needs to be flexibly adjusted according to the actual application requirements to ensure communication stability in different scenarios. Obtain the network status monitoring results.
[0019] Step 400: Input the network status monitoring results into the distributed collaboration system for gateway collaboration group division to obtain the gateway resource allocation plan.
[0020] Specifically, analyze and extract the network status monitoring results, assign a 32-bit globally unique identifier GWID to each LoRa gateway, and construct a gateway identification database so that each gateway can be uniquely identified in the entire cooperation system, thus avoiding management chaos caused by identification conflicts or duplications. Based on the gateway identification database, broadcast gateway beacon frames containing GWID, load level, signal coverage, and resource margin on the channel to obtain a dynamic list of visible gateways. By regularly broadcasting these beacon frames, each gateway senses other nearby gateways and constructs a real-time gateway visibility list based on this information, recording all mutually visible gateways and their current load status. As the network status changes continuously, the dynamic list of visible gateways will also be updated continuously, thus ensuring the timeliness and accuracy of decision-making data. Establish a non-cooperative zero-sum game model with each gateway as an independent decision-making entity based on the dynamic list of visible gateways, and calculate the utility function matrix of the gateway cooperation group. In this model, each gateway attempts to maximize its own benefits under limited resource conditions, and the calculation of benefits is not only related to factors such as its own load level and signal coverage range but also affected by the strategy choices of other gateways. The calculation of the utility function matrix can quantify the benefits of each gateway under different strategy choices, enabling the gateway to make rational choices based on the mathematical model during decision-making, thereby optimizing the utilization efficiency of overall resources. Based on the calculated utility function matrix of the gateway cooperation group, the gateways exchange real-time status data sets, including key parameters such as CPU occupancy rate, memory usage rate, and the number of currently connected terminals. At the same time, input the real-time status data into the stochastic learning automata algorithm for iterative calculation to obtain the cooperation tendency probability distribution and its maximum benefit threshold for each gateway. The stochastic learning automata algorithm is an adaptive optimization algorithm that approaches the optimal solution by continuously adjusting strategies, enabling the gateway to maintain the optimal cooperation strategy in a dynamic environment. Perform Nash equilibrium calculation on the cooperation tendency probability distribution to determine when to trigger the formation of a cooperation group. When the signal coverage overlap rate exceeds the first target value and the difference in load levels is greater than the second target value, it means that the resource utilization rate of some gateways is low while some gateways are overloaded. In this case, it is necessary to adjust the resource allocation structure. Nash equilibrium calculation ensures that the formation of the cooperation group is carried out under optimal conditions rather than a simple static grouping strategy, thus making flexible adjustments according to the dynamic changes of the actual network environment and finally generating a group formation decision table. Select low-load gateways with a CPU occupancy rate less than the third target value and a memory usage rate less than the fourth target value as the main coordinators according to the group formation decision table to obtain a hierarchical management structure for the cooperation group. The main coordinator is responsible for managing the resource allocation and task scheduling of the entire cooperation group, so its load must be at a low level to ensure the stability of scheduling decisions.Implement a regional division algorithm based on the collaborative group hierarchical management structure, divide the physical space into several non-overlapping monitoring areas, and assign monitoring responsibilities to each gateway according to the spreading factor (SF value), frequency band, and geographical location. Through this step, optimize the spectrum utilization efficiency of the entire LoRa network, so that different gateways undertake different monitoring tasks, thus avoiding resource waste and coverage redundancy. Through this regional division, each gateway is responsible for the monitoring tasks of a specific area, thereby reducing signal conflicts, improving the overall communication efficiency, and finally obtaining an optimal gateway resource allocation scheme.
[0021] Construct the antenna array phase control matrix for each gateway according to the gateway resource allocation scheme, so that each gateway optimizes the propagation direction of its transmitted signal by adjusting the phase, thereby improving the signal quality and communication efficiency. Through this process, the initial model of beamforming is obtained. Convert the initial beamforming model into an N-dimensional parameter search space. Conduct an optimization search through a mathematical model to find the optimal beamforming parameters. Search through the particle swarm optimization algorithm, initialize the state of the particle swarm, and set it as the initial position and velocity of the particles. After the initial state of the particle swarm is established, calculate the position of each particle and calculate the signal-to-interference-plus-noise ratio (SINR) of each particle at the current position. This ratio serves as the fitness function to measure the quality of each particle's position and ensure that the particles search in a better direction. According to the calculation results of the fitness function, record the global optimal position and the individual optimal position in the current iteration. The global optimal position represents the optimal solution in the entire particle swarm, while the individual optimal position is the optimal solution experienced by each particle. Perform the particle velocity and position update calculations based on the global optimal position and the individual optimal position. This calculation is carried out through the update rules of the particle swarm optimization algorithm, and the updated particle swarm enters the next iteration. Through continuous iterative calculations, the state of the particle swarm gradually approaches the optimal solution. For each iteration, recalculate the fitness function at the position of each particle to obtain the new global optimal and individual optimal positions. This process loops continuously until the particle swarm converges to the optimal solution, and finally the optimal set of beamforming parameters is obtained. Apply the optimal beamforming parameter set to the overlapping area between cooperative groups. Based on the current load level, the number of service terminals, and the priority, construct a competitiveness index calculation formula. This formula quantifies the competitiveness of each cooperative group and reflects the relative position of each cooperative group in resource competition. Through this calculation, obtain the spectrum resource competition rankings of each cooperative group and optimize resource allocation accordingly. Allocate resources according to the competitiveness index of the cooperative group to obtain a resource allocation table. For cooperative groups with higher competitiveness, preferentially allocate ideal frequency bands and time slots to ensure that these cooperative groups obtain more resources with less interference to improve the overall performance. For cooperative groups with lower competitiveness, alternative resources will be allocated, sacrificing in terms of spectrum and time slots, but ensuring that they can still communicate normally. Perform dynamic power control for the gateways within the cooperative group based on the resource allocation table, and adjust the transmission power range and directional gain of each gateway according to the terminal device density distribution map and the cross-group interference matrix to obtain the optimal gateway transmission parameters. Through these adjustments, the gateway flexibly adjusts its signal strength under different environmental conditions, avoids excessive interference to other gateways, and improves the signal transmission efficiency.
[0022] In the embodiments of the present application, through the SPI high-speed communication driving configuration and the 8-channel parallel spreading factor listening mechanism, the concurrent processing ability of the gateway for multiple terminal devices is greatly improved, enabling a single gateway to serve more terminal devices simultaneously, and solving the problem of performance degradation of traditional gateways in high-load scenarios. Based on the multi-channel frequency resource allocation table and the dynamic power control mechanism, fine-grained management of spectrum resources is achieved, improving spectrum utilization efficiency, reducing channel interference, and enabling the gateway to support stable communication of more terminal devices under limited spectrum resources. Through the network connection status monitoring and adaptive adjustment system, network anomalies are detected and responded to in real time, and the optimal network interface is automatically switched to ensure that the gateway maintains a stable network connection in various complex environments and improves the overall reliability of the system. Relying on the distributed multi-gateway cooperation system, based on the stochastic learning automata algorithm and the game theory model, dynamic optimization allocation of resources between gateways is realized, avoiding overloading of a single gateway, balancing the load distribution of the entire network, and improving the overall performance of the system. By accurately calculating the beamforming parameters through the particle swarm optimization algorithm, signal directional enhancement is achieved, significantly improving the signal coverage range and transmission quality, especially performing well in complex environments and long-distance communication scenarios, and effectively solving the problem of weak signals in edge areas. Based on the dynamic power control and beamforming technologies, the gateway can accurately adjust the transmission power and direction according to the distribution of terminal devices and signal quality, minimizing energy consumption on the premise of ensuring communication quality and extending the working time of the device.
[0023] In a specific embodiment, the process of executing step 100 may specifically include the following steps: Set the SPI communication rate of the gateway hardware to obtain the basic SPI bus parameters, and create a dedicated SPI device node for the SX1302 chip based on the basic SPI bus parameters to obtain the SPI device control structure; Set the transmission mode for the SPI device control structure to obtain the SPI transmission mode configuration, and allocate a dedicated DMA channel for the SPI transmission according to the SPI transmission mode configuration to obtain the memory access channel mapping; Adjust and set the SPI interrupt priority based on the memory access channel mapping to obtain the interrupt handling configuration; Solidify the interrupt handling configuration into the system startup script to obtain the SPI high-speed communication driving configuration; Execute multi-channel frequency resource allocation based on the SPI high-speed communication driving configuration to obtain multiple channel configuration items.
[0024] Specifically, set the SPl communication rate of the gateway hardware to optimize the timing characteristics of data transmission and ensure that the LoRa gateway can communicate with the SX1302 chip stably and at high speed. The setting of the SPI communication rate depends on the frequency of the hardware clock. For example, if the clock frequency of the main control processor is , the SPI clock frequency is expressed as: Where, represents the communication rate of the SPI bus, is the system clock frequency of the main control processor, and is the division factor, which determines the ratio of the SPI clock to the main clock. When setting the SPl communication rate, ensure that it does not exceed the maximum SPI clock limit of the SX1302 chip, otherwise it will cause data transmission errors or instability. After setting the appropriate SPI clock frequency, based on this rate parameter, build the basic configuration of the SPI bus to ensure reliable data transmission to the SX1302 chip. On the premise of the basic parameters of the SPl bus, create a dedicated SPI device node for the SX1302 chip to manage the low-level communication protocol of SPI and provide a unified interface for device access. When creating the SPI device node, specify the master-slave mode, data bit width, clock polarity (CPOL), and clock phase (CPHA) of SPI. The transmission mode of the SPI device is determined by the combination of CPOL and CPHA. For example: Where, represents the transmission mode number of SPI, represents the clock polarity, with values of 0 or 1, represents the clock phase, with values of 0 or 1. According to different transmission modes, the data sampling and clock edges will be different. Therefore, select the appropriate mode according to the technical documentation of SX1302 to ensure the correctness of SPI communication. After completing the creation of the device node, obtain the SPI device control structure, which is used to store the configuration parameters related to SPI communication and provide an interface to access the SX1302 chip. Configure the transmission mode of the SPI device control structure to optimize the stability and efficiency of data transmission. Setting the transmission mode of SPI can determine the data transmission method, such as full-duplex mode or half-duplex mode. After setting the transmission mode, allocate a dedicated DMA channel for SPI transmission. The DMA (Direct Memory Access) mechanism allows data to be directly transmitted between the main memory and the peripheral device without CPU intervention, thereby greatly reducing the processor load and improving the data transmission efficiency. The allocation of the DMA channel is calculated using the following formula: Where, represents the data throughput rate of DMA, represents the amount of data transmitted, Indicates the time required for data transmission. When allocating the DMA channel, ensure that its priority is higher than that of ordinary I / O access to guarantee the real-time performance of SPI data transmission. After completing the allocation of the DMA channel, obtain the memory access channel mapping, enabling SPI communication to directly utilize the DMA channel for high-speed data transmission without the intervention of additional interrupt handling. Based on the allocated memory access channel mapping, adjust the priority of the SPI interrupt to ensure that the SPI data transmission interrupt is not interfered with by other tasks in the system. The interrupt priority is determined by the interrupt control register or the operating system kernel parameters, and the setting of the priority is described by the following relationship: Wherein, Indicates the final priority of the SPI interrupt, Indicates the default interrupt priority, and Is the adjustment amount relative to the default priority. A higher priority means that the SPI interrupt can be processed faster, reducing the possibility of data loss. Therefore, reasonably set According to the task scheduling strategy of the system to ensure the real-time performance of SPI data transmission. After adjusting the interrupt priority, solidify these configurations into the system startup script so that these parameters can be automatically loaded when the device starts, ensuring that SPI communication can enter an efficient working state immediately after system initialization and obtaining the SPI high-speed communication driver configuration. Based on the SPI high-speed communication driver configuration, perform the allocation of multi-channel frequency resources to support the efficient communication of multiple terminals. The frequency resource allocation of the LoRa gateway involves the parameter setting of multiple channels, including the center frequency, spreading factor (SF), and bandwidth (BW), etc. The selection of the center frequency Follows the following formula: Wherein, Is the starting frequency, Is the channel index, Is the channel interval. To optimize the network performance, allocate different spreading factors (SF), and its calculation formula is as follows: Wherein, Is the data transmission rate, Is the spreading factor, Is the channel bandwidth. A higher SF value provides a longer transmission distance but reduces the data rate. Therefore, reasonably allocate the SF according to the actual application scenario to ensure that the terminal device obtains the best communication quality under different communication requirements.
[0025] In a specific embodiment, the process of performing multi-channel frequency resource allocation based on the SPI high-speed communication driver configuration to obtain multiple channel configuration items may specifically include the following steps: Based on the SPI high-speed communication driver configuration, divide the channels into two groups of physical radio frequency front-ends to obtain the radio_0 channel group and the radio_1 channel group; Set the frequency range from 904.1 MHz to 905.3 MHz and the channel interval of 0.4 MHz for the radio_0 channel group to obtain the first set of frequency allocation parameters; Set the frequency range from 905.5 MHz to 905.9 MHz and the channel interval of 0.4 MHz for the radio_1 channel group to obtain the second set of frequency allocation parameters; Specify the spreading factor value set of SF7 to SF12 for each channel according to the first set of frequency allocation parameters and the second set of frequency allocation parameters to obtain the signal modulation parameter table; Configure the dynamic power control parameters and the channel reception sensitivity offset of the preset power level range for the signal modulation parameter table to obtain the signal strength control data; Set the signal strength indication compensation coefficient based on the signal strength control data to obtain multiple channel configuration items.
[0026] Specifically, in the LoRa gateway, the radio frequency channels are reasonably physically grouped to improve communication efficiency and reduce signal interference. The channels are divided into two groups of physical radio frequency front-ends, namely (i.e., the radio_0 channel group) and (i.e., the radio_1 channel group). This division optimizes the spectrum utilization rate and reduces the performance degradation caused by signal conflicts between different terminals. For the channel group, set its frequency range from 904.1 MHz to 905.3 MHz and set the channel interval to 0.4 MHz to ensure effective signal discrimination. For this frequency division, the center frequency of the th channel is determined by the following formula : Where, MHz is the starting frequency of the first group of channels, MHz is the channel interval, represents the channel number (the value range is ), represents the number of channels in the first group. Thus, the first set of frequency allocation parameters can be obtained, so that each channel has a clear frequency distribution, ensuring that different terminals can communicate normally on different channels without interfering with each other. Similarly, for the Channel group, with its frequency range set between 905.5 MHz and 905.9 MHz, and also using a channel spacing of 0.4 MHz. The center frequency of the second group of channels is calculated as follows: where MHz is the starting frequency of the second group of channels, represents the channel number (value range ), is the number of channels in the second group. Through this step, the frequency allocation parameters of the second group of channels are determined. After completing the channel frequency allocation, appropriate spreading factors (SF) are specified for each channel according to the frequency parameters of the first and second groups to construct a signal modulation parameter table. The choice of spreading factor determines the trade-off between data rate and communication distance. The larger the SF value, the farther the transmission distance, but the lower the data transmission rate. For the SF value of each channel , its data rate is calculated as follows: where represents the data rate of the th channel, is the spreading factor of this channel (value range ), is the channel bandwidth. By reasonably allocating the SF value, ensure that different terminals select appropriate communication parameters according to their transmission distance and rate requirements, so as to achieve load balancing. For example, in , allocate to the terminals far from the gateway to obtain better reception sensitivity, while for the terminals close to the gateway, use to increase the data rate. After the signal modulation parameter table is constructed, configure the dynamic power control parameters within the preset power level range to optimize the transmission power and reduce power consumption. The goal of setting the dynamic power control parameters is to make adaptive adjustments according to the change of channel reception sensitivity. Suppose the received power of a certain terminal on channel is , then its power adjustment formula is expressed as: where is the maximum transmission power, is the power attenuation factor, represents the distance from the terminal to the gateway, is the minimum effective communication distance. When the terminal approaches the gateway, its transmission power will automatically decrease, thereby reducing energy consumption and interference to other channels. And the offset of the channel receiving sensitivity is adjusted to adapt to different environmental noise levels. Receiving sensitivity The calculation method is as follows: Among them, is the reference receiving sensitivity, is the adjustment factor, is the transmission rate of the channel. Ensure that at different SF values and data rates, the receiving end can adjust the signal decoding parameters in the best way to improve the communication quality. After optimizing the signal strength control data, set the signal strength indication compensation coefficient based on these data to optimize the communication performance. Set the signal strength indication compensation coefficient The goal is to ensure the stability of the signal while reducing the imbalance caused by path loss. The calculation method of this coefficient is as follows: Among them, is the adjustment factor, is the transmission power, is the receiving sensitivity. By dynamically adjusting , optimize the signal coverage range so that all terminal devices work within a reasonable signal strength range. Through the above steps, complete configuration items for multiple channels are obtained, including key parameters such as frequency allocation, spreading factor allocation, dynamic power adjustment, and signal compensation optimization.
[0027] In a specific embodiment, the process of executing step 200 may specifically include the following steps: Initialize the spreading factor scanning table according to multiple channel configuration items to obtain a set of listening parameters from SF5 to SF12; Set the configuration parameters for each channel to obtain the binding relationship between each channel and the radio interface and the intermediate frequency offset; Perform parallel scanning on 8 physical channels based on the set of listening parameters and the binding relationship to obtain 64 logical channel mapping relationships; Analyze the current network load and terminal device distribution according to the logical channel mapping relationship to obtain the SF priority allocation strategy; Perform conflict detection on the SF priority allocation strategy to obtain the SF conflict data report, and implement time slot scheduling allocation based on the SF conflict data report to obtain the dynamic adjustment data of the spreading factor.
[0028] Specifically, initialize the spreading factor scanning table according to multiple channel configuration items to construct a set of listening parameters from SF5 to SF12. The spreading factor (SF) determines the modulation method of the LoRa signal and directly affects the data transmission rate and anti-interference ability. When initializing the spreading factor scanning table, the set listening parameters need to cover different spreading factor ranges so that the gateway can dynamically adapt to the needs of different terminals during communication. Assume the total number of channels is , then the spreading factor scanning table is represented by the following formula: Where, represents the spreading factor of the th channel, is the minimum spreading factor, is the step size of the spreading factor, The value range is . Through this formula, the spreading factor scanning table is obtained, enabling the gateway to dynamically monitor the terminal within the range of SF5 to SF12. When initializing the spreading factor scanning table, configure the parameter settings for each channel to obtain the binding relationship between each channel and the radio interface and the intermediate frequency offset. The intermediate frequency offset determines the frequency isolation between different channels to ensure that the signals do not cause excessive interference. Assume the center frequency of the channel is , then the intermediate frequency offset of the channel is calculated as follows: Where, represents the actual frequency of the th channel, is the reference frequency. If is too large, resulting in a too wide signal interval and reducing the spectrum utilization rate, while being too small will lead to increased interference between channels. When binding the radio interface, comprehensively consider the bandwidth supported by the device, modulation parameters, and environmental interference factors, and reasonably configure the intermediate frequency offset of each channel. After completing the channel parameter configuration, based on the set of listening parameters and the binding relationship, perform parallel scanning on 8 physical channels to obtain the mapping relationship of 64 logical channels. The number of physical channels is limited by the hardware, and the logical channels are extended through different frequency and spreading factor combinations. Assume each physical channel can support different spreading factor combinations, then the total number of logical channels is calculated as follows: Where, is the number of physical channels, is the number of spreading factors supported by each physical channel. 8 = 64 logical channels. This mapping relationship ensures that the system monitors multiple signals simultaneously, improves the flexibility of data reception, and reduces the probability of signal conflicts. Based on the logical channel mapping relationship, analyze the current network load and the distribution of terminal devices to formulate an SF priority allocation strategy. The network load is measured using the terminal access density for calculation, and the formula is as follows: Among them, represents the number of terminals in the current area, represents the size of the coverage area. Areas with higher loads need to be preferentially allocated higher spreading factors to ensure sufficient signal coverage, while areas with lower loads use smaller spreading factors to increase data throughput. The calculation method of SF priority is expressed as: Among them, is an adjustment factor used to balance the data rate and coverage. Through this calculation, the priority of the spreading factor is dynamically adjusted so that terminals in different load areas can obtain the best communication effect. After formulating the SF priority allocation strategy, perform conflict detection to generate an SF conflict data report. The core of conflict detection is to calculate the signal interference degree between different channels, using the signal interference ratio to represent: Among them, and respectively represent the received power of channel and channel , is the ambient noise power. When exceeds a certain threshold , it means that there is strong interference between the two channels and adjustment is needed. By calculating the interference situation of all channel pairs, generate an SF conflict data report and adjust the time slot scheduling strategy accordingly. Based on the SF conflict data report, implement time slot scheduling allocation to obtain spreading factor dynamic adjustment data. The goal of time slot scheduling is to optimize the signal transmission timing of different terminals to reduce conflicts and improve the overall network performance. Assuming that the system adopts the TDMA (Time Division Multiple Access) mechanism, the time slot allocation calculation for each terminal is as follows: Among them, represents the time slot length allocated to terminal , is the total number of time slots in the system, represents terminal The transmission power. By reasonably allocating time slots, high-power terminals are given smaller time slots while low-power terminals are given larger time slots to balance network load, reduce data collisions, and improve the stability of data transmission.
[0029] In a specific embodiment, the process of executing step 300 may specifically include the following steps: Dynamically adjust the data establishment timing polling mechanism according to the spreading factor, periodically check the LORA_INTERFACE variable, and obtain the interface status change record; Detect the AP_DISABLED flag in the wireless configuration file according to the interface status change record to obtain the network function status data; Implement a differential monitoring strategy for three interface types, Ethernet, WLAN, and LTE, based on the network function status data to obtain the multi-interface connectivity index; Perform a failure count statistics on the multi-interface connectivity index to obtain the fail_cnt variable value sequence; Control the color and blinking mode of the LED indicator according to the fail_cnt variable value sequence to obtain the status visualization output; Perform network interface switching based on the comparison result between the fail_cnt variable value sequence and the preset threshold to obtain the network status monitoring result.
[0030] Specifically, dynamically adjust the data establishment timing polling mechanism according to the spreading factor to ensure that the system periodically checks the status of the LORA_INTERFACE variable to obtain the interface status change record. The timing polling mechanism sets the scan period through the time interval to make the system perform checks at fixed time intervals. Assume that the time interval for each poll is , and the system performs a check at time , then the next check time is expressed as: where The value of needs to balance the real-time performance of the system and resource occupancy. Too small a will increase the system burden, while too large a will cause a delay in abnormal state detection. Through the timing polling mechanism, the status of the LORA_INTERFACE variable is read within each scan period and the read value is compared with the previously recorded status. If the status changes, the change is recorded in the interface status change log. Detect the AP_DISABLED flag in the wireless configuration file according to the interface status change record to judge the functional status of the current wireless network. Extract the current value of this flag from the configuration file. Assume that this flag variable is denoted as Its value is 0 or 1, where 0 indicates that the wireless function is enabled and 1 indicates that the wireless function is disabled. Then the network function status data is determined by the following logical relationship: If , then , indicating that the wireless function is disabled; if , then , indicating that the wireless function is normally enabled. Through this logical detection, the availability of the wireless network can be grasped in real time. Based on the network function status data, differential monitoring strategies are implemented for three interface types: Ethernet (wired network), WLAN (wireless local area network), and LTE (cellular mobile network) to obtain multi-interface connectivity metrics. Since there are significant differences in connection methods, stability, and latency among different network interfaces, targeted monitoring methods are formulated according to different network characteristics. For Ethernet, by detecting the physical link status variable and the IP address allocation situation to determine whether the network is normal, where the connectivity metric of Ethernet is calculated by the following formula: where, indicates that the physical link connection is normal, indicates that the IP address allocation is successful, and only when both are 1 is Ethernet considered to be normally connected. For WLAN, the signal strength , SSID connection status and data transmission rate are comprehensively considered. The connectivity metric of WLAN is expressed as: where, ranges from 0 to 1 and represents the normalized value of the signal strength, takes the value of 0 or 1 and indicates whether the connection to the SSID is successful, represents the throughput rate of the wireless network. If is too low, it indicates that the WLAN connection quality is poor. For the LTE network, the cellular signal quality and the base station connection stability are evaluated, then the connectivity metric of LTE is calculated as follows: where, represents the signal quality, which is obtained by normalizing the signal-to-noise ratio (SNR) or received signal strength (RSSI), Taking the value 0 or 1 indicates whether the attachment to the base station is successful. After obtaining the connectivity metrics of each network interface, these data are statistically counted for failure to obtain the sequence of values of the fail_cnt variable. Failure counting is cumulatively calculated in the following way: wherein, represents the connectivity metric of the current network interface. If , then remains unchanged, otherwise is incremented by 1. In this way, the failure conditions of the network interface in consecutive polling cycles are statistically counted, and the stability of the interface is judged accordingly. Based on the sequence of values of the fail_cnt variable, the color and blinking mode of the LED indicator are controlled to achieve visual output of the status. Set the color and blinking frequency of the LED indicator as follows: ; ; wherein, and are the set failure count thresholds, is the frequency adjustment coefficient. When is small, the LED is constantly lit green, indicating that the network status is good; when exceeds , the LED becomes yellow and blinks, indicating a network anomaly; when exceeds , the LED becomes red and blinks rapidly, warning of a serious network connection failure. Based on the comparison result between the variable value sequence and the preset threshold, network interface switching is performed to obtain the network status monitoring result. Assuming that the current primary network interface is N and the set of available secondary network interfaces is S, the network switching decision is calculated as follows: That is, when the failure count of the current network interface exceeds the threshold and there are available secondary network interfaces, the system will switch to the secondary interface with the optimal connection quality, otherwise the current network connection status remains unchanged.
[0031] In a specific embodiment, the process of executing step 400 may specifically include the following steps: Parse and extract the network status monitoring result and assign a 32-bit globally unique identifier GWID to each LoRa gateway to obtain the gateway identification database; Broadcast gateway beacon frames containing GWID, load level, signal coverage, and resource margin in the channel based on the gateway identification database to obtain a visible gateway dynamic list; Establish a non - cooperative zero - sum game model with each gateway as an independent decision - making entity according to the visible gateway dynamic list to obtain the gateway cooperation group utility function matrix; Exchange gateway real - time status data sets containing CPU occupancy rate, memory usage rate, and number of connected terminals based on the gateway cooperation group utility function matrix; Input the gateway real - time status data set into the stochastic learning automata algorithm for iterative calculation to obtain the cooperation tendency probability distribution and the maximum revenue threshold of each gateway; Perform Nash equilibrium calculation on the cooperation tendency probability distribution, determine that when the signal coverage overlap rate exceeds the first target value and the load level difference is greater than the second target value, trigger the formation of a cooperation group to obtain a group formation decision table; Select low - load gateways with CPU occupancy rate less than the third target value and memory usage rate less than the fourth target value as the main coordinators according to the group formation decision table to obtain the cooperation group hierarchical management structure; Implement a regional division algorithm based on the cooperation group hierarchical management structure, divide the physical space into several non - overlapping monitoring areas, and assign monitoring responsibilities to each gateway according to SF value, frequency band, and geographical location to obtain the gateway resource allocation plan.
[0032] Specifically, analyze and extract the network status monitoring results, and assign a 32 - bit globally unique identifier to each LoRa gateway , and construct a gateway identification database. The generation method is based on the combination of the physical address, geographical location, and timestamp of the gateway. The specific calculation formula is as follows: Among them, represents the MAC address of the gateway, represents the geographical coordinates of the gateway, represents the timestamp, and is a hash function to ensure that the finally generated identifier is unique. Through this mechanism, each gateway is uniquely identified and stored in the gateway identification database to support subsequent channel communication and resource management. Based on the gateway identification database, embed information including , load level, signal coverage range, and resource margin and other key parameters in the channel broadcast to form a gateway beacon frame, and accordingly construct a visible gateway dynamic list. Suppose the current load level of a certain gateway is , the signal coverage range is , and the resource margin is , then the structure of the beacon frame is represented as: All gateways broadcast their beacon frames periodically, and the gateways that receive these beacons update their dynamic list of visible gateways according to the received broadcast information. : Among them, represents the beacon information of the th visible gateway. This dynamic list reflects the neighbor relationships of the gateways in real time, as well as the load conditions and resource usage of each gateway. After constructing the dynamic list of visible gateways, a non - cooperative zero - sum game model with each gateway as an independent decision - making entity is established to calculate the utility function matrix of the gateway cooperation group. Assume that the gateway set is , where each gateway 's revenue function is jointly determined by the number of its connected terminals , signal coverage and resource margin , then its utility function is expressed as: Among them, are the weights of different parameters, which determine the priorities of the gateways for different resources. For the entire gateway group, its utility function matrix is composed of the revenue functions of each gateway: Based on the utility function matrix of the gateway cooperation group, a real - time gateway status data set containing CPU occupancy rate, memory usage rate, and number of connected terminals is exchanged. Assume that the status data set of a certain gateway is , then it is expressed as: Among them, represents the CPU occupancy rate of gateway , represents the memory usage rate of gateway , and represents the number of terminals connected to gateway . These data will be broadcast to all neighboring gateways so that all gateways can understand each other's resource usage. These real - time data are input into the random learning automata algorithm for iterative calculation to obtain the cooperation tendency probability distribution of each gateway and the maximum revenue threshold . The update formula for the cooperation tendency probability distribution is as follows: Among them, is the learning rate, represents gateway The cooperation probability at the th iteration, while is the benefit threshold for gateway decision-making. After multiple iterations, the system will converge to a stable cooperation probability distribution, enabling each gateway to dynamically adjust its cooperation strategy according to environmental changes. Perform Nash equilibrium calculation on the cooperation tendency probability distribution to determine that when the signal coverage overlap rate exceeds the first target value and the load level difference is greater than the second target value , trigger the formation of a cooperation group and obtain the group formation decision table. The conditions for determining the formation of a cooperation group are: If the above conditions are met, gateway and gateway need to form a cooperation group to optimize load balancing. According to the group formation decision table, select a low-load gateway with a CPU occupancy rate less than the third target value and a memory usage rate less than the fourth target value as the main coordinator , and its selection criteria are as follows: The selected main coordinator is responsible for managing the resource scheduling of the entire cooperation group. Based on the cooperation group hierarchical management structure, implement a regional division algorithm to divide the physical space into several non-overlapping monitoring areas, and allocate monitoring responsibilities to each gateway according to the spreading factor (SF value), frequency band, and geographical location to obtain the final gateway resource allocation plan. Assume that the number of gateways in a certain area is , then the allocation method of the gateway in this area is expressed as: where, is the size of the monitoring area allocated to gateway , and is its corresponding spreading factor value. Each gateway performs the best communication tasks according to its physical location, load situation, and available resources.
[0033] In a specific embodiment, the method for optimizing the connection performance of multi-terminal gateways further includes the following steps: Construct an antenna array phase control matrix for each gateway according to the gateway resource allocation plan to obtain the initial beamforming model, and convert the initial beamforming model into an N-dimensional parameter search space to initialize the initial state of the particle swarm; Calculate the signal interference and noise ratio at each particle position in the initial state of the particle swarm as the fitness function to obtain the global optimal position and individual optimal position of the current iteration; Perform particle velocity and position update calculations based on the global optimal position and the individual optimal position to obtain the state of the particle swarm after iteration, and repeatedly perform fitness calculation and position update on the state of the particle swarm after iteration to obtain the optimal beamforming parameter set; Apply the optimal beamforming parameter set to the overlapping area between cooperation groups, construct a competitiveness index calculation formula based on the current load level, the number of served terminals, and the priority, and obtain the spectrum resource competition ranking of each cooperation group; Implement resource allocation according to the spectrum resource competition ranking, preferentially allocate ideal frequency bands and time slots to cooperation groups with high competitiveness indices, and allocate alternative resources to cooperation groups with low competitiveness indices to obtain a resource allocation table; Perform dynamic power control of the gateways within the cooperation group based on the resource allocation table, and adjust the transmission power range and directional gain of each gateway according to the terminal device density distribution map and the cross-group interference matrix to obtain the optimal gateway transmission parameters.
[0034] Specifically, construct the antenna array phase control matrix of each gateway to optimize the directivity and coverage of wireless signals. Set a gateway antenna array with antenna elements, and its phase control matrix is expressed as: Among them, represents the phase control value of the th antenna element, which is adjusted through an optimization algorithm to achieve the best signal coverage. Based on the gateway resource allocation scheme, the antenna array of each gateway forms an initial beamforming model, which describes the signal gain distribution in different directions. In order to optimize beamforming in the high-dimensional parameter space, the initial model is converted into a -dimensional parameter search space, where is the total number of variables to be optimized, including the phase adjustment and gain adjustment of each antenna element. Set the search space vector as: Initialize the state of the particle swarm of the particle swarm optimization algorithm, where each particle represents a possible beamforming scheme, and the position and velocity of each particle are initialized as follows: Among them, respectively represent the upper and lower limits of the search space, represents the velocity range, is a random number matrix, so that the initial particle swarm has a certain diversity. Calculate the signal-to-interference-plus-noise ratio (SINR) at the position of each particle in the initial state of the particle swarm, and use it as the fitness function. For a certain particle position The corresponding beamforming scheme, its SINR in the target direction is calculated as follows: where represents the transmission power of the gateway ; represents the gain of the antenna array in the target direction, is the noise power, and represents the interference power generated by other gateways. According to the calculated SINR value, evaluate the pros and cons of each particle scheme, and find the global optimal position and the individual optimal position in the current iteration. Based on the global optimal position and the individual optimal position, perform the calculation of particle velocity and position update, so that the particles gradually converge to the optimal solution in the parameter space. The velocity and position update equations of the particles are as follows: where is the inertia weight, is the learning factor, is a random number, represents the individual optimal position. After continuous iteration, the particle swarm converges to the optimal beamforming parameter set. Apply the optimal beamforming parameter set to the overlapping area between cooperative groups, and construct a competitiveness index calculation formula based on the current load level, the number of served terminals, and the priority to measure the resource competition situation of different cooperative groups. The competitiveness index is calculated as follows: where represents the load level of the cooperative group , represents the number of connected terminals, represents the signal coverage priority of this group, is the adjustment coefficient. The cooperative group with a higher competitiveness index should be given priority to obtain the ideal frequency band and time slot in resource allocation, while the cooperative group with a lower competitiveness index is allocated alternative resources. Based on the calculation result of the competitiveness index, implement resource allocation to ensure that the high-competitiveness cooperative group obtains resources first. Set the resource allocation scheme : where is the demarcation threshold of the competitiveness index. After the resource allocation is completed, the dynamic power control of the gateway within the cooperation group is executed to ensure the minimization of cross-group interference, and the transmission power is adjusted according to the density distribution of the terminal devices. Assume that the density of the terminal devices of a certain gateway is , then the transmission power is calculated as: where is the maximum allowable power, and is the adjustment factor. For cross-group interference control, the optimization formula for setting the directional gain is as follows: where is the maximum gain, is the cross-group interference level, and is the control parameter. When the interference is high, the directional gain is automatically reduced to reduce the impact on other gateways.
[0035] The multi-terminal gateway connection performance optimization method in the embodiment of the present application is described above. Next, the multi-terminal gateway connection performance optimization system 10 in the embodiment of the present application will be described. Please refer to Figure 2 , an embodiment of the multi-terminal gateway connection performance optimization system 10 in the embodiment of the present application includes: A setting module 11, configured to set the SPI bus parameters of the gateway hardware to obtain an SPI high-speed communication driver configuration, and perform multi-channel frequency resource allocation to obtain a plurality of channel configuration items; A listening module 12, configured to perform parallel spreading factor listening on a plurality of channel configuration items to obtain spreading factor dynamic adjustment data; A monitoring module 13, configured to monitor the gateway network connection status according to the spreading factor dynamic adjustment data to obtain a network status monitoring result; A partitioning module 14, configured to input the network status monitoring result into a distributed cooperation system for gateway cooperation group partitioning to obtain a gateway resource allocation scheme.
[0036] Through the collaborative cooperation of the above-mentioned various components, by means of the SPI high-speed communication-driven configuration and the 8-channel parallel spreading factor listening mechanism, the concurrent processing ability of the gateway for multiple terminal devices is greatly improved, enabling a single gateway to serve more terminal devices simultaneously, and solving the problem of performance degradation of traditional gateways in high-load scenarios. Based on the multi-channel frequency resource allocation table and the dynamic power control mechanism, fine-grained management of spectrum resources is achieved, improving spectrum utilization efficiency, reducing channel interference, and enabling the gateway to support stable communication of more terminal devices under limited spectrum resources. Through the network connection status monitoring and adaptive adjustment system, network anomalies are detected and responded to in real time, and the optimal network interface is automatically switched to ensure that the gateway maintains a stable network connection in various complex environments and improves the overall reliability of the system. Relying on the distributed multi-gateway cooperation system, based on the stochastic learning automata algorithm and the game theory model, dynamic optimization allocation of resources between gateways is realized, avoiding overloading of a single gateway, balancing the load distribution of the entire network, and enhancing the overall performance of the system. Through the accurate calculation of beamforming parameters by the particle swarm optimization algorithm, signal directional enhancement is achieved, significantly improving the signal coverage range and transmission quality, especially performing well in complex environments and long-distance communication scenarios, and effectively solving the problem of weak signals in edge areas. Based on the dynamic power control and beamforming technologies, the gateway can accurately adjust the transmission power and direction according to the distribution of terminal devices and signal quality, minimizing energy consumption while ensuring communication quality and extending the working time of the device.
[0037] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described systems, systems, and units can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0038] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing an electronic device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.
[0039] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present application.
Claims
1. A method for optimizing the connection performance of a multi-terminal gateway, characterized in that, The method includes: Setting the SPI bus parameters of the gateway hardware to obtain an SPI high-speed communication driver configuration, and performing multi-channel frequency resource allocation to obtain multiple channel configuration items; Performing parallel spreading factor monitoring on the multiple channel configuration items to obtain spreading factor dynamic adjustment data; Monitoring the gateway network connection status according to the spreading factor dynamic adjustment data to obtain a network status monitoring result; Inputting the network status monitoring result into a distributed cooperation system for gateway cooperation group division to obtain a gateway resource allocation scheme.
2. The multi-terminal gateway connection performance optimization method according to claim 1, wherein The setting the SPI bus parameters of the gateway hardware to obtain an SPI high-speed communication driver configuration, and performing multi-channel frequency resource allocation to obtain multiple channel configuration items includes: Setting the SPI communication rate of the gateway hardware to obtain SPI bus basic parameters, and creating a dedicated SPI device node for the SX1302 chip based on the SPI bus basic parameters to obtain an SPI device control structure; Setting a transmission mode for the SPI device control structure to obtain an SPI transmission mode configuration, and allocating a dedicated DMA channel for SPI transmission according to the SPI transmission mode configuration to obtain a memory access channel mapping; Adjusting and setting the SPI interrupt priority based on the memory access channel mapping to obtain an interrupt handling configuration; Solidifying the interrupt handling configuration into the system startup script to obtain an SPI high-speed communication driver configuration; Performing multi-channel frequency resource allocation based on the SPI high-speed communication driver configuration to obtain multiple channel configuration items.
3. The multi-terminal gateway connection performance optimization method according to claim 2, characterized in that The performing multi-channel frequency resource allocation based on the SPI high-speed communication driver configuration to obtain multiple channel configuration items includes: Based on the SPI high-speed communication driver configuration, dividing the channels into two groups of physical radio frequency front-ends to obtain a radio_0 channel group and a radio_1 channel group; Setting a frequency range from 904.1 MHz to 905.3 MHz and a channel interval of 0.4 MHz for the radio_0 channel group to obtain a first set of frequency allocation parameters; Setting a frequency range from 905.5 MHz to 905.9 MHz and a channel interval of 0.4 MHz for the radio_1 channel group to obtain a second set of frequency allocation parameters; Specifying a set of spreading factor values from SF7 to SF12 for each channel according to the first set of frequency allocation parameters and the second set of frequency allocation parameters to obtain a signal modulation parameter table; Configuring dynamic power control parameters and channel reception sensitivity offset amounts within a preset power level range for the signal modulation parameter table to obtain signal strength control data; Setting a signal strength indication compensation coefficient based on the signal strength control data to obtain the multiple channel configuration items.
4. The multi - terminal gateway connection performance optimization method according to claim 1, wherein, The performing parallel spreading factor monitoring on the multiple channel configuration items to obtain spreading factor dynamic adjustment data includes: Initializing a spreading factor scan table according to the multiple channel configuration items to obtain a set of monitoring parameters from SF5 to SF12; Setting configuration parameters for each channel to obtain the binding relationship between each channel and the radio interface and the intermediate frequency offset; Perform parallel scanning on 8 physical channels based on the set of listening parameters and the binding relationship to obtain 64 logical channel mapping relationships; Analyze the current network load and terminal device distribution according to the logical channel mapping relationships to obtain an SF priority allocation strategy; Perform conflict detection on the SF priority allocation strategy to obtain an SF conflict data report, and implement time slot scheduling and allocation based on the SF conflict data report to obtain dynamic adjustment data for the spreading factor.
5. The multi-terminal gateway connection performance optimization method according to claim 1, characterized in that Monitor the gateway network connection status according to the dynamic adjustment data for the spreading factor to obtain network status monitoring results, including: Establish a timing polling mechanism according to the dynamic adjustment data for the spreading factor, periodically check the LORA_INTERFACE variable to obtain interface status change records; Detect the AP_DISABLED flag in the wireless configuration file according to the interface status change records to obtain network function status data; Implement a differential monitoring strategy for three interface types, namely Ethernet, WLAN, and LTE, based on the network function status data to obtain multi-interface connectivity metrics; Perform failure count statistics on the multi-interface connectivity metrics to obtain a sequence of fail_cnt variable values; Control the color and blinking mode of the LED indicator according to the sequence of fail_cnt variable values to obtain a status visual output; Perform network interface switching based on the comparison result between the sequence of fail_cnt variable values and a preset threshold to obtain network status monitoring results.
6. The multi-terminal gateway connection performance optimization method according to claim 1, characterized in that Input the network status monitoring results into a distributed cooperation system for gateway cooperation group division to obtain a gateway resource allocation plan, including: Parse and extract the network status monitoring results and assign a 32-bit globally unique identifier GWID to each LoRa gateway to obtain a gateway identification database; Broadcast gateway beacon frames containing GWID, load level, signal coverage, and resource margin on the channel based on the gateway identification database to obtain a dynamic list of visible gateways; Establish a non-cooperative zero-sum game model with each gateway as an independent decision-making entity according to the dynamic list of visible gateways to obtain a matrix of gateway cooperation group utility functions; Exchange a dataset of gateway real-time statuses containing CPU occupancy rate, memory usage rate, and number of connected terminals based on the matrix of gateway cooperation group utility functions; Input the dataset of gateway real-time statuses into a stochastic learning automata algorithm for iterative calculation to obtain the cooperation tendency probability distribution and maximum revenue threshold for each gateway; Perform Nash equilibrium calculation on the cooperation tendency probability distribution, and determine that when the signal coverage overlap rate exceeds a first target value and the load level difference is greater than a second target value, trigger the formation of a cooperation group to obtain a group formation decision table; Select a low-load gateway with a CPU occupancy rate less than a third target value and a memory usage rate less than a fourth target value as the main coordinator according to the group formation decision table to obtain a hierarchical management structure for the cooperation group; Implement a regional division algorithm based on the collaborative group hierarchical management structure, divide the physical space into several non-overlapping monitoring areas, and assign monitoring responsibilities to each gateway according to the SF value, frequency band, and geographical location to obtain a gateway resource allocation scheme.
7. The multi-terminal gateway connection performance optimization method according to claim 1, wherein The multi-terminal gateway connection performance optimization method further includes: Construct an antenna array phase control matrix for each gateway according to the gateway resource allocation scheme to obtain an initial beamforming model, and convert the initial beamforming model into an N-dimensional parameter search space to initialize the initial state of the particle swarm; Calculate the signal-to-interference-plus-noise ratio at each particle position for the initial state of the particle swarm as a fitness function to obtain the global optimal position and individual optimal position of the current iteration; Perform particle velocity and position update calculations based on the global optimal position and individual optimal position to obtain the state of the particle swarm after iteration, and repeat the fitness calculation and position update for the state of the particle swarm after iteration to obtain an optimal beamforming parameter set; Apply the optimal beamforming parameter set to the overlapping area between collaborative groups, construct a competitiveness index calculation formula based on the current load level, number of service terminals, and priority to obtain the spectrum resource competition ranking of each collaborative group; Implement resource allocation according to the spectrum resource competition ranking, preferentially allocate ideal frequency bands and time slots to collaborative groups with high competitiveness indices, and allocate alternative resources to collaborative groups with low competitiveness indices to obtain a resource allocation table; Perform dynamic power control of the gateways within the collaborative group based on the resource allocation table, and adjust the transmission power range and directional gain of each gateway according to the terminal device density distribution map and the cross-group interference matrix to obtain optimal gateway transmission parameters.
8. A multi-terminal gateway connection performance optimization system, characterized in that For implementing the multi-terminal gateway connection performance optimization method according to any one of claims 1-7, the multi-terminal gateway connection performance optimization system includes: A setting module for setting the SPI bus parameters of the gateway hardware to obtain an SPI high-speed communication driver configuration and performing multi-channel frequency resource allocation to obtain multiple channel configuration items; A listening module for performing parallel spreading factor listening on the multiple channel configuration items to obtain spreading factor dynamic adjustment data; A monitoring module for monitoring the gateway network connection status according to the spreading factor dynamic adjustment data to obtain a network status monitoring result; A division module for inputting the network status monitoring result into a distributed collaboration system for gateway collaboration group division to obtain a gateway resource allocation scheme.
Citation Information
Cited By
Internet of things card equipment grouping optimization method and system based on network state awareness
CN121396795A