Protocol identification method, device, medium and terminal for distributed power source access to power grid

By identifying the response type and protocol scope of the received message, and using preset protocol identification model analysis, the problem of low protocol identification efficiency in distributed power access grid is solved, and more efficient protocol identification and management is achieved.

CN119341959BActive Publication Date: 2025-03-21ZHEJIANG XINXIANG ELECTRONIC TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411885574.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-03-21
Estimated Expiration
2044-12-20

AI Technical Summary

Technical Problem

In the prior art, when distributed power supplies are connected to the power grid, protocol identification efficiency is low, resulting in complex management and high operation and maintenance costs.

Method used

By obtaining the received messages and their response types sent by the distributed power control device, determining the protocol scope and inputting them into the preset protocol identification model for analysis, thereby accurately identifying the protocol used by the control device.

Benefits of technology

Improves the accuracy and efficiency of protocol identification, simplifies management processes and reduces operation and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119341959B_ABST
    Figure CN119341959B_ABST
Patent Text Reader

Abstract

The present application provides a protocol identification method, device, medium and terminal for distributed power supply access to the power grid, which belongs to the field of communication technology. The method includes: obtaining a first received message and a response type sent by a distributed power supply control device, the response type including a passive type and an active type; determining a protocol range corresponding to the first received message based on the response type; inputting the first received message and the protocol range into a preset first protocol identification model for analysis, and obtaining a first analysis result within the protocol range; determining the protocol used by the distributed power supply control device based on the first analysis result. The present application can improve the recognition accuracy and efficiency of the protocol used by the control device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a protocol identification method, device, medium and terminal for accessing a distributed power source to a power grid. Background Art

[0002] With the gradual development of clean energy and the continuous advancement of energy transformation, distributed power sources have been widely used in power systems. A communication protocol module is provided on the distributed power access terminal (such as a "distributed power access unit", "distributed power acquisition and control device", referred to as the "access terminal" in this application). The access terminal communicates with the control device of the distributed power source (referred to as the "control device") through the communication protocol module. Through the forwarding of the distributed power access terminal, the control device of the distributed power source and the main station / substation of the power grid can be safely interacted. Distributed power control equipment mainly includes photovoltaic inverters, wind turbine inverters and their supporting metering equipment meters, etc. The communication interface standards of these control devices usually adopt RS485, RS232, RJ45 and other standards. In terms of communication protocols, common ones include standard Modbus-RTU protocol, custom protocols based on standard Modbus-RTU protocol, DL645 protocol, DL698 protocol, etc.

[0003] Due to the wide variety of types and specifications of distributed power control devices, different types of control devices have different protocols for accessing the power grid. Even if they are based on the same protocol, they will have different custom fields and meanings. This diversity leads to the complexity of power grid management and operation and maintenance.

[0004] For example, in actual operation, common message formats are inconsistent, involving definitions such as start and end bits, device addresses, function codes, data fields, and check bits, and the length of the bits is different. Traditional processing methods usually require manual identification of protocols or use polling device addresses for identification. These methods are not only cumbersome, but also have low identification efficiency. For example, CN116320062A provides a protocol adaptation method between a photovoltaic protocol converter and a photovoltaic inverter, which specifically continuously sends standard messages with an address field of 01-247 through the downstream interface of the protocol converter. After receiving a reply to a certain address, the protocol adaptation message with the above address as the address field is sent one by one, and the protocol is determined based on the continuous register data content as the judgment mark to determine whether the protocol is correctly identified, where the adaptive message comes from the protocol library. Finally, the multi-vendor modbus protocol adaptation is completed. CN117749900A provides a photovoltaic equipment communication protocol adaptive method, specifically, physically connecting the photovoltaic control device with the photovoltaic inverter, matching the communication rate from 2400bit / s to 115200bit / s, sending the standard modbus protocol with a fixed register address starting from the lowest serial port rate, and if there is no response from the standard protocol, then changing the protocol from the protocol library and sending one by one. After traversing the protocol library, the multi-protocol automatic matching is finally completed.

[0005] In order to solve these problems and improve the efficiency and management level of distributed power generation access to the power grid, a more efficient protocol self-identification method and module is urgently needed to simplify the management process and reduce operation and maintenance costs. Summary of the invention

[0006] The object of the present invention is to provide a protocol identification method, device, medium and terminal for accessing a distributed power source to a power grid, so as to solve at least one of the above technical problems.

[0007] In a first aspect of the present application, a protocol identification method for accessing a distributed power source to a power grid is provided, the method comprising:

[0008] Acquire a first received message and a response type sent by a distributed power supply control device, wherein the response type includes a passive type and an active type;

[0009] Determine a protocol range corresponding to the first received message based on the response type;

[0010] Inputting the first received message and the protocol range into a preset first protocol identification model for analysis, and obtaining a first analysis result within the protocol range;

[0011] A protocol used by the distributed power supply control device is determined based on the first analysis result.

[0012] Optionally, obtaining the first received message and response type sent by the distributed power control device includes: obtaining a first received message sent by the distributed power control device in response to a first detection message sent by a distributed power access terminal, and determining that the response type of the first received message is a passive type.

[0013] Optionally, obtaining the first received message and the response type sent by the distributed power control device includes: obtaining the first received message actively sent by the distributed power control device, and determining that the response type of the actively sent first received message is an active type.

[0014] Optionally, the determining, based on the response type, a protocol range corresponding to the first received message includes:

[0015] When the response type is a passive type, determining the protocol range to be a first range corresponding to the first detection message;

[0016] When the response type is an active type, the protocol range is determined to be a second range matching the active type.

[0017] Optionally, the first analysis result includes one of a protocol identifier and a protocol family identifier to which the first received message belongs; and determining the protocol used by the distributed power supply control device based on the first analysis result includes:

[0018] When the first analysis result includes the protocol identifier, determining the protocol corresponding to the protocol identifier as the protocol used by the distributed power supply control device;

[0019] When the first analysis result includes the protocol family identifier, a second detection message is determined based on the protocol family identifier, the second detection message is sent to the distributed power supply control device, a second reception message in which the distributed power supply control device responds to the second detection message is received, and the protocol used by the distributed power supply control device is determined based on the second reception message.

[0020] Optionally, determining the protocol used by the distributed power control device based on the second received message includes: inputting the second received message into a preset second protocol identification model for analysis to obtain the protocol used by the distributed power control device.

[0021] Optionally, the first protocol identification model is a pre-trained decision tree model; the first received message and the protocol range are input into a preset first protocol identification model for analysis, and a first analysis result is obtained within the protocol range, including: extracting features of the first received message based on the protocol range, inputting the extracted features into the first protocol identification model for analysis, and obtaining the first analysis result.

[0022] Optionally, the pre-trained decision tree model is trained by the following steps:

[0023] Step 1, obtain the current training set, Gini coefficient threshold and sample threshold;

[0024] Step 2: construct a feature subset based on the training set;

[0025] Step 3: splitting the training set based on the feature subset, the Gini coefficient threshold and the sample threshold, constructing nodes and branches of a decision tree until a decision tree stopping condition is met, thereby forming an initial decision tree model;

[0026] Step 4: Pruning and parameter adjustment are performed on the initial decision tree model to output an optimized decision tree model;

[0027] Step 5: Call a preset test set to perform model evaluation on the optimized decision tree model, and use the model that passes the evaluation as the pre-trained decision tree model.

[0028] In a second aspect of the present application, a protocol identification device for accessing a distributed power source to a power grid is provided, the device comprising:

[0029] A message acquisition module, used to acquire a first received message and a response type sent by a distributed power supply control device, wherein the response type includes a passive type and an active type; and determine a protocol range corresponding to the first received message based on the response type;

[0030] A model analysis module, used for inputting the first received message and the protocol range into a preset first protocol identification model for analysis, and obtaining a first analysis result from within the protocol range;

[0031] A protocol confirmation module is used to determine the protocol used by the distributed power supply control device based on the first analysis result.

[0032] In a third aspect of the present application, a readable and writable storage medium is provided, on which executable instructions are stored. When the executable instructions are executed by a processor, the processor executes any one of the methods in the embodiments of the present application.

[0033] In a fourth aspect of the present application, a distributed power supply access terminal is provided, comprising: one or more processors; a memory for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors execute any one of the methods described in the embodiments of the present application.

[0034] The protocol identification method, device, medium and terminal for accessing a distributed power source to a power grid in the present application identify the response type to which a received message belongs, determine the corresponding protocol range based on the response type, and call a preset protocol identification model to perform communication protocol identification within the protocol range. This can reduce the amount of analysis data of the protocol identification model and improve the identification accuracy and efficiency of the protocol used by the control device. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope of the present application.

[0036] Figure 1 A schematic flow chart of a protocol identification method for accessing a distributed power source to a power grid in one embodiment;

[0037] Figure 2 A schematic diagram of a process for determining a protocol used by a distributed power supply control device based on a first analysis result in one embodiment;

[0038] Figure 3 A flowchart of a training process of a decision tree model in one embodiment;

[0039] Figure 4 It is a structural block diagram of a protocol identification device for accessing a distributed power source to a power grid in one embodiment. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0041] All terms (including technical and scientific terms) used in this application have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used here should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.

[0042] For example, the terms "first", "second", etc. used in this application are only used to distinguish similar objects and to differentiate the first object from another object, rather than to describe a specific order or sequence, and cannot be understood as indicating or implying relative importance.

[0043] This application proposes a protocol identification method for distributed power generation access to the power grid, combined with Figure 1 As shown, the method includes:

[0044] Step 110: Acquire a first received message and a response type sent by a distributed power supply control device, where the response type includes a passive type and an active type.

[0045] In this embodiment, the distributed power control device includes one or more of a photovoltaic inverter, a wind turbine inverter and its supporting metering device, such as an electric meter. The control device communicates with the access terminal. Before the communication, the access terminal needs to know the communication protocol of the control device. The communication protocol between the access terminal and the control device is a binary coded protocol.

[0046] Before identifying the communication protocol of the control device, the access terminal first connects the hardware communication interface of the two and matches the basic communication parameters such as the communication rate. After completing these preparations, the first received message sent by the control device can be obtained. The first received message is the first response information sent by the control device to the access terminal in the initial stage of the distributed power control device accessing the power grid, or after receiving the query request of the access terminal.

[0047] According to the trigger mechanism of the received message, it is divided into passive type and active type. The first received message can be an actively sent message, or a message sent in passive response after receiving a message sent by the access terminal. When it is an actively sent message, its response type is the active type; when it is a passively sent message, its response type is the passive type.

[0048] The message usually contains one or more parameter information such as the operating status, power output, voltage and current of the distributed power source, and may further include possible alarm or fault information. For example, the content of the first received message may include basic information of the distributed power source (such as device ID, model, etc.), current operating status (such as whether it is online, whether it is faulty, etc.), power output (such as active power, reactive power, etc.), voltage and current, etc., one or more electrical parameters. In addition, according to the specific communication protocol and application scenario, the first received message may also contain other specific information, such as alarm code, fault description, timestamp, etc.

[0049] The control device is provided with a fixed communication protocol, and the messages sent out by it (including the first received message and the subsequent second received message) all follow the communication protocol. The communication protocol includes Modbus-rtu protocol, custom protocol based on Modbus-rtu, DL 645 protocol, DL 698 protocol, etc. Each communication protocol defines the structure of the corresponding message, the meaning of the data field, the checksum calculation method, etc., to ensure the correct transmission and analysis of the data.

[0050] Step 120: Determine a protocol range corresponding to the first received message based on the response type.

[0051] In this embodiment, the protocol range corresponding to the received first received message can be determined for the response type of the received first received message. Generally speaking, some communication protocols or some control devices do not have the function of active response. The access terminal can classify which communication protocols and which control devices have the function of active response based on the characteristics of each communication protocol or control device, establish a preset protocol library or protocol mapping table, and determine the protocol range corresponding to the first received message by querying the protocol library or protocol mapping table for the response type of the first received message.

[0052] By determining a protocol range according to the response type, the recognition range of the communication protocol for the control device can be narrowed, the workload of subsequent recognition is reduced, and the recognition efficiency is improved.

[0053] Generally speaking, even for the same protocol, some control devices have active response functions, while some do not. Therefore, for active response type messages, the corresponding protocol range is usually larger than the passive response protocol range.

[0054] In one embodiment, the access terminal also pre-sets the protocol attributes of each communication protocol, and the protocol attributes reflect whether the corresponding communication protocol supports active response and whether it supports passive response. For example, its protocol attributes include supporting only active response, supporting only passive response, and supporting both active response and passive response.

[0055] After identifying the response type of the received message, the protocol range of the received message can be determined based on the protocol attributes of each communication protocol. For example, when it is determined that the first received message is of an active type, all communication protocols that support active responses are taken as possible communication protocols of the first received message by querying the protocol attributes, and its protocol range is determined to be all communication protocols that support active responses.

[0056] Step 130: input the first received message and the protocol range into a preset first protocol identification model for analysis, and obtain a first analysis result from the protocol range.

[0057] In this embodiment, the first protocol identification model is any suitable model for identifying the communication protocol to which the first received message belongs. For example, it can be any suitable model or a combination of multiple models such as the multi-layer perceptron (MLP), convolutional neural network (CNN), recurrent neural network (RNN), decision tree model, etc. Specifically, the first detection model can be a preset decision tree model, such as a CART (Classification and Regression Tree) model.

[0058] The access terminal pre-sets the first protocol identification model. For the received first received message, the first received message and the protocol range can be used as the input of the first protocol identification model. By running the first protocol identification model, the first protocol identification model analyzes the communication protocol to which the first received message belongs within the protocol range and outputs the first analysis result.

[0059] Specifically, the model extracts characteristic information (such as message header, control code, data field, etc.) from the first received message, and compares and matches it with the characteristic library in the model, thereby realizing the identification of the protocol type. The first analysis result includes the protocol identifier of one or more communication protocols to which the first received message may belong, or the protocol family identifier of one or more communication protocol families to which it may belong, and may further include the analyzed probability of belonging to the corresponding communication protocol. Among them, the protocol identifier can represent a specific communication protocol, and the protocol family identifier is used to represent a specific communication protocol family. Among them, the communication protocol family refers to a set of related communication protocols. For example, if the communication protocol family is the MC communication protocol family, then the communication protocol family may specifically include the MC3E communication protocol and the MC4E protocol, or if the communication protocol family is the Modbus protocol family, then it may include the Modbus RTU protocol and the Modbus TCP protocol.

[0060] It can be understood that the more information included in the first received message, the higher the accuracy of the identified communication protocol to which the first received message belongs.

[0061] In one embodiment, the first protocol identification model is a pre-trained decision tree model; step 130 includes: extracting features of the first received message based on the protocol range, inputting the extracted features into the first protocol identification model for analysis, and obtaining a first analysis result.

[0062] In this embodiment, for different protocol ranges, the extracted features and feature quantities are different. For example, the following Table 1 shows that the messages of various protocols are all hexadecimal messages. For the Modbus-rtu protocol, 7 features can be extracted from them, namely: 0x01, 0x03, 0x04, 0x0F, 0x02, 2 bytes of data, and a check code. Based on the custom protocol of Modbus-rtu, the features that can be extracted include: 0x01, 0x02, 0x03, 0x0F, 0x06, 6 bytes of data, and a check code.

[0063] Table 1

[0064]

[0065] Taking the first received message "0104060a8c08980898f403" as an example, the features that can be extracted are: 01, 04, 06, 0a8c08980898, f403, a total of 5; taking the first received message "68170043050100000000000a7e60501010000020000sfda16" as an example, the features that can be extracted are: 68, 1700, 43, 05, 010000000000, 00, a7e6, 0501010000020000, 5fda, 16, a total of 10.

[0066] The features extracted therefrom may be input into a pre-trained decision tree model for operation, and the decision tree model outputs a first analysis result, wherein the first analysis result includes one of a protocol identifier and a protocol family identifier to which the first received message belongs.

[0067] In one embodiment, the principal component analysis method can be called to extract a preset number of features from the first received message in combination with the protocol range, and the extracted features are input into the first protocol identification model for analysis to obtain a first analysis result. Among them, the number of features corresponding to different protocol ranges is preset, and after the number of features is determined based on the protocol range, the principal component analysis algorithm is called to extract the corresponding number of features from the first received message, so that a suitable number of features can be extracted for analysis, and the corresponding number of features extracted by the principal component analysis method are the features with the greatest contribution, thereby ensuring the accuracy of the analysis and reducing the interference caused by the features.

[0068] Step 140: determine the protocol used by the distributed power supply control device based on the first analysis result.

[0069] In this embodiment, the access terminal can obtain the communication protocol in the first analysis result, and send a matching detection message to the control device based on the communication protocol for verification. After receiving the reply message made by the control device to the detection message, it can further identify whether the reply message matches the communication protocol identified in the first analysis result. If it matches, it is determined that the communication protocol used by the control device is the protocol indicated in the first analysis result.

[0070] The protocol identification method for accessing a distributed power source to a power grid in the present application identifies the response type to which a received message belongs, determines the corresponding protocol range based on the response type, and calls a preset protocol identification model to perform communication protocol identification within the protocol range. This can reduce the amount of analysis data of the protocol identification model and improve the identification accuracy and efficiency of the protocol used by the control device.

[0071] In one embodiment, step 110 includes: acquiring a first received message sent by the distributed power control device in response to a first detection message sent by the distributed power access terminal, and determining that the response type of the first received message is a passive type.

[0072] In one embodiment, step 120 includes: when the response type is a passive type, determining the protocol range to be a first range corresponding to the first detection message.

[0073] In this embodiment, the first detection message refers to a special type of message sent by the distributed power access terminal to the distributed power control device during the process of the distributed power access to the power grid. The main purpose of this message is to trigger the distributed power control device to generate a response, so as to obtain its operating status, parameter data and other information. The first detection message usually contains some specific request information, which is used to indicate what type of data the distributed power control device returns or what operations it performs. The request information can be a specific query instruction (such as whether it is online, whether it is faulty, power output and other query instructions), a parameter request (such as voltage, current, power factor and other parameter requests) or an operation command (such as start, stop or reset commands). These request information instruct the distributed power control device to return the corresponding data or perform specified operations.

[0074] When the control device needs to receive a detection message sent by the access terminal to trigger the reception of the message, it is determined that the response type of the reception message is a passive type.

[0075] In one embodiment, a plurality of first detection messages are pre-stored in the access terminal, and each first detection message complies with one or more specific communication protocols. These protocols define the structure of the message, the meaning of the data field, the verification and calculation method, etc., to ensure the correct transmission and parsing of the data. Specifically, one or more matching first detection messages can be stored for all types of communication protocols, or most of the communication protocols. The first detection message can be a universal message, which is adapted to multiple communication protocols and can be recognized by multiple control devices, and the multiple control devices respectively use different communication protocols.

[0076] For a passive type of control device, the first reception message is triggered only after receiving a specific first reception message. The access terminal can select from the stored multiple first detection messages by random selection or according to a preset selection rule, and send the selected first detection message to the control device. The control device will respond and send a first reception message only after receiving the first detection message that matches its communication protocol; if the received first detection message does not match its corresponding communication protocol, it will not respond and will not send the first reception message. When there is a mismatch, the control device may not be able to parse the information in the detection message and respond according to the rules agreed in its communication protocol.

[0077] When the access terminal does not receive a reception message from the control device after sending the selected first detection message, it replaces the first detection message and continues to send it to the control device until the first reception message from the control device is received.

[0078] Based on this, based on the response of different communication protocols to the detection message, the access terminal pre-sets the correspondence between different first detection messages and the communication protocols that can respond to the detection message. After receiving the first reception message, all communication protocols that have a correspondence with the detection message responded by the first reception message are obtained, and all the obtained communication protocols are used as the first range.

[0079] In this embodiment, the access terminal can quickly receive the passive first reception message by setting a small number of detection messages, thereby improving the efficiency of obtaining the first reception message.

[0080] In one embodiment, step 110 includes: acquiring a first receiving message actively sent by the distributed power supply control device, and determining that a response type of the first receiving message actively sent is an active type.

[0081] In one embodiment, step 120 includes: when the response type is an active type, determining the protocol range to be a second range matching the active type.

[0082] In this embodiment, after completing the above-mentioned preparation work, the access terminal detects whether the first received message is received within the first time period. If the received message is received, it is determined that the first received message is of an active type. The starting time of the first time period may be the time when the preparation work is completed. Optionally, the set consisting of all communication protocols supporting active response may be used as the second range. Generally speaking, there is a certain intersection between the first range and the second range, and even the first range is a subset of the second range.

[0083] When the first reception message is not received within the first time period, it can be determined that the response type of the first reception message is a passive response. A first detection message can be extracted from the message library storing the first detection message and sent to the control device. When the first reception message is still not received within the second time period after sending a first detection message, a first detection message is re-extracted and sent to the control device, and the second time period is waited again, and so on, until the first reception message is received. Among them, the first detection message selected each time is different. The first time period and the second time period can be arbitrarily set as appropriate time periods.

[0084] In one embodiment, step 140 includes: when the first analysis result includes a protocol identifier, determining the protocol corresponding to the protocol identifier as the protocol used by the distributed power supply control device.

[0085] In this embodiment, the access terminal sets a third detection message corresponding to each protocol identifier, each third detection message uniquely corresponds to a communication protocol, and the message structure of the third detection message is consistent with the message structure specified by the uniquely corresponding communication protocol.

[0086] The third detection message is used to verify the communication protocol determined in the first analysis result, and has richer information than the first detection message, which is intended to trigger the distributed power control device to return richer response data, thereby helping the system to more accurately identify the protocol used by the device. That is, the third received message also has richer information than the first received message, and the communication protocol of the control device can be clearly identified through the third received message.

[0087] For example, the first probe message only contains more general request information, such as only one or several of the following information: a protocol identifier, a target address, a probe type, and basic request parameters. The protocol identifier is used to specify the protocol type used by the probe message; the target address indicates the target device address and port number; the probe type is used to indicate the type of the probe message, such as a simple connection request, a data request, or other types of probes; the basic request parameters may include some basic request parameters, such as a request timeout, number of retries, etc.

[0088] In addition to the general request information mentioned above, the third detection message may further include a combination of one or more of the following: a protocol family identifier, a function code, a register address, and additional parameters. The protocol family identifier is used to determine the protocol family to which the control device may belong, such as Modbus, DNP3, etc., based on the response to the first detection message; the function code represents the function code for a specific protocol, which is used to request the control device to perform a specific operation or return specific data; if the control device uses a register to store data, the second detection message may contain the register address to be accessed. The additional parameters may include some additional request parameters, such as data length, etc., to ensure the integrity and accuracy of the data. For example, the third detection message may be a message requesting the control device to feedback one or more parameters such as its voltage, current, basic information of the distributed power source, and output power, and the first detection message is only used to request the control device to feedback information about its current operating status.

[0089] After extracting the protocol identifier from the first analysis result, obtain the third detection message corresponding to the protocol identifier, send the third detection message to the control device, and detect whether the third reception message of the control device for the third detection message is received. After receiving the third reception message, verify the third reception message according to the communication protocol corresponding to the protocol identifier, and detect whether the communication protocol to which the third reception message belongs is the communication protocol corresponding to the protocol identifier represented in the first analysis result. If so, determine the protocol identifier as the protocol used by the control device. If not (or the third reception message is not received), re-execute the above step 130, or use the received third reception message (or the first reception message) as the input of the above protocol identification model, so as to re-determine the communication protocol of the control device.

[0090] In this embodiment, since the third detection message has more abundant information than the first detection message, the received third reception message also has more abundant information than the first reception message, thereby improving the accuracy of protocol identification of the control device.

[0091] In one embodiment, Figure 2 As shown, step 140 also includes:

[0092] Step 210: When the first analysis result includes a protocol family identifier, a second detection message is determined based on the protocol family identifier, and the second detection message is sent to the distributed power supply control device.

[0093] Step 220: Receive a second receiving message in which the distributed power supply control device responds to the second detection message.

[0094] Step 230: Determine the protocol used by the distributed power supply control device based on the second received message.

[0095] In this embodiment, the access terminal further sets a second detection message corresponding to each protocol family identifier, and each second detection message uniquely corresponds to a protocol family. Similar to the third detection message, the second detection message has richer information than the first detection message. The second detection message is suitable for any communication protocol in the corresponding protocol family. Similarly, the second detection message may include a combination of one or more of the above-mentioned protocol family identifier, function code, register address, additional parameters, etc.

[0096] When the protocol family identifier in the first analysis result is extracted, it means that the first protocol identification model does not identify the specific communication protocol of the control device, but identifies the protocol family to which its communication protocol belongs, wherein the protocol family is within the above-mentioned protocol range.

[0097] The second detection message further includes detailed request information based on the first detection message to determine the specific protocol and obtain required data. The access terminal can obtain the second detection message corresponding to the protocol family identifier based on the corresponding relationship and send the second detection message to the control device.

[0098] The control device responds to the received second detection message and sends a corresponding second reception message to the access terminal. The access terminal identifies the communication protocol based on the second reception message and determines the communication protocol used by the control device.

[0099] Similarly, the second detection message is adapted to fewer communication protocols than the first detection message, reducing unnecessary communication overhead and interference. The second received message contains more information than the first received message, and since it has been determined that the second received message is within the scope of the protocol family, the range of communication protocols to be identified is further narrowed. On the basis of obtaining a richer received message, the protocol of the control device can be quickly and accurately identified.

[0100] In one embodiment, step 230 includes: inputting the second received message into a preset second protocol identification model for analysis to obtain a protocol used by the distributed power supply control device.

[0101] In this embodiment, the second protocol identification model may be the same as or different from the first protocol identification model. Specifically, the first protocol identification model is a decision tree model, and the second protocol identification model may also be the decision tree model, or may also be a preset convolutional neural network model, such as the second protocol identification model is a long short-term memory network (LSTM) model.

[0102] Since the second received message contains more information than the first received message, using the LSTM model to analyze the second received message can efficiently extract local features and global structural information in the message, capture the timing dependencies and context information in the message data, and further improve the accuracy of protocol recognition of the control device.

[0103] In one embodiment, the first protocol identification model is a pre-trained decision tree model. Specifically, the decision tree model can be trained in advance on the host computer to form a pre-trained decision tree model, the pre-trained decision tree model is loaded into the access terminal, and the pre-trained decision tree model is optimized and updated regularly, and the updated decision tree model is reloaded into the access terminal. The decision tree model can be a CART decision tree model. Figure 3 As shown, the training process of the decision tree model includes:

[0104] Step 310, obtaining the current training set, the Gini coefficient threshold and the sample threshold.

[0105] In this embodiment, historical message data of distributed power access terminals interacting with distributed power control devices of different types, manufacturers, and models are collected in advance, and pre-processing and standardization processing such as data cleaning, missing value processing, outlier detection and processing are performed on the historical message data. Classification labels such as protocol identifiers and protocol family identifiers corresponding to the historical message data are marked, and the current training set is formed based on the processed historical message data and classification labels.

[0106] The Gini coefficient is used to measure the purity of the constructed feature subset. As a measure of the partitioning effect, the Gini coefficient is positively correlated with uncertainty. The smaller the Gini coefficient, the higher the discrimination and the better the partitioning effect. The Gini coefficient threshold is used to decide when to stop splitting a node. Set a Gini coefficient threshold. When the Gini coefficient of a node is lower than this threshold, the node is considered to be pure enough and does not need to be further split.

[0107] The sample threshold is used to control the minimum number of samples required for each node. If a child node after a split contains fewer samples than this threshold, further splitting is stopped.

[0108] Step 320: construct a feature subset based on the training set.

[0109] For each historical message data in the training set, feature extraction can be performed in any suitable manner that is compatible with the features of the protocol, thereby constructing a suitable feature subset. For example, the principal component analysis method can be used to extract features, thereby constructing a feature subset.

[0110] Specifically, the covariance matrix of the historical message data after the above processing can be subjected to eigendecomposition to obtain corresponding eigenvalues ​​and eigenvectors. The eigenvalues ​​represent the variance contribution of each principal component in the data, while the eigenvectors define the directions of each principal component.

[0111] Based on the size of each eigenvalue, select the eigenvectors corresponding to the first k largest eigenvalues ​​as the principal components. Different historical message data correspond to different k values, so that the number of features finally selected can reach the preset cumulative contribution rate threshold to balance the complexity and performance of the model. Among them, the cumulative contribution rate is the ratio of the sum of the first k eigenvalues ​​to the sum of all eigenvalues. The cumulative contribution rate threshold can be any appropriate value set in advance, such as 95%, 98%, etc.

[0112] Finally, the feature matrix is ​​projected into the space composed of the selected principal components to obtain the reduced-dimensional feature matrix and form a feature subset.

[0113] Step 330, split the training set based on the feature subset, the Gini coefficient threshold and the sample threshold, construct nodes and branches of the decision tree until the decision tree stopping condition is met, and form an initial decision tree model.

[0114] Specifically, starting from the root node of the decision tree model, the training set is split using the features in the feature subset. The Gini coefficient of each feature after splitting is calculated, and the feature with the largest reduction in the Gini coefficient is selected as the split feature of the current node. According to the different values ​​of the split feature, the training set is divided into multiple subsets and the corresponding child nodes are created.

[0115] Next, based on the created child nodes, the feature subsets in the child nodes are used to continue splitting the training set. Repeat the above process, split each child node to form a new child node, until the decision tree stopping condition is met.

[0116] The calculation formula of the Gini coefficient of node X is as follows:

[0117]

[0118] in, D is the feature subset corresponding to node X, For feature subset D The feature set A The i After calculating the Gini coefficient of each feature, select the feature set with the smallest Gini coefficient and its feature value, and set the subset D Divide into subsets and subset , and form two child nodes of the node X, subset With subset They are the feature subsets of the two child nodes formed respectively.

[0119] The decision tree stopping conditions include: 1. The Gini coefficient of the child node is less than the above-mentioned Gini coefficient threshold; 2. The number of samples contained in the child node is less than the sample threshold; 3. The depth of the split decision tree reaches the preset tree depth, etc. One or more of the above.

[0120] When the Gini coefficients of the latest sub-nodes are all less than the Gini coefficient threshold, or the number of samples corresponding to the feature subset is less than the sample threshold, the splitting of the sub-node is terminated. After the splitting of all sub-nodes is terminated, the initial decision tree model is formed.

[0121] Step 340, pruning and parameter adjustment are performed on the initial decision tree model, and an optimized decision tree model is output.

[0122] Among them, pruning can be performed by using methods such as CCP pruning (Cost Complexity Pruning) to prevent overfitting and delete unnecessary nodes. Parameter adjustment includes adjusting the above-mentioned Gini coefficient threshold, sample threshold, tree depth and other parameters to optimize the performance of the model.

[0123] Step 350, calling a preset test set to perform model evaluation on the optimized decision tree model, and using the model that passes the evaluation as a pre-trained decision tree model.

[0124] Optionally, a test set is pre-set, and the optimized decision tree model is evaluated through the test set to calculate one or more indicators such as the accuracy, recall rate, F1 score, etc. of the model to evaluate the performance of the model.

[0125] When the model evaluation result meets the preset evaluation criteria (such as the accuracy is higher than a certain threshold), the model is saved as a pre-trained decision tree model; otherwise, return to step 330 and step 340 to train and optimize the decision tree model until the evaluation criteria are met.

[0126] Through the above process, a trained decision tree model can be obtained, and the decision tree model is loaded into the access terminal. The access terminal can identify the protocol used by the control device based on the decision tree model.

[0127] In this embodiment, feature extraction is performed using principal component analysis, and the extracted features are input into a decision tree model for training, which can further improve the accuracy of protocol recognition.

[0128] In one embodiment, Figure 4 As shown, a protocol identification device for accessing a distributed power source to a power grid is provided, the device comprising:

[0129] The message acquisition module 410 is used to acquire a first received message and a response type sent by a distributed power supply control device, wherein the response type includes a passive type and an active type; and determine a protocol range corresponding to the first received message based on the response type;

[0130] A model analysis module 420, configured to input a first received message and a protocol range into a preset first protocol identification model for analysis, and obtain a first analysis result from within the protocol range;

[0131] The protocol confirmation module 430 is used to determine the protocol used by the distributed power supply control device based on the first analysis result.

[0132] In one embodiment, the message acquisition module 410 is further used to acquire a first received message sent by the distributed power control device in response to a first detection message sent by the distributed power access terminal, and determine that the response type of the first received message is a passive type.

[0133] In one embodiment, the message acquisition module 410 is further used to acquire a first received message actively sent by the distributed power supply control device, and determine that the response type of the actively sent first received message is an active type.

[0134] In one embodiment, the message acquisition module 410 is further configured to, when the response type is a passive type, determine that the protocol range is a first range corresponding to the first detection message.

[0135] In one embodiment, the message acquisition module 410 is further configured to determine, when the response type is an active type, that the protocol range is a second range matching the active type.

[0136] In one embodiment, the protocol confirmation module 430 is further configured to, when the first analysis result includes a protocol identifier, determine the protocol corresponding to the protocol identifier as the protocol used by the distributed power supply control device.

[0137] In one embodiment, when the first analysis result includes a protocol family identifier, the protocol confirmation module 430 determines a second detection message based on the protocol family identifier, sends the second detection message to the distributed power control device, receives a second reception message in which the distributed power control device responds to the second detection message, and determines the protocol used by the distributed power control device based on the second reception message.

[0138] In one embodiment, the model analysis module 420 is further used to input the second received message into a preset second protocol identification model for analysis to obtain a protocol used by the distributed power supply control device.

[0139] In one embodiment, the first protocol identification model is a pre-trained decision tree model; the model analysis module 420 is also used to extract features of the first received message based on the protocol range, input the extracted features into the first protocol identification model for analysis, and obtain a first analysis result.

[0140] In one embodiment, a readable and writable storage medium is provided, on which executable instructions are stored, and when the instructions are executed by a processor, the processor executes the steps in the above-mentioned method embodiments. The processor may include any suitable processor such as a microprocessor and a microcontroller MCU.

[0141] In one embodiment, a distributed power access terminal is also provided, comprising one or more processors; a memory, in which one or more programs are stored, wherein when the one or more programs are executed by one or more processors, the one or more processors execute the steps in the above-mentioned method embodiments.

[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

[0143] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present application and form different embodiments. For example, all of the above embodiments may be used in any combination. The information disclosed in this background technology section is intended only to deepen the understanding of the overall background technology of the present application and should not be regarded as an admission or in any form to imply that the information constitutes prior art known to those skilled in the art.

Claims

1. A protocol identification method for distributed power supply access to a power grid, characterized in that: The method comprises: Obtaining a first received message and a response type sent by a distributed power control device, wherein the response type includes a passive type and an active type, wherein the first received message is the first response information sent by the distributed power control device to a distributed power access terminal, and wherein the first received message includes one or more parameter information of the operating status, power output, voltage and current of the distributed power source, and when the first received message is received within a first time period, determining that the response type of the first received message is an active type, and when the first received message is not received within the first time period, determining that the response type of the first received message is a passive type; Determine a protocol range corresponding to the first received message based on the response type; Inputting the first received message and the protocol range into a preset first protocol identification model for analysis, and obtaining a first analysis result from the protocol range, wherein the first analysis result includes one of a protocol identifier and a protocol family identifier to which the first received message belongs; Determining the protocol used by the distributed power control device based on the first analysis result includes: when the first analysis result contains the protocol family identifier, determining a second detection message based on the protocol family identifier, sending the second detection message to the distributed power control device, receiving a second reception message in which the distributed power control device responds to the second detection message, and determining the protocol used by the distributed power control device based on the second reception message, the second detection message uniquely corresponding to a protocol family, the protocol family corresponding to the protocol family identifier is within the protocol range, and the second reception message contains richer information than the first reception message.

2. The protocol identification method for distributed power supply access to a power grid according to claim 1, characterized in that: The obtaining of the first received message and the response type sent by the distributed power supply control device includes: Acquire a first received message sent by the distributed power control device in response to a first detection message sent by a distributed power access terminal, and determine that a response type of the first received message is a passive type; or A first receiving message actively sent by the distributed power supply control device is obtained, and a response type of the actively sent first receiving message is determined to be an active type.

3. The protocol identification method for distributed power supply access to a power grid according to claim 2, characterized in that: The determining, based on the response type, a protocol range corresponding to the first received message includes: When the response type is a passive type, determining the protocol range to be a first range corresponding to the first detection message; When the response type is an active type, the protocol range is determined to be a second range matching the active type.

4. The protocol identification method for distributed power supply access to a power grid according to claim 1, characterized in that: The determining, based on the first analysis result, a protocol used by the distributed power supply control device comprises: When the first analysis result includes the protocol identifier, the protocol corresponding to the protocol identifier is determined as the protocol used by the distributed power supply control device.

5. The protocol identification method for distributed power supply access to a power grid according to claim 1, characterized in that: The determining, based on the second received message, the protocol used by the distributed power supply control device includes: The second received message is input into a preset second protocol identification model for analysis to obtain the protocol used by the distributed power supply control device.

6. The method for identifying a protocol for accessing a distributed power source to a power grid according to any one of claims 1 to 5, characterized in that: The first protocol identification model is a pre-trained decision tree model; the first received message and the protocol range are input into the preset first protocol identification model for analysis, and a first analysis result is obtained within the protocol range, including: Feature extraction is performed on the first received message based on the protocol range, and the extracted features are input into the first protocol recognition model for analysis to obtain the first analysis result.

7. The protocol identification method for distributed power source access to a power grid according to claim 6, characterized in that: The pre-trained decision tree model is trained by the following steps: Step 1, obtain the current training set, Gini coefficient threshold and sample threshold; Step 2: construct a feature subset based on the training set; Step 3: splitting the training set based on the feature subset, the Gini coefficient threshold and the sample threshold, constructing nodes and branches of a decision tree until a decision tree stopping condition is met, thereby forming an initial decision tree model; Step 4: Pruning and parameter adjustment are performed on the initial decision tree model to output an optimized decision tree model; Step 5: Call a preset test set to perform model evaluation on the optimized decision tree model, and use the model that passes the evaluation as the pre-trained decision tree model.

8. A protocol identification device for accessing a distributed power source to a power grid, characterized in that: The device comprises: A message acquisition module, used to acquire a first received message and a response type sent by a distributed power supply control device, wherein the response type includes a passive type and an active type; based on the response type, a protocol range corresponding to the first received message is determined, wherein the first received message is the first response information sent by the distributed power supply control device to a distributed power supply access terminal, and the first received message includes one or more parameter information of the operating status, power output, voltage and current of the distributed power supply; when the first received message is received within a first time period, it is determined that the response type of the first received message is an active type; when the first received message is not received within the first time period, it is determined that the response type of the first received message is a passive type; A model analysis module, used for inputting the first received message and the protocol range into a preset first protocol identification model for analysis, and obtaining a first analysis result from the protocol range, wherein the first analysis result includes one of a protocol identifier and a protocol family identifier to which the first received message belongs; A protocol confirmation module, used to determine the protocol used by the distributed power control device based on the first analysis result, including: when the first analysis result includes the protocol family identifier, determining a second detection message based on the protocol family identifier, sending the second detection message to the distributed power control device, receiving a second reception message in which the distributed power control device responds to the second detection message, and determining the protocol used by the distributed power control device based on the second reception message, the second detection message uniquely corresponding to a protocol family, the protocol family corresponding to the protocol family identifier is within the protocol range, and the second reception message contains richer information than the first reception message.

9. A readable and writable storage medium, characterized in that: The readable and writable storage medium stores executable instructions, and when the executable instructions are executed by the processor, the processor executes the protocol identification method for accessing a distributed power source to a power grid as described in any one of claims 1 to 7.

10. A distributed power access terminal, characterized in that: include: one or more processors; A memory for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to execute the protocol identification method for accessing a distributed power source to a power grid as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Protocol adaptive method between photovoltaic protocol converter and photovoltaic inverter

    CN116320062A

  • Photovoltaic equipment communication protocol self-adaption method

    CN117749900A

  • Equipment protocol identification method and device, terminal and storage medium

    CN114500688A

  • Protocol rule determination method and device, electronic equipment and storage medium

    CN117749614A