Message processing method and device, computer equipment and readable storage medium
By using a pre-trained protocol type prediction model and a self-attention mechanism, multiple message protocols in the acquisition of power grid metering automation energy data are dynamically identified and converted, solving the problem of low efficiency in traditional methods and achieving efficient multi-protocol data processing and communication optimization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-18
- Publication Date
- 2026-04-10
AI Technical Summary
In traditional power grid metering automation for electrical energy data acquisition, the variety of equipment types and the complexity of communication protocols result in low message processing efficiency, making it impossible to effectively cope with the complex and ever-changing needs of real-world scenarios.
A pre-trained reduction type prediction model combined with a self-attention mechanism is used to dynamically identify message reduction types. The message is then converted into formatted data through the self-attention mechanism. The self-attention mechanism is used to perform weighted fusion and formatting transformation of the formatted data, and reinforcement learning is combined to optimize communication parameters.
It improves message processing efficiency, enables adaptive fusion and unified processing of multi-protocol data, and enhances communication efficiency between devices and system robustness.
Smart Images

Figure CN121842272A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet of Things (IoT) technology, and in particular to a message processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Technology
[0002] In the field of power grid metering automation and energy data acquisition, the types of equipment involved are diverse, and the types and versions of communication protocols used are extremely complex. For message processing using multiple protocols, traditional methods mainly rely on manual pre-configuration of message parsing rules or on fixed rules built into the system to identify and process messages of different protocols, in order to complete the conversion process from one communication protocol to another and ensure that messages can be transmitted and processed accurately between different systems or devices.
[0003] However, with the increasing diversification of equipment types in the power grid and the rapid iteration and updating of communication protocol types and versions, traditional communication protocol conversion methods have gradually revealed problems such as low adaptation efficiency, resulting in low message processing efficiency, and are unable to effectively cope with the complex and ever-changing needs of actual scenarios. Summary of the Invention
[0004] Therefore, it is necessary to provide a message processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve message processing efficiency in response to the above-mentioned technical problems.
[0005] Firstly, this application provides a message processing method, including:
[0006] Obtain the messages to be processed;
[0007] Based on a pre-trained protocol type prediction model, the protocol type of a message is predicted to obtain the predicted protocol type and the message feature vector.
[0008] Based on the self-attention mechanism, formatted data corresponding to the message is obtained according to the message prediction reduction type and message feature vector;
[0009] The communication parameters are determined based on the current communication status, and the formatted data is sent to the target receiving end according to the communication parameters so that the target receiving end can perform business processing based on the formatted data.
[0010] In one embodiment, based on a pre-trained reduction type prediction model, reduction type prediction is performed on the message to obtain the predicted reduction type and message feature vector, including:
[0011] Obtain a pre-built specification knowledge graph, and match the message header in the message using the specification knowledge graph to obtain the initial specification type of the message;
[0012] Based on the field structure parsing rules corresponding to the preliminary specification type, the unstructured data in the message is processed to obtain the semantic features of the message;
[0013] By using a pre-trained protocol type prediction model, the protocol type is predicted based on semantic features, field structure parsing rules, and the message, resulting in the predicted protocol type and message feature vector.
[0014] In one embodiment, based on the field structure parsing rules corresponding to the preliminary specification type, the unstructured data in the message is processed to obtain the semantic features of the message, including:
[0015] Determine the field structure parsing rules corresponding to the preliminary specification type, and determine the unstructured data in the message based on the field structure parsing rules;
[0016] Semantic features are extracted from unstructured data to obtain the semantic features of the message.
[0017] In one embodiment, a pre-trained reduction type prediction model is used to predict the reduction type of the message based on semantic features, field structure parsing rules, and the message itself, resulting in the predicted reduction type and message feature vector, including:
[0018] By using the convolutional neural network model in the pre-trained reduction type prediction model, spatial features are extracted based on semantic features, field structure parsing rules, and the message to obtain message spatial features;
[0019] By using the Long Short-Term Memory Network model in the specification type prediction model, temporal features are extracted based on semantic features, field structure parsing rules, and messages to obtain message temporal features;
[0020] The protocol type prediction model obtains the message feature vector based on the message spatial and temporal characteristics, and then performs protocol type prediction on the message feature vector to obtain the predicted protocol type of the message.
[0021] In one embodiment, based on a self-attention mechanism, formatted data corresponding to the message is obtained according to the message's prediction reduction type and message feature vector, including:
[0022] Based on the self-attention mechanism, the weights corresponding to the prediction reduction type are determined according to the prediction reduction type and the message feature vector.
[0023] Intermediate features are obtained by using the weights corresponding to the prediction protocol types and the message feature vectors.
[0024] Data cleaning is performed based on intermediate features to obtain target features, and then formatted and transformed based on the target features to obtain formatted data corresponding to the message.
[0025] In one embodiment, the message processing method further includes:
[0026] The original samples are determined based on historical messages, and new samples are constructed based on the original samples using an adversarial generative network.
[0027] Training samples are obtained based on the original samples and the newly added samples;
[0028] Following the multi-task meta-learning training method, a reduction type prediction model is trained using training samples to obtain a pre-trained reduction type prediction model.
[0029] Secondly, this application also provides a message processing apparatus, comprising:
[0030] The message acquisition module is used to acquire messages to be processed.
[0031] The reduction prediction module is used to predict the reduction type of a message based on a pre-trained reduction type prediction model, and obtain the predicted reduction type and message feature vector of the message.
[0032] The formatted data acquisition module is used to obtain the formatted data corresponding to the message based on the message prediction reduction type and message feature vector, using a self-attention mechanism.
[0033] The formatted data processing module is used to determine communication parameters based on the current communication status and send formatted data to the target receiving end according to the communication parameters, so that the target receiving end can perform business processing based on the formatted data.
[0034] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the method provided in the first aspect above.
[0035] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method provided in the first aspect above.
[0036] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps in the method provided in the first aspect above.
[0037] The aforementioned message processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product, based on a pre-trained protocol type prediction model, predicts the protocol type of a message to obtain the predicted protocol type and message feature vector. Based on a self-attention mechanism, it obtains formatted data corresponding to the message based on the predicted protocol type and message feature vector. Communication parameters are determined according to the current communication state, and the formatted data is sent to the target receiving end according to the communication parameters, so that the target receiving end can perform business processing based on the formatted data. During message processing, dynamic protocol recognition can be achieved through the pre-trained protocol type prediction model, and the message can be converted into corresponding formatted data based on the self-attention mechanism. This eliminates the need for pre-configured message parsing rules for recognition and processing, thereby improving message processing efficiency. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0039] Figure 1 This is an application environment diagram of a message processing method in one embodiment;
[0040] Figure 2 This is a flowchart illustrating a message processing method in one embodiment;
[0041] Figure 3 This is a flowchart illustrating the specification type prediction process in one embodiment;
[0042] Figure 4 This is a structural block diagram of a message processing apparatus in one embodiment;
[0043] Figure 5 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0045] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0046] The message processing method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, power equipment 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. This data storage system can be integrated onto server 104 or located in the cloud or on other network servers. Server 104 can also communicate with target receiver 106 via the network. Server 104 can obtain messages to be processed sent by power equipment 102. Based on a pre-trained protocol type prediction model, server 104 can predict the protocol type of the message, obtaining the predicted protocol type and message feature vector. Based on a self-attention mechanism, it obtains the formatted data corresponding to the message based on the predicted protocol type and message feature vector. Server 104 can determine communication parameters according to the current communication state and send the formatted data to target receiver 106 according to the communication parameters, so that target receiver 106 can perform business processing based on the formatted data.
[0047] Among them, power equipment 102 may include various power devices that support the protocol, such as Southern Power Grid 0907 protocol energy meters, temperature and humidity sensors, etc. Server 104 may be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services. Target receiving end 106 may be the master station system in the power grid system, such as a central server cluster deployed in a provincial / municipal power grid company, which is responsible for a central management system that collects, analyzes, and controls data from all network devices.
[0048] In one exemplary embodiment, such as Figure 2 As shown, a message processing method is provided. This method is executed by a computer device, specifically by a terminal or server alone, or by both a terminal and a server. In this embodiment, the method is applied to... Figure 1 Taking the server in the example, the explanation includes the following steps 202 to 208. Wherein:
[0049] Step 202: Obtain the message to be processed.
[0050] A message / packet refers to a structured data unit transmitted between devices, containing control commands, service data, and verification information. A message may include a header, payload, checksum, and end-of-message character. The header may identify metadata such as protocol type and data length; specifically, it may include a start character (0xEB) and a command code (0x01). The payload carries service data (such as voltage / current values); specifically, it may include a voltage value of 13B8h (5048mV). The checksum ensures transmission integrity; it may include a checksum D20D. The end-of-message character marks the end of the message; it may include a carriage return character (0x0D).
[0051] Optionally, the server can obtain messages that need to be processed. These messages can come from electrical equipment in the power system, such as messages sent to the server by meters or sensors.
[0052] Step 204: Based on the pre-trained protocol type prediction model, perform protocol type prediction on the message to obtain the predicted protocol type and message feature vector.
[0053] In industrial communication, such as in the power Internet of Things (IoT), a protocol refers to a set of rules for data transmission between devices. This can include syntax rules, semantic rules, and interaction timing. Syntax rules describe message structure (e.g., start characters, length, data field definitions); semantic rules define field meaning mappings (e.g., 0x0001 represents a voltage value); and interaction timing defines the communication flow, such as the interaction sequence of master station request → meter response. Protocols can be categorized into different types, such as power grid-specific protocols and general IoT protocols based on communication scenarios, or binary protocols and text protocols based on technical architecture.
[0054] The reduction type prediction model can be pre-trained based on historical messages with different reductions, such as by jointly constructing a Convolutional Neural Network (CNN) and a Long Short-Term Memory (LSTM) network. This model can predict the reduction type of a message. For example, it can extract the message's feature vector and then predict the reduction type based on this feature vector. The message feature vector, extracted from the message, characterizes the reduction properties of the message, thus allowing the prediction of the corresponding reduction type.
[0055] For example, the server can obtain a pre-trained reduction type prediction model and use it to predict the reduction type of a message. For instance, the server can input a message into the reduction type prediction model to obtain the predicted reduction type and message feature vector. In some embodiments, the predicted reduction type of the message can be directly output by the reduction type prediction model, and the message feature vector can be extracted from the model. For example, the message feature vector can be extracted from the reduction type prediction model during the process of predicting the reduction type of a message. In some embodiments, the server can obtain at least one message. When multiple messages need to be processed, the server can use the pre-trained reduction type prediction model to predict the reduction type of each message separately, so as to obtain the predicted reduction type and message feature vector for each message respectively.
[0056] Step 206: Based on the self-attention mechanism, obtain the formatted data corresponding to the message according to the message prediction reduction type and message feature vector.
[0057] Formatted data refers to standardized business data obtained through self-attention weighted fusion, which may include structured combinations of {business semantics: values, quality labels}. The business semantics in the formatted data are unified to eliminate specification differences; the value range of the formatted data is standardized, with consistent units / precision / range; and quality labels are used to identify data credibility. Based on formatted data, message data with different specifications can be decoupled into a unified semantic expression. For example, binary / JSON (JavaScript Object Notation) message data can be decoupled into a unified semantic expression to simplify message data reading complexity, eliminate semantic ambiguity caused by specification differences, and enhance data credibility.
[0058] Optionally, the server can fuse the message feature vectors of the message based on a self-attention mechanism to construct formatted data corresponding to the message. In some embodiments, the server can determine the corresponding weights based on the prediction reduction type of the message, fuse the message feature vectors of the message according to the weights, and perform formatting transformation based on the fused intermediate features to obtain the formatted data corresponding to the message.
[0059] Step 208: Determine communication parameters based on the current communication status, and send formatted data to the target receiving end according to the communication parameters so that the target receiving end can perform business processing based on the formatted data.
[0060] The current communication status can be determined based on dynamic changes in the current communication environment and real-time communication quality feedback. Communication parameters are transmission control variables dynamically optimized by the system based on the current communication status, used to ensure reliable transmission of formatted data. These parameters may include, but are not limited to, at least one of the following: timeout threshold, retransmission strategy, and link selection. The target receiver can perform service processing on the service data carried in the message. For example, the target receiver may include the master station system in the power grid system, specifically including an energy management system, monitoring and data acquisition system, or electricity metering platform.
[0061] For example, the server can determine the current communication state and, based on this state, determine the communication parameters. For instance, the server can dynamically optimize communication parameters, such as timeout thresholds and retransmission strategies, based on reinforcement learning (RL) algorithms, considering dynamic changes in the communication environment and real-time communication quality feedback. The server can then send formatted data to the target receiver according to the communication parameters, allowing the target receiver to perform various business processes based on the formatted data, such as power grid status monitoring, fault diagnosis, load forecasting, and energy efficiency optimization.
[0062] In the aforementioned message processing method, a pre-trained protocol type prediction model is used to predict the protocol type of the message, obtaining the predicted protocol type and message feature vector. Based on a self-attention mechanism, formatted data corresponding to the message is obtained according to the predicted protocol type and message feature vector. Communication parameters are determined based on the current communication state, and the formatted data is sent to the target receiver according to the communication parameters, so that the target receiver can perform business processing based on the formatted data. During message processing, dynamic protocol recognition can be achieved through the pre-trained protocol type prediction model, and the message can be converted into corresponding formatted data based on the self-attention mechanism. This eliminates the need for pre-configured message parsing rules for recognition and processing, thereby improving message processing efficiency.
[0063] In one exemplary embodiment, such as Figure 3 As shown, the protocol type prediction process, which involves predicting the protocol type of a message based on a pre-trained protocol type prediction model, and obtaining the predicted protocol type and message feature vector, includes steps 302 to 306. Wherein:
[0064] Step 302: Obtain the pre-built specification knowledge graph, and match the message header in the message using the specification knowledge graph to obtain the preliminary specification type of the message.
[0065] The protocol knowledge graph can be obtained by integrating and associating common IoT protocols and power grid communication protocols (Southern Power Grid 2013 Protocol, 0907 Protocol, 102 Protocol) using knowledge graph technology. IoT protocols can include, but are not limited to, HTTP (Hypertext Transfer Protocol) and MQTT (Message Queuing Telemetry Transport). The preliminary protocol type is the result of a preliminary protocol type determination based on the message header.
[0066] Optionally, the server can obtain a constructed specification knowledge graph, which records the message structure, feature fields, and semantic rules of various types of specifications. The server can match the message headers in the message based on the specification knowledge graph. Specifically, the server can determine the initial specification type of the message by comparing the message header features using the specification knowledge graph. For example, the server can match the Southern Power Grid 0907 specification template from the specification knowledge graph based on the 0xEB start character in the message header, thereby determining the initial specification type as Southern Power Grid 0907.
[0067] Step 304: Based on the field structure parsing rules corresponding to the preliminary specification type, process the unstructured data in the message to obtain the semantic features of the message.
[0068] In multi-protocol dynamic recognition, field structure parsing rules can serve as a message decoding dictionary to decompose unstructured byte streams into semantic fields according to the protocol template, thereby obtaining information such as field position, length, data type, and conversion formula. Field structure parsing rules can include components such as a start identifier (a special byte at the beginning of the message), an instruction code mapping table (enumerated interpretation of operation instructions), field position mapping (the offset and length of a value in the message), data type conversion (the formula for converting raw bytes to actual values), and verification rules (the checksum calculation algorithm). Field structure parsing rules can be used to process unstructured data in messages to obtain semantic features. Unstructured data can be natural language text or semi-structured data fields in the message that lack fixed format constraints, such as XML (Extensible Markup Language) / JSON format data. Semantic features can be obtained by extracting features from unstructured data using Natural Language Processing (NLP) technology, and semantic features can characterize the protocol characteristics corresponding to the unstructured data.
[0069] For example, the server can determine the field structure parsing rules corresponding to the initial specification type. Different types of specifications can correspond to different field structure parsing rules. The server can process the unstructured data in the message according to the field structure parsing rules corresponding to the initial specification type. For example, the server can parse the unstructured data from the message according to the determined field structure parsing rules and extract semantic features from the unstructured data to obtain the semantic features of the message.
[0070] Step 306: Using a pre-trained specification type prediction model, the specification type is predicted based on semantic features, field structure parsing rules, and the message, resulting in the predicted specification type and message feature vector.
[0071] The pre-trained reduction type prediction model can predict the reduction type based on semantic features, field structure parsing rules, and the message, and output the predicted reduction type of the message. The message feature vector can be extracted from the reduction type prediction model during the reduction type prediction process.
[0072] Optionally, the server can obtain a pre-trained reduction type prediction model and input semantic features, field structure parsing rules, and the message into the reduction type prediction model so that the model can predict the reduction type and output the predicted reduction type of the message. The server can also extract the message feature vector from the reduction type prediction model during reduction type prediction. That is, the reduction type prediction model can obtain the message feature vector after feature processing based on semantic features, field structure parsing rules, and the message, and then perform reduction type prediction based on the message feature vector to output the predicted reduction type of the message.
[0073] In this embodiment, the server matches the message header in the message with a specification knowledge graph to obtain the preliminary specification type of the message, and processes the unstructured data in the message based on the field structure parsing rules corresponding to the preliminary specification type to obtain the semantic features of the message. Then, it uses a pre-trained specification type prediction model to predict the specification type, which can realize dynamic identification of message specifications without the need to pre-configure message parsing rules for identification and processing, thereby improving message processing efficiency.
[0074] In an exemplary embodiment, based on the field structure parsing rules corresponding to the preliminary specification type, unstructured data in the message is processed to obtain the semantic features of the message, including: determining the field structure parsing rules corresponding to the preliminary specification type, and determining the unstructured data in the message according to the field structure parsing rules; extracting semantic features from the unstructured data to obtain the semantic features of the message.
[0075] For example, the server can determine the corresponding field structure parsing rules based on the preliminary specification type, and parse the message according to the field structure parsing rules to obtain unstructured data from the message. The server can extract semantic features from the obtained unstructured data, such as by using natural language processing (NLP) techniques to extract semantic features from the unstructured data to obtain the semantic features of the message. In some embodiments, when extracting semantic features from unstructured data, the server can use NLP techniques to parse semantic information such as field meaning, data type, and unit to obtain the semantic features of the message. For example, the server can use a dependency parser to extract field dependency relationships from the unstructured data and identify core semantic nodes to obtain a structured semantic tree; the server can use a pre-trained model to annotate the speech units in the structured semantic tree, such as by annotating field roles and matching domain dictionaries based on the BERT-SRL (BERT-based semantic role annotation) model; for annotated semantic units, the server can perform unit system conversion and value range constraint checks to obtain the semantic features of the message.
[0076] In this embodiment, the server determines unstructured data from the message through the field structure parsing rules corresponding to the preliminary specification type, and extracts semantic features from the unstructured data to obtain the semantic features of the message. Based on the field structure parsing rules, the server can accurately determine unstructured data and extract semantic features that represent the core features of different specification data. This helps to improve the accuracy of specification type prediction based on semantic features, thereby improving message processing efficiency.
[0077] In an exemplary embodiment, a pre-trained reduction type prediction model is used to predict the reduction type of the message based on semantic features, field structure parsing rules, and the message, thereby obtaining the predicted reduction type and message feature vector. This includes: using a convolutional neural network model in the pre-trained reduction type prediction model to extract spatial features based on semantic features, field structure parsing rules, and the message, thereby obtaining message spatial features; using a long short-term memory network model in the reduction type prediction model to extract temporal features based on semantic features, field structure parsing rules, and the message, thereby obtaining message temporal features; and using the reduction type prediction model to obtain message feature vectors based on message spatial features and message temporal features, and then performing reduction type prediction on the message feature vectors to obtain the predicted reduction type of the message.
[0078] The pre-trained reduction type prediction model can include convolutional neural network models and long short-term memory network models. Message spatial features can be extracted using convolutional neural network models, and these features can characterize local correlations in the data. Message temporal features can be extracted using long short-term memory network models, and these features can characterize the evolution of the reduced data over time.
[0079] Optionally, the server can acquire a pre-trained reduction type prediction model, which may include a jointly trained convolutional neural network model and a long short-term memory network model. The server can extract spatial features based on semantic features, field structure parsing rules, and the message structure using the convolutional neural network model. For example, it can utilize the various convolutional and pooling layers in the convolutional neural network model to extract spatial features of the message. The server can also extract temporal features based on semantic features, field structure parsing rules, and the message structure using the long short-term memory network model, obtaining temporal features of the message. The server can fuse the spatial and temporal features of the message using the reduction type prediction model to obtain the message feature vector. Furthermore, the server can predict the reduction type of the message based on the message feature vector using the reduction type prediction model, thereby obtaining the predicted reduction type of the message.
[0080] In this embodiment, the server extracts message spatial features through a convolutional neural network model and message temporal features through a long short-term memory network model. Based on the message spatial features and message temporal features, the server obtains the message feature vector and performs reduction type prediction on the message feature vector to obtain the predicted reduction type of the message. The reduction features can be extracted from multiple dimensions, which ensures the accuracy of reduction type prediction and thus improves message processing efficiency.
[0081] In an exemplary embodiment, based on a self-attention mechanism, formatted data corresponding to a message is obtained according to the message's prediction reduction type and message feature vector. This includes: determining the weight corresponding to the prediction reduction type based on the message's prediction reduction type and message feature vector; obtaining intermediate features according to the weight corresponding to the prediction reduction type and message feature vector; performing data cleaning based on the intermediate features to obtain target features; and performing formatting transformation on the target features to obtain formatted data corresponding to the message.
[0082] The weights corresponding to the predicted protocol types can be used to characterize the importance of different protocol features in the communication task. Intermediate features can be obtained by weighted fusion of the message feature vectors according to their respective weights. Target features can be obtained by cleaning the intermediate features, such as removing noise and outliers from the intermediate features.
[0083] For example, the server can use a self-attention mechanism to obtain the weights corresponding to the prediction reduction type of the message based on the message's prediction reduction type and feature vector. For instance, since there may be multiple messages, for each message's feature vector, the server can calculate the weight of each feature vector based on the prediction reduction type and the feature vector using the self-attention mechanism. The server can then weight and fuse the corresponding message feature vectors according to the weights corresponding to the prediction reduction type to obtain intermediate features. The server can perform data cleaning on the intermediate features, such as using clustering algorithms to identify outliers and replacing abnormal values with the moving average of historical data from similar devices, thereby obtaining the target features. The server can then perform formatting transformations on the target features, such as converting the target features into JSON / XML formatted data.
[0084] In this embodiment, the server determines the weights corresponding to the prediction protocol types based on the self-attention mechanism, and fuses the message feature vectors of different prediction protocol types according to the weights to obtain intermediate features. After data cleaning, the obtained target features are formatted and converted to obtain formatted data corresponding to the message. In this way, the features of multiple protocols can be adaptively fused into a unified data format, solving the problem of multi-protocol data aggregation and improving data integration efficiency.
[0085] In an exemplary embodiment, the message processing method further includes: determining original samples based on historical messages, and constructing new samples based on the original samples using a generative adversarial network; obtaining training samples based on the original samples and the new samples; and training a reduction type prediction model using the training samples in a multi-task meta-learning training manner to obtain a pre-trained reduction type prediction model.
[0086] Historical packets can be those transmitted in the business system throughout history, and original samples can be collected from historical packets. New samples can be constructed based on generative adversarial networks and can be used as augmentation data for the original samples. Training samples can be used as training data for reduction-type prediction models.
[0087] Optionally, the server can obtain historical messages and determine the original samples based on them. For example, the server can sample from historical messages to obtain the original samples. The server can use a Generative Adversarial Network (GAN) to perform data augmentation on the original samples to construct new samples. In some embodiments, the server can use a GAN to simulate and construct diverse communication environments with different protocols to perform data augmentation on the original samples, thereby constructing new samples. The server can obtain training samples based on the original and new samples, and train a protocol type prediction model based on the training samples. In some embodiments, the server can train the protocol type prediction model using a multi-task meta-learning training method, obtaining a pre-trained protocol type prediction model. Through multi-task meta-learning training, common features (such as message header structure patterns) can be extracted from historical messages to quickly adapt to the distribution of new protocol features.
[0088] In this embodiment, the server constructs new samples based on the original samples through an adversarial generative network, and trains the protocol type prediction model using the original samples and new samples in accordance with the multi-task meta-learning training method. This can improve the generalization ability of the protocol type prediction model in unknown protocol scenarios, enabling it to better cope with various communication protocols and device types that have not been encountered before by utilizing the knowledge and experience it has learned, thereby enhancing the overall adaptability and versatility of the system.
[0089] This application also provides an application scenario in which the above-described message processing method is applied. Specifically, the message processing method is applied in this scenario as follows:
[0090] In the scenario of automated power grid metering and energy data acquisition, there are numerous types of equipment, communication protocols, and versions. Traditional communication protocol conversion relies on manual configuration or fixed rules, resulting in low adaptation efficiency and poor flexibility. Existing technologies, such as protocol conversion gateways, can achieve partial protocol interoperability, but cannot dynamically adapt to protocol changes or the access of new equipment. In addition, insufficient multi-source data fusion and device generalization capabilities lead to difficulties in cross-domain device collaboration. Therefore, traditional protocol conversion solutions require pre-configured rules, cannot cope with dynamically changing device protocol environments, and suffer from high data heterogeneity, poor real-time performance, and insufficient fault recovery capabilities. Based on this, the message processing method provided in this application can achieve intelligent adaptive multi-protocol adaptation, and combine machine learning technology to achieve dynamic recognition and fusion. Specifically, machine learning is used to achieve dynamic protocol recognition, feature fusion, and adaptive adjustment, thereby improving communication efficiency between devices and system robustness.
[0091] Specifically, the processing of multi-reduction dynamic recognition and feature extraction includes:
[0092] 1. Construction of Protocol Library: Integrate the message structure, feature fields and semantic rules of common IoT protocols (such as HTTP and MQTT) and power grid communication protocols (Southern Power Grid 2013 Protocol, 0907 Protocol, and 102 Protocol), and use knowledge graph technology to associate and integrate protocol information to form a complete protocol knowledge graph, providing a detailed and comprehensive knowledge foundation for subsequent protocol identification.
[0093] 2. Real-time parsing and feature extraction: At the communication data receiving end, the protocol type is initially determined by analyzing the key information in the message header (such as length, checksum, instruction code, etc.) in real time. At the same time, natural language processing (NLP) technology is combined to perform in-depth parsing of unstructured data (such as XML / JSON format data) in the message, extracting semantic features that can characterize the core features of different protocol data, laying the foundation for accurate protocol identification and classification in the future.
[0094] 3. Machine Learning Model: A machine learning model jointly constructed using Convolutional Neural Networks (CNN) and Long Short-Term Memory Networks (LSTM) is employed. The convolutional and pooling layers of the CNN extract spatial features from the reduced feature vectors, capturing local correlations in the data. The memory units of the LSTM learn the temporal features of the data, grasping the evolutionary patterns of the reduced data over time. Through multi-level feature learning, high-precision prediction of the reduction type and sensitive detection of anomalies in communication data are achieved, ensuring the quality and reliability of communication data.
[0095] Furthermore, the adaptive feature fusion and adaptation optimization process includes:
[0096] 1. Dynamic weighted aggregation: Based on the self-attention mechanism, it automatically assigns corresponding weights to different feature classes according to their importance in the current communication task, adaptively integrating features of multiple features into a unified data format, solving the problem of multi-feature data aggregation and improving data integration efficiency.
[0097] 2. Edge Computing Optimization: Deploy lightweight machine learning models at key nodes of the protocol conversion to achieve rapid cleaning and processing of real-time data. For example, use outlier clustering correction algorithms to remove noise and outliers from the data; at the same time, perform flexible data format conversion to meet the requirements of subsequent transmission and processing, optimizing the data flow efficiency of the entire communication link.
[0098] 3. Adaptive Parameter Adjustment: Leveraging reinforcement learning (RL) algorithms, communication parameters (such as timeout thresholds and retransmission strategies) are dynamically optimized based on dynamic changes in the communication environment and real-time communication quality feedback. Furthermore, combined with efficient fault self-healing mechanisms, such as automatic link switching and temporary data buffering, the system comprehensively enhances its adaptability and robustness to complex environments, ensuring continuous and stable communication.
[0099] In addition, for generalization enhancement processing, including:
[0100] 1. Meta-learning framework: The multi-task meta-learning (MAML, Model-Agnostic Meta-Learning) framework is introduced to train the model, enabling the model to learn general feature representations and patterns from communication data of many different specifications and device types. This allows the model to quickly adapt to and accurately process communication data when faced with small samples of new specifications and new device scenarios, significantly shortening the model's adjustment cycle for new scenarios.
[0101] 2. Cross-domain knowledge transfer: Generative Adversarial Networks (GANs) are used to simulate and construct diverse communication environments with different protocols, broadening the training and learning scope of the model. In this way, the model's generalization ability in unknown protocol scenarios is improved, enabling it to better cope with various communication protocols and device types that have not been encountered beforehand by utilizing learned knowledge and experience, thereby enhancing the overall adaptability and versatility of the system.
[0102] In some embodiments, a protocol library is first initialized, specifically by acquiring sample information and manually annotating to construct a protocol knowledge base that stores message structure, instruction sets, and semantic rules. When training the protocol type prediction model, a CNN-LSTM joint model is trained using historical messages to optimize the cross-entropy loss function. Meta-learning is performed based on the MAML framework to simulate new protocol access scenarios and improve generalization. During real-time adaptation, the feature vectors extracted from messages sent by power equipment are obtained by the protocol parsing module and input into the protocol type prediction model to predict the protocol type. The dynamic weighted aggregation module generates formatted data, which is forwarded to the target receiver via edge computing nodes. Furthermore, the communication status can be monitored to trigger parameter adjustments or fault recovery mechanisms (such as switching to redundant links).
[0103] The message processing method provided in this application, based on a meta-learning multi-protocol dynamic adaptation framework, can solve the generalization problem in small-sample scenarios. By integrating edge computing and reinforcement learning, it can achieve adaptive optimization of communication parameters and rapid fault recovery. A multi-level feature fusion strategy is proposed, which, combined with semantic analysis and machine learning, can improve data compatibility. Specifically, the message processing method provided in this application supports the dynamic recognition and conversion of mainstream power grid equipment communication protocols, effectively improving adaptation speed and exhibiting strong protocol compatibility. Moreover, the edge computing module achieves millisecond-level data processing, significantly shortening fault recovery time to ensure real-time performance and stability. Furthermore, in scenarios with unknown protocols, the model exhibits high recognition accuracy, low data fusion error, and strong generalization ability.
[0104] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0105] Based on the same inventive concept, this application also provides a message processing apparatus for implementing the message processing method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more message processing apparatus embodiments provided below can be found in the limitations of the message processing method described above, and will not be repeated here.
[0106] In one exemplary embodiment, such as Figure 4 As shown, a message processing apparatus 400 is provided, including: a message acquisition module 402, a protocol prediction module 404, a formatted data acquisition module 406, and a formatted data processing module 408, wherein:
[0107] Message acquisition module 402 is used to acquire messages to be processed;
[0108] The protocol prediction module 404 is used to predict the protocol type of the message based on a pre-trained protocol type prediction model, and obtain the predicted protocol type and message feature vector of the message.
[0109] The formatted data acquisition module 406 is used to obtain formatted data corresponding to the message based on the prediction reduction type and message feature vector of the message, using a self-attention mechanism.
[0110] The formatted data processing module 408 is used to determine communication parameters according to the current communication status, and send the formatted data to the target receiving end according to the communication parameters, so that the target receiving end can perform business processing based on the formatted data.
[0111] In some embodiments, the reduction prediction module 404 is further configured to acquire a pre-constructed reduction knowledge graph, match the message header in the message using the reduction knowledge graph to obtain the preliminary reduction type of the message; process the unstructured data in the message based on the field structure parsing rules corresponding to the preliminary reduction type to obtain the semantic features of the message; and predict the reduction type of the message based on the semantic features, the field structure parsing rules, and the message using a pre-trained reduction type prediction model to obtain the predicted reduction type and message feature vector of the message.
[0112] In some embodiments, the protocol prediction module 404 is further configured to determine the field structure parsing rules corresponding to the preliminary protocol type, and determine the unstructured data in the message according to the field structure parsing rules; and perform semantic feature extraction on the unstructured data to obtain the semantic features of the message.
[0113] In some embodiments, the reduction prediction module 404 is further configured to: extract spatial features of a message based on the semantic features, the field structure parsing rules, and the message using a convolutional neural network model in a pre-trained reduction type prediction model; extract temporal features of a message based on the semantic features, the field structure parsing rules, and the message using a long short-term memory network model in the reduction type prediction model; and obtain a message feature vector based on the message spatial features and the message temporal features using the reduction type prediction model, and perform reduction type prediction on the message feature vector to obtain the predicted reduction type of the message.
[0114] In some embodiments, the formatted data acquisition module 406 is further configured to determine the weight corresponding to the prediction reduction type based on the prediction reduction type and the message feature vector of the message, based on a self-attention mechanism; obtain intermediate features according to the weight corresponding to the prediction reduction type and the message feature vector; perform data cleaning based on the intermediate features to obtain target features, and perform formatting transformation on the target features to obtain formatted data corresponding to the message.
[0115] In some embodiments, a model training module is further included, which is used to determine the original samples based on historical messages and construct new samples based on the original samples through an adversarial generative network; obtain training samples based on the original samples and the new samples; and train the reduction type prediction model through the training samples in a multi-task meta-learning training manner to obtain the pre-trained reduction type prediction model.
[0116] Each module in the aforementioned message processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0117] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows. Figure 5 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a message processing method.
[0118] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0119] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0120] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0121] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0122] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0123] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0124] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0125] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A message processing method, characterized in that, The method includes: Obtain the messages to be processed; Based on a pre-trained reduction type prediction model, the reduction type of the message is predicted to obtain the predicted reduction type and message feature vector. Based on the self-attention mechanism, formatted data corresponding to the message is obtained according to the prediction reduction type and message feature vector of the message; Based on the current communication status, the communication parameters are determined, and the formatted data is sent to the target receiving end according to the communication parameters, so that the target receiving end can perform business processing based on the formatted data.
2. The method according to claim 1, characterized in that, The pre-trained reduction type prediction model predicts the reduction type of the message to obtain the predicted reduction type and message feature vector, including: Obtain a pre-constructed specification knowledge graph, and match the message header in the message using the specification knowledge graph to obtain the preliminary specification type of the message; Based on the field structure parsing rules corresponding to the preliminary specification type, the unstructured data in the message is processed to obtain the semantic features of the message; By using a pre-trained reduction type prediction model, the reduction type is predicted based on the semantic features, the field structure parsing rules, and the message, resulting in the predicted reduction type and message feature vector of the message.
3. The method according to claim 2, characterized in that, The process, based on the field structure parsing rules corresponding to the preliminary specification type, processes the unstructured data in the message to obtain the semantic features of the message, including: Determine the field structure parsing rules corresponding to the preliminary specification type, and determine the unstructured data in the message based on the field structure parsing rules; Semantic features are extracted from the unstructured data to obtain the semantic features of the message.
4. The method according to claim 2, characterized in that, The pre-trained reduction type prediction model predicts the reduction type of the message based on the semantic features, the field structure parsing rules, and the message itself, obtaining the predicted reduction type and message feature vector, including: The convolutional neural network model in the pre-trained reduction type prediction model is used to extract spatial features based on the semantic features, the field structure parsing rules, and the message to obtain message spatial features; Using the Long Short-Term Memory Network model in the specification type prediction model, temporal features are extracted based on the semantic features, the field structure parsing rules, and the message to obtain the message temporal features. The protocol type prediction model obtains a message feature vector based on the message spatial features and the message temporal features, and performs protocol type prediction on the message feature vector to obtain the predicted protocol type of the message.
5. The method according to claim 1, characterized in that, The step of obtaining formatted data corresponding to the message based on the self-attention mechanism, according to the message's prediction reduction type and message feature vector, includes: Based on the self-attention mechanism, the weight corresponding to the prediction reduction type is determined according to the prediction reduction type of the message and the message feature vector; The intermediate features are obtained according to the weights corresponding to the prediction protocol type and the message feature vector; Data cleaning is performed based on the intermediate features to obtain target features, and formatting conversion is performed on the target features to obtain formatted data corresponding to the message.
6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: The original samples are determined based on historical messages, and new samples are constructed based on the original samples using a generative adversarial network. Training samples are obtained based on the original samples and the newly added samples; The reduction type prediction model is trained using the training samples according to the multi-task meta-learning training method, and the pre-trained reduction type prediction model is obtained.
7. A message processing apparatus, characterized in that, The device includes: The message acquisition module is used to acquire messages to be processed. The reduction prediction module is used to predict the reduction type of the message based on a pre-trained reduction type prediction model, and obtain the predicted reduction type and message feature vector of the message. The formatted data acquisition module is used to obtain formatted data corresponding to the message based on the message's prediction reduction type and message feature vector, using a self-attention mechanism. The formatted data processing module is used to determine communication parameters based on the current communication status, and send the formatted data to the target receiving end according to the communication parameters, so that the target receiving end can perform business processing based on the formatted data.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.