A communication switching method for automatic adaptation of multi-protocol alarm terminals
By acquiring the operating status and network information of alarm terminals, and combining a protocol mapping engine and an adaptive deep strategy model, the communication switching problem of multi-protocol alarm terminals in complex network environments is solved, enabling timely delivery of alarm information and energy consumption management, and improving the stability and efficiency of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NANJING JIUWEI INTELLIGENT TECHNOLOGY CO LTD
- Filing Date
- 2025-06-30
- Publication Date
- 2026-05-26
Smart Images

Figure CN120812147B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of communication technology and intelligent control of alarm terminal equipment, and in particular to a communication switching method for automatic adaptation of multi-protocol alarm terminals. Background Technology
[0002] In recent years, with the rapid development of IoT technology, wireless communication technology, and smart terminal technology, various alarm terminals have been widely used in industrial monitoring, security and emergency command. Alarm terminal equipment is usually deployed in application scenarios with complex environments and large network fluctuations. A single communication protocol is difficult to reliably adapt to changing network conditions. Therefore, alarm terminals with multi-protocol communication capabilities have gradually become the trend of technological development.
[0003] Currently, to ensure stable operation of multi-protocol terminals during network fluctuations, existing technologies generally employ hot standby switching based on fixed rules or simple threshold-based switching methods. For example, CN120034422A discloses a switching method for multi-protocol gateway bus communication in mining based on dual-machine hot standby. This method mainly uses a primary / backup hot standby approach, switching between primary and backup machines through a watchdog monitoring signal mechanism. However, it is essentially a static and fixed fault-tolerance mechanism, relying solely on redundant hardware devices for reliability assurance and lacking the ability to proactively adapt to dynamic network environment changes. Furthermore, CN117546526A discloses a communication switching method based on reference signal quality. Although it can dynamically switch based on the signal quality measured by the terminal in real time, this method simply switches communication modes according to priority order and fixed quality thresholds, lacking comprehensive analysis of multi-dimensional information on terminal operating status and network environment. This can easily lead to frequent communication mode switching and excessive terminal power consumption.
[0004] The existing technologies mentioned above have two shortcomings: First, they lack a real-time perception and comprehensive decision-making mechanism for the priority of alarm services, terminal operating status, and dynamic characteristics of the link, which makes it difficult for communication switching strategies to adapt to real-time changes in network conditions and ensure the timely delivery of alarm information. Second, the existing protocol switching judgment criteria and decision-making methods are relatively simple and do not fully consider the energy consumption management of terminal devices and the stability optimization of long-term link operation, which can easily lead to frequent switching, resource waste, and service quality degradation.
[0005] Therefore, existing multi-protocol alarm terminal communication switching technologies suffer from insufficient real-time alarm information delivery and inaccurate protocol switching decisions. This invention obtains current protocol and operating status information, generates a candidate protocol priority list using a protocol mapping engine, and dynamically realizes intelligent protocol switching by comprehensively considering alarm timeliness, terminal energy consumption management, and link stability through a communication switching model. Summary of the Invention
[0006] The purpose of this section is to outline some aspects of the embodiments of the present invention and to briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section, as well as in the abstract and title of the present application, to avoid obscuring the purpose of this section, the abstract and title of the invention. Such simplifications or omissions shall not be used to limit the scope of the present invention.
[0007] In view of the aforementioned existing problems, the present invention is proposed.
[0008] To solve the above technical problems, the present invention provides the following technical solution: The alarm terminal starts the multi-protocol identification module, automatically parses the signaling characteristics of the access network, obtains the currently used protocol identifier, and simultaneously collects link latency, packet loss rate, bandwidth utilization, jitter value and remaining terminal power, and outputs operating status information;
[0009] The protocol mapping engine is invoked, and the protocol identifier is compared with the target protocol set according to the established protocol attribute mapping table to obtain a candidate protocol priority list, and the default port, message format and encryption method of each candidate protocol are recorded.
[0010] The operational status information and the candidate protocol priority list are input into a communication switching model constructed based on a two-layer adaptive depth strategy and incorporating a gray wolf pack search mechanism. The communication switching model prioritizes timely alarm delivery, followed by low energy consumption, and optimizes link stability. It outputs the target protocol and its corresponding decision confidence level. Wherein:
[0011] When the decision confidence level is greater than a preset threshold and the target protocol is different from the currently used protocol, the alarm terminal performs handshake verification, establishes a secure encrypted channel and enables dual-channel mirror transmission according to the priority order, and completes the protocol switching without interrupting the service.
[0012] When the decision confidence level is less than or equal to a preset threshold, the alarm terminal maintains the current protocol and continues to transmit messages, and starts a sliding window counter to monitor the confidence level. If the confidence level monitored within 5 consecutive times still does not exceed the preset threshold, the alarm terminal selects the next protocol according to the candidate protocol priority list, calls the communication switching model again for calculation, and decides whether to perform seamless switching based on the calculation result.
[0013] As a preferred embodiment of the communication switching method for automatic adaptation of multi-protocol alarm terminals described in this invention, the output of operating status information includes:
[0014] Real-time link statistics are obtained at the network interface layer of the alarm terminal, and round-trip latency, packet loss rate, bandwidth utilization and jitter value are recorded respectively.
[0015] The remaining battery power is read from the power management unit of the alarm terminal and converted into a percentage.
[0016] The round-trip time, packet loss rate, bandwidth utilization, jitter value, and remaining battery power are written into the status buffer with a unified timestamp and the sliding time window number is marked.
[0017] When the sliding time window ends, the data in the state buffer is integrated into a complete running state information and sent to the protocol mapping engine.
[0018] As a preferred embodiment of the communication switching method for automatic adaptation of multi-protocol alarm terminals described in this invention, obtaining the currently used protocol identifier specifically includes:
[0019] Listen to the handshake sequence of the access network and analyze the protocol fields in the initial packet header;
[0020] By comparing the default port of the message with the list of preset ports, the protocol type can be initially determined.
[0021] Extract the encryption negotiation information and perform secondary confirmation by combining it with protocol characteristic bytes;
[0022] When the protocol characteristics are unclear, a tentative handshake message is sent and the return code is compared to determine the protocol identifier currently in use.
[0023] As a preferred embodiment of the communication switching method for automatic adaptation of multi-protocol alarm terminals described in this invention, the step of obtaining the candidate protocol priority list includes:
[0024] Using the current protocol identifier as the search key, retrieve a set of compatible target protocols from the protocol attribute mapping table;
[0025] The target protocol set is tested one by one for protocol compatibility, authentication method consistency and encryption algorithm availability, and protocols that do not meet the conditions are eliminated;
[0026] For the remaining protocols, read the historical reliability, average handshake latency, energy consumption, and link stability statistics, and assign weight labels accordingly.
[0027] The remaining protocols are sorted from high to low according to their comprehensive weights to form a priority list of candidate protocols;
[0028] The sorting results are appended with fields for the default port, message format, and available encryption methods for each protocol, and written to the priority buffer for use by the communication switching model.
[0029] As a preferred embodiment of the communication switching method for automatic adaptation of multi-protocol alarm terminals described in this invention, the protocol attribute mapping table includes:
[0030] Extract the protocol name, communication layer, default port, message structure description, and supported encryption algorithms;
[0031] The average handshake latency, maximum payload, power consumption, and link jitter tolerance were measured by packet capture, and the measurement results were recorded.
[0032] The extracted information and measurement results are written to the local database in key-value pairs, and each record is associated with a unique protocol number.
[0033] A multi-level index is created for the local database to support fast queries using protocol name and port number as search keys;
[0034] Define a periodic synchronization mechanism to obtain newly added protocol data packet description files from the alarm management platform weekly, incrementally update the mapping table, and generate version numbers.
[0035] As a preferred embodiment of the communication switching method for automatic adaptation of multi-protocol alarm terminals described in this invention, the output target protocol and corresponding decision confidence level include:
[0036] The communication switching model is used to perform feature encoding on the running status information, and the candidate protocol list is used to perform protocol attribute encoding.
[0037] The score vectors of each candidate protocol are calculated through a two-layer adaptive deep policy network, and the long-term benefits are evaluated by a value network.
[0038] The scoring vector is weighted and fused with the long-term returns to determine the protocol with the highest score as the target protocol.
[0039] Then, based on the score difference of the candidate protocols and the stability of historical decisions, the decision confidence level corresponding to the target protocol is output.
[0040] As a preferred embodiment of the communication switching method for automatic adaptation of multi-protocol alarm terminals described in this invention, the method for constructing the communication switching model includes:
[0041] Collect triples containing state, action, and result as training samples and write them into the offline sample library in chronological order;
[0042] A two-layer adaptive deep policy network is used for offline pre-training to learn the mapping relationship between state and protocol selection;
[0043] A gray wolf pack search mechanism is introduced to dynamically adjust the exploration rate and learning step size of the policy network, thereby improving the global search capability of the communication switching model;
[0044] A pre-trained model is loaded on the alarm terminal side, and online incremental learning is enabled to update the model parameters in real time using an experience cache priority sampling method.
[0045] As a preferred embodiment of the communication switching method for automatic adaptation of multi-protocol alarm terminals described in this invention, the preset threshold specifically includes:
[0046] The communication service level is divided into three levels: emergency alarm, high importance, and general information, with corresponding thresholds set to 0.9, 0.85, and 0.8, respectively.
[0047] The threshold parameters are saved in a configuration file that can be updated remotely, and the alarm terminal loads and takes effect in real time upon startup;
[0048] The alarm terminal calculates the daily accuracy rate of the communication switching model decision and the on-time delivery rate of alarm messages. If the decision accuracy rate is lower than the target value, the corresponding threshold is automatically lowered by 2 percentage points. If the on-time delivery rate is lower than the target value, the corresponding threshold is automatically raised by 2 percentage points.
[0049] The upper and lower limits of the threshold are defined as 0.7 to 0.95. When dynamic adjustment causes the threshold to exceed the upper and lower limits, the alarm terminal stops automatic adjustment and sends a threshold abnormality alarm to the management platform.
[0050] The beneficial effects of this invention are as follows: This invention achieves intelligent dynamic decision-making for multi-protocol communication switching by intelligently sensing the terminal's operating status and network environment, based on a two-layer adaptive depth strategy and a gray wolf group search mechanism. It can respond to network fluctuations in a timely manner, accurately control the protocol switching process, effectively ensure the timely delivery of alarm information, reduce terminal energy consumption, and improve the stability of communication links, thereby comprehensively improving the automatic adaptation capability and overall operating efficiency of multi-protocol alarm terminals under complex network conditions. Attached Figure Description
[0051] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein:
[0052] Figure 1 This is a flowchart illustrating the communication switching method for automatic adaptation of multi-protocol alarm terminals as shown in this invention. Detailed Implementation
[0053] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0054] Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without inventive effort should fall within the scope of protection of this invention.
[0055] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0056] According to an embodiment of the present invention, in combination Figure 1 The flowchart shown illustrates a communication switching method for automatic adaptation of multi-protocol alarm terminals, which specifically includes the following steps:
[0057] S1. The alarm terminal activates the multi-protocol identification module, automatically parses the signaling characteristics of the access network, obtains the currently used protocol identifier, and simultaneously collects link latency, packet loss rate, bandwidth utilization, jitter value, and remaining terminal battery power, outputting operating status information. Note that the following points should be noted in this step:
[0058] Real-time link statistics are obtained at the network interface layer of the alarm terminal, and round-trip latency, packet loss rate, bandwidth utilization and jitter value are recorded respectively.
[0059] The remaining battery power is read from the power management unit of the alarm terminal and converted into a percentage.
[0060] Round-trip time, packet loss rate, bandwidth utilization, jitter value, and remaining battery power are written to the status buffer with a unified timestamp and the sliding time window number is marked.
[0061] When the sliding time window ends, the data in the state buffer is integrated into a complete running state information and sent to the protocol mapping engine.
[0062] It should be noted that the specific methods for integrating operational status information include:
[0063] Read all buffer entries within the current time window and calculate the window average for round-trip latency, packet loss rate, bandwidth utilization, and jitter using a moving average method.
[0064] The latest sampled value is used as the representative value for the battery field, while retaining the low battery indicator;
[0065] The protocol field is deduplicated. If multiple protocol identifiers appear in the window, the one that appears most frequently is taken as the window protocol identifier and the number of times it is switched is recorded.
[0066] Generate an operational status information object containing average link metrics, real-time power consumption, window protocol identifier, and anomaly flags.
[0067] In an optional implementation, obtaining the currently used protocol identifier specifically includes:
[0068] Listen to the handshake sequence of the access network and analyze the protocol fields in the initial packet header;
[0069] By comparing the default port of the message with the list of preset ports, the protocol type can be initially determined.
[0070] Extract the encryption negotiation information and perform secondary confirmation by combining it with protocol characteristic bytes;
[0071] When the protocol characteristics are unclear, a tentative handshake message is sent and the return code is compared to determine the protocol identifier currently in use.
[0072] As an example, methods for analyzing protocol fields in the initial message header include:
[0073] Basic filtering is performed at the link layer, retaining only the data packets from the first frame handshake phase;
[0074] Listen for the first data segment (SEQ=0) of the TCP connection, and listen for the first application layer data segment of the UDP connection;
[0075] Network layer: Parses the IPv4 / IPv6 header, extracting the source address, destination address, and protocol number;
[0076] Transport layer: Read the TCP / UDP header and extract the destination port, flags, and window size;
[0077] Application layer: For TCP data segments, read the first 32 bytes. If there are recognizable text start characters such as "GET / ", "INVITE sip:", or "CONNECT", immediately mark them as candidates for HTTP, SIP, or MQTT.
[0078] For UDP data segments, check the first byte token, such as the "version-type-code" three fields of CoAP, the identifier and flag bits of DNS, and the transaction identifier code of Modbus;
[0079] The parsed key start character and protocol version byte are the "protocol field", and a high confidence flag is generated locally.
[0080] As an example, methods for initially determining the protocol type include:
[0081] Search the local port-protocol mapping table using the destination port as the search key:
[0082] 5683 → CoAP, 1883 → MQTT, 5060 / 5061 → SIP, 502 → Modbus-TCP, 80 → HTTP, 443 → TLS encapsulation protocol (pending secondary confirmation);
[0083] If the port mapping is a unique protocol, the preliminary protocol type is generated directly;
[0084] If mapped to multiple protocols (e.g., 443 corresponds to HTTPS, MQTT over TLS, and AMQP over TLS), then multiple candidate flags are set;
[0085] For example, the list of protocol types includes:
[0086] Specify the ports: CoAP, MQTT, SIP, Modbus-TCP, HTTP, DNS, FTP, and SNMP;
[0087] Multiple candidate ports: TLS (e.g., 443), custom IoT port (e.g., 8883);
[0088] These ports will enter a secondary confirmation phase.
[0089] As an example, methods for secondary confirmation using protocol feature bytes include:
[0090] Parse extended fields for the TLS ClientHello data segment:
[0091] Read the ALPN negotiation value; if the strings "mqtt", "coap", or "amqp" appear, you can confirm the agreement accurately.
[0092] Reading the hostname rules in the SNI field, such as "iot." and "broker.", can indicate the actual protocol service.
[0093] For non-TLS custom encryption, parse the fixed byte sequence of the first frame, such as the 0xABCD prefix identifier of some private UDPs;
[0094] The extracted application layer header field is compared with the protocol feature library item by item:
[0095] The first byte of the MQTT CONNECT control message is 0x10;
[0096] The version number in the first 2 bytes of the CoAP must be 1 and the code field must be less than 32;
[0097] SIP text begins with "REGISTER", "INVITE", and "ACK";
[0098] If the comparison is successful, only the matching protocol will be retained as the sole candidate.
[0099] As an example, the methods for ultimately determining the current protocol identifier include:
[0100] If ambiguity persists after secondary confirmation, the alarm terminal sends a Protocol-Minimum Load Detection Frame to the destination host:
[0101] Send MQTT PINGREQ;
[0102] Send a CoAP empty acknowledgment frame;
[0103] Send SIP OPTIONS;
[0104] Send a Modbus-TCP diagnostic sub-function request;
[0105] Set a timeout timer and wait for a response:
[0106] If a valid response to the corresponding protocol is received (such as MQTT PINGRESP, CoAP ACK, SIP 200OK, Modbus diagnostic response), the protocol is locked.
[0107] If no valid response is received, it is determined to be a TLS-encapsulated private protocol, and the final attribution is determined based on the server certificate subject name. The confirmation result is then written to the protocol field of the status buffer.
[0108] Preferably, this step involves comprehensive real-time perception and analysis of the terminal itself and the network environment to promptly and accurately grasp the current network status and terminal status, facilitating the precise formulation of subsequent handover decisions, thereby improving the real-time performance and reliability of communication handover decisions.
[0109] S2. Invoke the protocol mapping engine. Based on the established protocol attribute mapping table, compare the protocol identifier with the target protocol set to obtain a priority list of candidate protocols. Record the default port, message format, and encryption method of each candidate protocol. Note the following in this step:
[0110] Using the current protocol identifier as the search key, retrieve a set of compatible target protocols from the protocol attribute mapping table;
[0111] The target protocol set is tested one by one for protocol compatibility, authentication method consistency and encryption algorithm availability, and protocols that do not meet the conditions are eliminated;
[0112] For the remaining protocols, read the historical reliability, average handshake latency, energy consumption, and link stability statistics, and assign weight labels accordingly.
[0113] The remaining protocols are sorted from highest to lowest according to their comprehensive weights to form a priority list of candidate protocols;
[0114] The sorting results are appended with fields for the default port, message format, and available encryption methods for each protocol, and written to the priority buffer for use by the communication switching model.
[0115] In an optional implementation, the protocol attribute mapping table includes:
[0116] Extract the protocol name, communication layer, default port, message structure description, and supported encryption algorithms;
[0117] The average handshake latency, maximum payload, power consumption, and link jitter tolerance were measured by packet capture, and the measurement results were recorded.
[0118] The extracted information and measurement results are written to the local database in key-value pairs, and each record is associated with a unique protocol number.
[0119] Multi-level indexes are created for the local database, supporting fast queries using protocol name and port number as search keys;
[0120] Define a periodic synchronization mechanism to obtain newly added protocol data packet description files from the alarm management platform weekly, incrementally update the mapping table, and generate version numbers.
[0121] Preferably, this step, through precise screening and sorting of candidate protocols, enables the terminal to clearly understand the performance differences and applicable scenarios of each protocol, thereby more efficiently selecting the best communication method, effectively avoiding blind selection of communication protocols, and improving protocol switching adaptability and execution efficiency.
[0122] S3. Input the operating status information and the candidate protocol priority list into the communication handover model constructed based on a two-layer adaptive depth strategy and incorporating a gray wolf pack search mechanism. The communication handover model aims to prioritize timely alarm delivery, followed by low energy consumption, and optimize link stability. It outputs the target protocol and its corresponding decision confidence score. Note that the following should be noted in this step:
[0123] S3.1 When the decision confidence level is greater than the preset threshold and the target protocol is different from the currently used protocol, the alarm terminal performs handshake verification, establishes a secure encrypted channel and enables dual-channel mirror transmission according to the priority order, and completes the protocol switching without interrupting the service.
[0124] S3.2 When the decision confidence level is less than or equal to the preset threshold, the alarm terminal maintains the current protocol and continues to transmit messages, and starts a sliding window counter to monitor the confidence level. If the confidence level monitored within 5 consecutive times still does not exceed the preset threshold, the alarm terminal selects the next protocol according to the candidate protocol priority list, calls the communication switching model again for calculation, and decides whether to perform seamless switching based on the calculation result.
[0125] It should be noted that the output target protocol and the corresponding decision confidence level include:
[0126] The operation status information is feature-encoded using a communication switching model, and the candidate protocol list is encoded with protocol attributes.
[0127] The score vectors of each candidate protocol are calculated through a two-layer adaptive deep policy network, and the long-term benefits are evaluated by a value network.
[0128] The highest-scoring protocol is determined by combining the score vector with a weighted average of long-term returns and selecting it as the target protocol.
[0129] Then, based on the score difference of the candidate protocols and the stability of historical decisions, the decision confidence level corresponding to the target protocol is output.
[0130] Furthermore, the construction method of the communication handover model includes:
[0131] Collect triples containing state, action, and result as training samples and write them into the offline sample library in chronological order;
[0132] A two-layer adaptive deep policy network is used for offline pre-training to learn the mapping relationship between state and protocol selection;
[0133] A gray wolf pack search mechanism is introduced to dynamically adjust the exploration rate and learning step size of the policy network, thereby improving the global search capability of the communication switching model;
[0134] A pre-trained model is loaded on the alarm terminal side, and online incremental learning is enabled to update the model parameters in real time using an experience cache priority sampling method.
[0135] Furthermore, the preset thresholds specifically include:
[0136] The communication service level is divided into three levels: emergency alarm, high importance, and general information, with corresponding thresholds set to 0.9, 0.85, and 0.8, respectively.
[0137] The threshold parameters are saved in a configuration file that can be updated remotely, and the alarm terminal loads and takes effect in real time upon startup;
[0138] The alarm terminal calculates the daily accuracy rate of communication switching model decisions and the on-time delivery rate of alarm messages. If the decision accuracy rate is lower than the target value, the corresponding threshold is automatically lowered by 2 percentage points. If the on-time delivery rate is lower than the target value, the corresponding threshold is automatically raised by 2 percentage points.
[0139] The upper and lower limits of the threshold are defined as 0.7 to 0.95. When the dynamic adjustment causes the threshold to exceed the upper and lower limits, the alarm terminal stops automatic adjustment and sends a threshold abnormality alarm to the management platform.
[0140] As an example, the communication switching model constructed in this embodiment is used to output the decision confidence level corresponding to the target protocol, and executes the corresponding process steps by comparing it with a preset threshold. Its mathematical expression formula is as follows:
[0141]
[0142] Θ(B)=0.90ω {B=E} +0.85ω {B=H} +0.80ω {B=G}
[0143]
[0144] Where s(t) is the state vector at time t, containing latency, packet loss rate, bandwidth utilization, jitter value, and remaining battery power, p j Let σ be the attribute vector of the j-th candidate protocol, containing the default port, message format, encryption method, and historical reliability. k (s(t)) is the adaptive regularization weight of the k-th state feature, η jk (p j ) represents the mapping coefficient of the j-th protocol on the k-th dimension attribute, λ is the time reduction factor, and β is the time reduction factor. k Let τ be the self-updating coefficient for the gray wolf search, τ be the decision window length, K be the state attribute coupling dimension, N be the number of candidate protocols, and i be the number of candidate protocols. ★ The protocol index with the highest comprehensive score is the target protocol, Γ is the decision confidence level of the target protocol, B is the communication service level marker, including emergency alarms (E), high importance (H), and general information (G), ω {·} Θ(B) is an indicator function that takes the value 1 if the condition is met and 0 otherwise. Θ(B) is a threshold that is dynamically mapped according to the service level. It corresponds to 0.90 for emergency alarms, 0.85 for high-level important alarms, and 0.80 for general information.
[0145] When Γ>Θ(B), a seamless switch is triggered (step S3.1); otherwise, the current protocol is maintained and monitoring continues (step S3.2).
[0146] It is easy to understand that step S3.1 enables a rapid response and reliable guarantee for the protocol switching process, significantly reduces the risk of service interruption during switching, ensures continuous and reliable transmission of alarm information, and improves the stability and real-time guarantee of the protocol switching process.
[0147] Step S3.2 enables strict control and conditional execution of protocol switching decisions, avoiding frequent protocol switching caused by blind switching under low confidence levels. This effectively improves the stability of system operation and resource utilization efficiency, and enhances the prudence and accuracy of protocol switching decisions.
[0148] Preferably, the method provided in this embodiment inputs the running status information and the candidate protocol priority list into the communication switching model, with the objectives of prioritizing timely delivery of alarm information, followed by low energy consumption, and optimal link stability, and outputs the target protocol and the corresponding decision confidence level. This achieves intelligent dynamic decision-making for protocol selection, combines real-time data with historical experience, takes into account both the timeliness requirements of alarm services and the energy consumption management requirements of the terminal itself, and effectively improves the stability of the communication link, achieving the beneficial effect of multi-objective comprehensive optimization decision-making.
[0149] The aforementioned methods for handshake verification, establishment of secure encrypted channels, and activation of dual-channel mirror transmission can be implemented using existing technologies, and will not be elaborated upon in this example.
[0150] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A communication switching method for automatic adaptation of multi-protocol alarm terminals, characterized in that, include: The alarm terminal activates the multi-protocol identification module, automatically parses the signaling characteristics of the access network, obtains the currently used protocol identifier, and simultaneously collects link latency, packet loss rate, bandwidth utilization, jitter value and remaining terminal power, and outputs operating status information. The protocol mapping engine is invoked, and the protocol identifier is compared with the target protocol set according to the established protocol attribute mapping table to obtain a candidate protocol priority list, and the default port, message format and encryption method of each candidate protocol are recorded. The operational status information and the candidate protocol priority list are input into a communication switching model constructed based on a two-layer adaptive depth strategy and incorporating a gray wolf pack search mechanism. The communication switching model prioritizes timely alarm delivery, followed by low energy consumption, and optimizes link stability. It outputs the target protocol and its corresponding decision confidence level. Wherein: When the decision confidence level is greater than a preset threshold and the target protocol is different from the currently used protocol, the alarm terminal performs handshake verification, establishes a secure encrypted channel and enables dual-channel mirror transmission according to the priority order, and completes the protocol switching without interrupting the service. When the decision confidence level is less than or equal to the preset threshold, the alarm terminal maintains the current protocol and continues to transmit messages, and starts a sliding window counter to monitor the confidence level. If the confidence level monitored within 5 consecutive times still does not exceed the preset threshold, the alarm terminal selects the next protocol according to the candidate protocol priority list, calls the communication switching model again to perform calculation, and decides whether to perform seamless switching based on the calculation result. The method for constructing the communication switching model includes: collecting triples containing state, action, and result as training samples and writing them into an offline sample library in chronological order; using a two-layer adaptive deep policy network for offline pre-training to learn the mapping relationship between state and protocol selection; introducing a gray wolf pack search mechanism to dynamically adjust the exploration rate and learning step size of the policy network to improve the global search capability of the communication switching model; loading the pre-trained model on the alarm terminal side and enabling online incremental learning to update the model parameters in real time using an experience cache priority sampling method. The process of outputting the target protocol and its corresponding decision confidence score includes: using the communication switching model to perform feature encoding on the running state information and protocol attribute encoding on the candidate protocol list; calculating the score vector of each candidate protocol through a two-layer adaptive deep policy network and evaluating the long-term benefits by a value network; weighting and fusing the score vector with the long-term benefits to determine the protocol with the highest score as the target protocol; and then outputting the decision confidence score corresponding to the target protocol based on the score difference between candidate protocols and the historical decision stability. The constructed communication handover model is used to output the decision confidence level corresponding to the target protocol, and executes the corresponding process steps by comparing it with a preset threshold. Its mathematical expression formula is as follows: in, Let be the state vector at time t, containing latency, packet loss rate, bandwidth utilization, jitter value, and remaining battery power. Let j be the attribute vector of the j-th candidate protocol, containing the default port, message format, encryption method, and historical reliability. The adaptive regularization weights for the k-th state feature are... Let be the mapping coefficient of the j-th protocol on the k-th dimension attribute. The time reduction factor, For the gray wolf search self-updating coefficient, K is the decision window length, K is the state attribute coupling dimension, and N is the number of candidate protocols. The protocol index with the highest overall score, i.e., the target protocol. B represents the target protocol decision confidence level, and B represents the communication service level label, including emergency alarm (E), high importance (H), and general information (G). This is an indicator function; it returns 1 if the condition is met, and 0 otherwise. The thresholds are dynamically mapped according to the service level: 0.9 for emergency alarms, 0.85 for high-priority alarms, and 0.8 for general information alarms.
2. The communication switching method for automatic adaptation of multi-protocol alarm terminals according to claim 1, characterized in that, The output running status information includes: Real-time link statistics are obtained at the network interface layer of the alarm terminal, and round-trip latency, packet loss rate, bandwidth utilization and jitter value are recorded respectively. The remaining battery power is read from the power management unit of the alarm terminal and converted into a percentage. The round-trip time, packet loss rate, bandwidth utilization, jitter value, and remaining battery power are written into the status buffer with a unified timestamp and the sliding time window number is marked. When the sliding time window ends, the data in the state buffer is integrated into a complete running state information and sent to the protocol mapping engine.
3. The communication switching method for automatic adaptation of multi-protocol alarm terminals according to claim 1 or 2, characterized in that, Obtain the currently used protocol identifier, specifically including: Listen to the handshake sequence of the access network and analyze the protocol fields in the initial packet header; By comparing the default port of the message with the list of preset ports, the protocol type can be initially determined. Extract the encryption negotiation information and perform secondary confirmation by combining it with protocol characteristic bytes; When the protocol characteristics are unclear, a tentative handshake message is sent and the return code is compared to determine the protocol identifier currently in use.
4. The communication switching method for automatic adaptation of multi-protocol alarm terminals according to claim 1 or 2, characterized in that, The obtained candidate protocol priority list includes: Using the current protocol identifier as the search key, retrieve a set of compatible target protocols from the protocol attribute mapping table; The target protocol set is tested one by one for protocol compatibility, authentication method consistency and encryption algorithm availability, and protocols that do not meet the conditions are eliminated; For the remaining protocols, read the historical reliability, average handshake latency, energy consumption, and link stability statistics, and assign weight labels accordingly. The remaining protocols are sorted from high to low according to their comprehensive weights to form a priority list of candidate protocols; The sorting results are appended with fields for the default port, message format, and available encryption methods for each protocol, and written to the priority buffer for use by the communication switching model.
5. The communication switching method for automatic adaptation of multi-protocol alarm terminals according to claim 4, characterized in that, The protocol attribute mapping table includes: Extract the protocol name, communication layer, default port, message structure description, and supported encryption algorithms; The average handshake latency, maximum payload, power consumption, and link jitter tolerance were measured by packet capture, and the measurement results were recorded. The extracted information and measurement results are written to the local database in key-value pairs, and each record is associated with a unique protocol number. A multi-level index is created for the local database to support fast queries using protocol name and port number as search keys; Define a periodic synchronization mechanism to obtain newly added protocol data packet description files from the alarm management platform weekly, incrementally update the mapping table, and generate version numbers.
6. The communication switching method for automatic adaptation of multi-protocol alarm terminals according to claim 1, characterized in that, The preset threshold specifically includes: The communication service level is divided into three levels: emergency alarm, high importance, and general information, with corresponding thresholds set to 0.9, 0.85, and 0.8, respectively. The threshold parameters are saved in a configuration file that can be updated remotely, and the alarm terminal loads and takes effect in real time upon startup; The alarm terminal calculates the daily accuracy rate of the communication switching model decision and the on-time delivery rate of alarm messages. If the decision accuracy rate is lower than the target value, the corresponding threshold is automatically lowered by 2 percentage points. If the on-time delivery rate is lower than the target value, the corresponding threshold is automatically raised by 2 percentage points. The upper and lower limits of the threshold are defined as 0.7 to 0.
95. When dynamic adjustment causes the threshold to exceed the upper and lower limits, the alarm terminal stops automatic adjustment and sends a threshold abnormality alarm to the management platform.