A method for generating fuzzy test cases for a distributed photovoltaic communication protocol

By constructing a semantic model and reinforcement learning network for photovoltaic communication protocols and dynamically adjusting mutation strategies, the inefficiency and adaptability problems of existing fuzzy testing methods for photovoltaic communication protocols are solved, enabling efficient and in-depth testing of photovoltaic equipment.

CN123123224APending Publication Date: 2026-11-17ZHUCHENG POWER SUPPLY CO STATE GRID SHANDONG ELECTRIC POWER CO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611236633.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-14
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing fuzzy testing methods for photovoltaic communication protocols cannot perceive the semantics of photovoltaic business, resulting in low testing efficiency, difficulty in covering deep logical defects, and difficulty in simultaneously adapting to both Modbus and IEC61850 protocols.

Method used

By constructing a protocol semantic model, assigning photovoltaic semantic labels to data objects, using reinforcement learning networks to dynamically adjust mutation strategies, generating test messages, and combining them with device response status for anomaly detection, multi-protocol adaptation is supported.

Benefits of technology

It improves testing efficiency, can identify hidden defects in devices that respond normally but behave abnormally, and enhances testing depth and adaptability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123123224A_ABST
    Figure CN123123224A_ABST
Patent Text Reader

Abstract

This invention relates to the field of fuzz testing technology, specifically providing a method for generating fuzzy test cases for distributed photovoltaic (PV) communication protocols. The method includes: acquiring protocol description information of PV equipment; constructing a protocol semantic model, where each data object in the model is associated with a PV semantic label and a business importance weight; constructing a state space for a reinforcement learning network based on the semantic labels; selecting the current mutation action from a set of preset mutation action types using the reinforcement learning network; mutating seed test cases according to the current mutation action, generating test messages, and sending them to the target device; collecting the device's response status and multi-dimensional behavioral feature data, and calculating a behavior anomaly scores; generating reward signals based on the response status and behavior anomaly scores, and updating the reinforcement learning network parameters using the reward signals; and accumulating and outputting test cases that trigger anomalies. This invention achieves semantically aware adaptive fuzz testing, improving the efficiency and depth of PV protocol security testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of fuzz testing technology, specifically relating to a method for generating fuzz test cases for a distributed photovoltaic communication protocol. Background Technology

[0002] In photovoltaic power generation systems, inverters, data acquisition devices, and other equipment widely use Modbus TCP and IEC61850 communication protocols to interact with the monitoring system. These protocols, primarily focused on real-time performance and interoperability during the design phase, have relatively weak security mechanisms, and the device-side protocol stack implementations commonly suffer from security flaws related to improper handling of malformed inputs. Fuzz testing, which triggers abnormal behavior by sending a large number of mutated test messages to the target device, is an effective method for uncovering such defects.

[0003] Existing fuzzy testing methods for photovoltaic protocols suffer from the following shortcomings: Mutation strategies are mostly based on general rules, failing to perceive photovoltaic business semantics such as irradiance, MPPT status, and grid frequency. This results in a large number of test messages being discarded during the protocol format verification stage, leading to low testing efficiency. Fixed mutation strategies lack the ability to dynamically adjust based on real-time device feedback, making it difficult to cover deeper logic. Anomaly detection relies on a single response code, making it difficult to identify hidden defects where the response appears normal but the device behavior has deviated abnormally. Furthermore, existing solutions are mostly designed for a single protocol, making it difficult to simultaneously adapt to both Modbus and IEC61850 protocols within a unified framework.

[0004] Therefore, there is an urgent need for a fuzz testing method that can perceive the semantics of photovoltaic business, adaptively adjust mutation strategies, and support multi-protocol adaptation, so as to improve the efficiency and depth of security testing of photovoltaic equipment communication protocols. Summary of the Invention

[0005] To address the aforementioned shortcomings of existing technologies, this invention provides a method for generating fuzzy test cases for a distributed photovoltaic communication protocol, thereby resolving the aforementioned technical problems.

[0006] In a first aspect, the present invention provides a method for generating fuzzy test cases for a distributed photovoltaic communication protocol, comprising: Obtain the protocol description information of the target photovoltaic equipment, and construct a protocol semantic model based on the protocol description information. The protocol semantic model contains multiple data objects, and each data object is associated with a semantic label for characterizing the meaning of its photovoltaic physical quantities and a business importance weight. Target data objects are selected based on the business importance weights, and the current mutation action is selected from a variety of preset mutation action types using a reinforcement learning network based on the relevant information of the target data objects and the operating conditions of the target photovoltaic equipment. Based on the current mutation action, replace the field values ​​in the seed use case that correspond to the target data object, generate a test message, and send the test message to the target device; Collect device response status and behavioral characteristic data of the target device after executing the test message, and calculate a behavioral anomaly score based on the behavioral characteristic data; Feedback signals are generated based on the device response status and the abnormal behavior score. The parameters of the reinforcement learning network are adjusted using the feedback signals, and the test cases that trigger the abnormality are accumulated and output as abnormal fuzzy test cases.

[0007] In one optional implementation, the protocol description information of the target photovoltaic device is obtained, and a protocol semantic model is constructed based on the protocol description information, including: Obtain the protocol description file of the target photovoltaic device, which contains the communication protocol types and field definition information supported by the target photovoltaic device; Multiple field definition records are parsed from the protocol description file, and each field definition record contains at least a field identifier, data type, and physical quantity meaning description; According to the physical quantity meaning description, each field is matched with a corresponding photovoltaic semantic tag, which is used to characterize the type of physical quantity expressed by the field in photovoltaic business; Based on the physical quantity type of the field and / or the photovoltaic semantic tag, set the legal numerical range and business importance weight of each field; Each parsed field is treated as a data object, and the field identifier, data type, legal numerical range, and photovoltaic semantic tag of the data object are associated and stored to construct the protocol semantic model.

[0008] In an optional implementation, the communication protocol type includes Modbus protocol and IEC61850 protocol: When the protocol description file is a Modbus point table, the register address, data type, scaling factor and physical quantity meaning description are parsed from the Modbus point table, and the register address is used as the field identifier. When the protocol description file is an IEC61850 SCL model file, the logical node path, data object and data attribute are parsed from the SCL model file, and the logical node path is used as the field identifier.

[0009] In an optional implementation, each field is matched with a corresponding photovoltaic semantic tag based on the meaning of the physical quantity, including: Construct a semantic mapping table, which contains multiple photovoltaic semantic tags and a set of keywords corresponding to each photovoltaic semantic tag; The physical quantity is matched with the keyword set. If the match is successful, the field is assigned the matched photovoltaic semantic tag. If a match fails, a default semantic label is selected from the semantic mapping table and assigned to the field based on the data type and valid numerical range of the field.

[0010] In an optional implementation, based on the physical quantity type of the field and / or the photovoltaic semantic tag, the legal numerical range of each field is set, including: If the photovoltaic semantic tag of the field belongs to the preset first type of tag, then the legal value range is set according to the photovoltaic physical limit value corresponding to the photovoltaic semantic tag; If the photovoltaic semantic tag of the field belongs to the preset second type of tag, then the range of legal values ​​is set according to the range of allowed protocol format corresponding to the data type of the field; If the physical quantity meaning description of the field contains enumerated value definitions, then the enumerated value list is extracted from the protocol description file as the legal numerical range.

[0011] In an optional implementation, selecting target data objects based on the business importance weight includes: Obtain the current operating status of the target photovoltaic equipment, and determine the corresponding active data object subset based on the current operating status and a preset mapping relationship; Based on the business importance weight of each data object in the active data object subset, the probability of each data object being selected is determined in a positive correlation manner, so that the data object with the higher business importance weight has a greater probability of being selected, and the target data object is selected from the active data object subset based on the probability of being selected.

[0012] In an optional implementation, based on the relevant information of the target data object and the operating condition of the target photovoltaic equipment, a reinforcement learning network is used to select the current mutation action from a preset range of mutation action types, including: Construct status information, which includes the current value, data type, read / write attributes, semantic tags of the target data object, current operating status of the target device, and historical hit rate of the target data object; The current state information is input into the reinforcement learning network as input data, and the reinforcement learning network outputs the selection priority of each of the preset multiple mutation action types; The current mutation action is determined from the preset multiple mutation action types according to the selection priority.

[0013] In an optional implementation, the reinforcement learning network comprises multiple subnetworks, each corresponding to a different communication protocol type. Before inputting the current state information as input data into the reinforcement learning network, the following steps are also included: Determine the type of communication protocol used in the current test message; The corresponding sub-network is invoked according to the communication protocol type, and the mutation action type is selected in the corresponding sub-network.

[0014] In one optional implementation, a feedback signal is generated based on the device response status and the behavior anomaly score, and the mutation strategy is adjusted using the feedback signal, including: The response status type is determined based on the device response status, and the response status type includes at least one of device reset or disconnection, protocol abnormal response, and normal response. The degree of behavioral deviation is determined based on the aforementioned behavioral anomaly score; A reward signal is generated based on the response state type and the degree of deviation of the behavior, and the reward signal is either a positive incentive or a negative penalty; The network parameters of the reinforcement learning network are updated using the reward signal, causing the reinforcement learning network to tend to select mutation actions that can generate higher reward signals.

[0015] In an optional implementation, test cases that trigger exceptions are accumulated and output as exception fuzz test cases, including: Obtain the test message that is determined to trigger an anomaly and its corresponding target data object, the selected mutation action type, the current operating condition, and the behavior anomaly score, and store the above information as an anomaly fuzzy test case record. Multiple records of the aforementioned abnormal fuzz test cases are appended to the abnormal test case database to form an accumulated set of abnormal fuzz test cases. The abnormal fuzz test cases in the aforementioned abnormal fuzz test case set are used as a regression test case set. After the release of a new version of the protocol stack or a new firmware, the abnormal fuzz test cases are re-executed to verify whether the discovered vulnerabilities have been fixed.

[0016] The beneficial effects of this invention are as follows: The fuzzy test case generation method for distributed photovoltaic communication protocols provided by this invention, by assigning photovoltaic semantic tags to data objects, enables the mutation strategy to perceive photovoltaic business semantics such as irradiance, MPPT status, and grid frequency, effectively reducing invalid test cases rejected at the protocol format layer and improving testing efficiency. Simultaneously, it employs a reinforcement learning network to dynamically adjust the mutation strategy based on real-time feedback from the device, ensuring that the mutation direction continuously converges towards high-value areas, overcoming the deficiency of fixed strategies in covering deep logic. This invention also integrates device response status and multi-dimensional behavioral characteristics for anomaly detection, enabling the identification of hidden defects where the device response is normal but the behavior deviates abnormally, breaking through the limitations of a single response code. Furthermore, through a unified multi-protocol adaptation layer, it simultaneously supports ModbusTCP and IEC61850 protocols within a single framework, exhibiting good versatility and portability. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a schematic flowchart of a method according to an embodiment of the present invention.

[0019] Figure 2 This is another illustrative flowchart of a method according to an embodiment of the present invention. Detailed Implementation

[0020] To enable those skilled in the art to better understand the technical solutions of this invention, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this invention.

[0021] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.

[0022] The fuzzy test case generation method for the distributed photovoltaic communication protocol provided in this embodiment of the invention is executed by a computer device, and correspondingly, the fuzzy test case generation system for the distributed photovoltaic communication protocol runs on the computer device.

[0023] Figure 1 This is a schematic flowchart illustrating a method according to an embodiment of the present invention. Wherein, Figure 1 The executing entity can be a fuzzy test case generation system for a distributed photovoltaic communication protocol. Depending on different requirements, the order of the steps in this flowchart can be changed, and some can be omitted.

[0024] like Figure 1 As shown, the method includes: S1. Obtain the protocol description information of the target photovoltaic equipment, and construct a protocol semantic model based on the protocol description information. The protocol semantic model contains multiple data objects, and each data object is associated with a semantic label for characterizing the meaning of its photovoltaic physical quantities and a business importance weight. S2. Select target data objects according to the business importance weights, and select the current mutation action from a variety of preset mutation action types using a reinforcement learning network based on the relevant information of the target data objects and the operating conditions of the target photovoltaic equipment. S3. Based on the current mutation action, replace the field values ​​in the seed use case that correspond to the target data object, generate a test message, and send the test message to the target device; S4. Collect the device response status and behavioral characteristic data of the target device after executing the test message, and calculate the behavioral anomaly score based on the behavioral characteristic data; S5. Generate a feedback signal based on the device response status and the abnormal behavior score, adjust the parameters of the reinforcement learning network using the feedback signal, and accumulate and output the test cases that trigger the abnormality as abnormal fuzzy test cases.

[0025] Please refer to Figure 2 The steps of the method provided by this invention will be described in detail.

[0026] In one embodiment of the present invention, based on step S1, the following will provide a possible embodiment and describe its specific implementation in a non-limiting manner.

[0027] S101. Obtain Protocol Description Information Obtain the protocol description file of the target photovoltaic device. Depending on the communication protocol types supported by the device, the protocol description file includes the following forms: For Modbus protocol devices, obtain their register point table file in Excel (.xlsx), CSV (.csv), or XML (.xml) format. This file must contain at least the register address, register name, data type, read / write attributes, scaling factor, and physical quantity description fields. For IEC 61850 protocol devices, obtain their ICD (IED Capability Description) file or CID (Configured IED Description) file. This file is described in SCL (Substation Configuration Language) and contains the definitions of logical nodes (LN), data objects (DO), and data attributes (DA).

[0028] Parse the protocol description file to extract multiple field definition records. Each record contains at least a field identifier (register address or logical node path), data type, and a description of the physical quantity's meaning.

[0029] S102. Construct a collection of data objects Each parsed field is treated as a data object, forming a collection of data objects:

[0030] Where n is the total number of data objects. Each data object is defined as a 7-tuple:

[0031] The meanings of each component are as follows: : Field identifier, which is the register address (e.g., 40001) for the Modbus protocol and the logical node path (e.g., MMXU1.PPV.cVal) for the IEC61850 protocol. : Data type, ; Read / write attributes: RO indicates read-only, RW indicates read-write. : Valid numerical range To be the minimum value, It is the maximum value; Units of physical quantities, such as V (volt), A (ampere), W (watt), Hz (hertz), ℃ (degrees Celsius), etc. Photovoltaic semantic tags; : Business importance weight. The larger the value, the higher the importance of the data object in the photovoltaic business.

[0032] S103. Matching photovoltaic semantic tags A semantic mapping table is constructed, which pre-defines multiple photovoltaic semantic tags and keyword matching rules corresponding to each semantic tag. The set of photovoltaic semantic tags is as follows:

[0033]

[0034] For each data object The physical quantity descriptions are matched with keywords in the semantic mapping table.

[0035] in The text describing the meaning of the physical quantities for the i-th data object. This is a text matching function, which can be implemented using keyword hit counting or semantic similarity calculation. If a match fails, meaning the matching degree of all semantic tags is below a preset threshold, then the semantic tag of the data object is marked as the default tag. The data object corresponding to the default label will use a general mutation strategy in subsequent mutations.

[0036] Taking irradiance as an example, when the physical quantity description field contains keywords such as irradiance, illumination, radiation, or irradiance, the semantic label of the data object is matched as Irradiance; when the physical quantity description field contains keywords such as frequency, frequency, or Hz, it is matched as Grid_Freq; when it contains keywords such as MPPT, maximum power, or tracking, it is matched as MPPT_Status.

[0037] S104. Set the range of valid values Based on the semantic tags of data objects and data types Set the range of legal values The rules are set as follows: like For semantic tags with explicit photovoltaic physical constraints (such as Irradiance, Grid_Freq, Temperature, etc.), the legal numerical range is set according to the physical limits in the photovoltaic field, for example:

[0038]

[0039]

[0040] like If it is an enumeration type (such as MPPT_Status, Fault_Code), then the list of enumeration values ​​is extracted from the protocol description file as the range of legal values; like for If there are no physical constraints, then it depends on the data type. The protocol format allows setting a valid range of values, for example, setting a uint16 type to... The float32 type is set to the sensor range specified in the device manual.

[0041] S105. Set Business Importance Weights Based on the photovoltaic semantic tags of the data objects Set business importance weights The rules are set as follows: Semantic tags are divided into three levels of importance: First level (highest importance) ): Semantic tags that directly affect power generation safety, including Insulation_Resistance, Grid_Freq, Fault_Code, and protection-related signals; Level 2 (Medium Importance) ): Semantic tags that affect power generation efficiency, including Irradiance, MPPT_Status, and Active_Power; Level 3 (lower importance) ): Semantic tags used to run monitoring records, including Temperature, Voltage, Current, and the data object corresponding to the Default tag.

[0042] S106. Constructing the working condition model Define the set of operating conditions for photovoltaic equipment:

[0043] Where m represents the total number of operating conditions. Each operating condition Modeled as a device state vector:

[0044] in Output power (unit: W). DC bus voltage (unit: V). Direct current (unit: A). This indicates the grid connection status (0 represents off-grid, 1 represents grid connection). This is a fault status identifier for the equipment (a value of 0 indicates no fault, and a non-zero value indicates a fault type code).

[0045] Operating conditions The activation probability is determined by its historical frequency of occurrence:

[0046] in For working conditions The number of times it appears in historical operating data. Historical operating data can be exported from the photovoltaic power plant monitoring system or extracted from equipment log files. If historical data is lacking, the activation probability of each operating condition can be initialized according to a uniform distribution, i.e. And dynamically update based on the sampling results under actual working conditions during subsequent testing. .

[0047] S107. Construct a set of constraints between objects The association rules between fields are parsed from the protocol description file, and combined with the predefined semantic consistency constraints of the photovoltaic business logic, to form a set of constraint relationships between objects. The constraints include, but are not limited to: Length consistency constraints: For example, in the Modbus protocol, the matching relationship between function codes and data lengths; Type consistency constraints: For example, in the IEC61850 protocol, the matching relationship between the ASN.1 encoded Tag and the Length; Semantic consistency constraints: such as the positive correlation between irradiance and active power (higher power output should correspond to higher irradiance), and the synergistic relationship between MPPT state and DC voltage.

[0048] S108. Establish a unified semantic mapping table and complete model storage. For scenarios that support multiple protocols or require cross-protocol testing, a unified semantic mapping mechanism is used to mask the differences in underlying protocols. Specifically, field identifiers from different protocols but expressing the same photovoltaic physical quantity are mapped to the same semantic label. For example, the holding register at address 40001 in the Modbus protocol and the active power data attribute PPV.cVal under logical node MMXU1 in the IEC61850 protocol, although their protocol addressing methods and data type encodings are different, both represent the physical quantity of irradiance in photovoltaic operations, so they are uniformly mapped to the semantic label Irradiance. Similarly, the register at address 40012 in Modbus and MMXU1.Hz.cVal in IEC61850 both represent the physical quantity of grid frequency, and are uniformly mapped to the semantic label Grid_Freq.

[0049] Through the above mapping mechanism, each protocol field is represented as a semantic tag_i in the PPSM model after being transformed by a unified semantic mapping table. Subsequent mutation strategy selection, behavior anomaly scoring, and fitness evaluation are all based on tag_i, thereby shielding the addressing differences, encoding differences, and data type differences of the underlying protocols.

[0050] Semantic tags are used uniformly within the PPSM model. As a unique semantic identifier for data objects, subsequent mutation strategy selection, behavioral anomaly scoring, and fitness assessment are all based on... This process shields the differences in underlying protocols.

[0051] The above data object collection Set of constraint relations and working condition set Store as a PPSM model file in a structured format (JSON or relational database table). In one embodiment of the present invention, based on step S2, the following will provide a possible embodiment and describe its specific implementation in a non-limiting manner.

[0052] S201. Select target data objects based on business importance weight. This sub-step starts from the collection of data objects. Select a data object as the target of the current mutation operation.

[0053] Obtain the current operating status of the target photovoltaic equipment Operating status can be obtained by parsing the status fields in the device response messages, or by reading them in real time from the photovoltaic power plant monitoring system.

[0054] Based on the current operating conditions Based on the preset mapping relationship, determine the subset of active data objects under this working condition. The subset of active data objects corresponding to different operating conditions is predefined in the following way: Under grid-connected power generation conditions, data objects directly related to power generation, such as irradiance, active power, grid frequency, and MPPT status, are active objects. In standby or nighttime operation, only the equipment temperature, fault codes and other status monitoring objects are active, while power generation related objects such as irradiance are inactive. Under fault conditions, fault codes and protection signals are active objects.

[0055] The above mapping relationship can be adjusted according to the actual operating logic of the photovoltaic power station, and those skilled in the art can configure it flexibly according to the equipment type and operating scenario.

[0056] Based on a subset of active data objects Business importance weight of each data object The probability of each data object being selected is determined based on a positive correlation of weights. A roulette wheel selection algorithm is used.

[0057] in For data objects The probability of being selected. This probability satisfies... Data objects with higher business importance weights are more likely to be selected.

[0058] Based on the above probability distribution, the target data object for the current mutation operation is determined by roulette wheel sampling. That is, from According to probability Randomly select a data object as the target of the current mutation action.

[0059] In a preferred embodiment, the aforementioned basic probabilities are further corrected using historical feedback. Specifically, each data object is maintained. Historical abnormal hit rate :

[0060] in For data objects The total number of times an exception was triggered after being selected in historical mutations. for The total number of times it was selected as a mutation target. If ,but .according to right After weighted adjustment, the comprehensive selection weight is obtained. :

[0061] in This is the adjustment coefficient based on historical feedback, and its value range is... The preferred value is .when At that time, it degenerates into being solely composed of The method for selecting the driver. Then, using... Alternative Calculate the probability of selection:

[0062] This mechanism prioritizes data objects that are historically more likely to trigger exceptions in subsequent tests.

[0063] S202. Select the current mutation action using a reinforcement learning network. This sub-step utilizes a reinforcement learning network to dynamically select the matching current mutation action from a variety of preset mutation action types based on the relevant information of the target data object and the operating conditions of the target device.

[0064] Determine the target data object Next, the input state vector of the reinforcement learning network is constructed. The state information includes at least the following dimensions: Semantic tags : Read directly from the PPSM model, indicating the photovoltaic physical quantity type of the data object; Current value : Read the current value of the corresponding field of the data object in the seed use case; Data types : Read from the PPSM model, representing the data format of the data object; Read and write attributes : Read from the PPSM model, indicating that the data object is read-only or read-write; Valid numerical range : Read from the PPSM model to define the reference interval for the variation; Current operating conditions : Obtained in real time from device response or monitoring system; Historical hit rate The ratio of the number of times the data object triggered an exception after being mutated in historical tests to the total number of times it was mutated; Protocol parser current state : Obtained in real time from the protocol parser, indicating the current stage of message parsing.

[0065] Each component in the above state information is represented numerically before being input into the network. Semantic labels are among the components. and working conditions The protocol parsing state is mapped to a numerical vector using a preset encoding. It is represented by a status number.

[0066] The state information is concatenated into a feature vector, which is then input into the reinforcement learning network as input data.

[0067] In a preferred embodiment, the reinforcement learning network is a Deep Q-Network (DQN), whose network structure includes an input layer, at least one hidden layer, and an output layer. The number of nodes in the input layer is equal to the dimension of the state feature vector. The hidden layer adopts a fully connected structure, preferably with two layers, each containing 128 neurons, and the activation function is the ReLU function. The number of nodes in the output layer is equal to the number of preset mutation action types, and each output node corresponds to one mutation action type, with the output value being the Q-value corresponding to that action type.

[0068] Preset set of mutation action types include: Boundary mutation: Sets a value to the upper or lower limit of the legal range, or a value that exceeds the upper or lower limit; Overflow mutation: Sets a value to a maximum or minimum value that is far beyond the legal range; SignFlip: Changes the sign of a number; Type Confusion: Constructing a value using a parsing method different from the data type; Semantic Violation: Setting a value to a value that does not violate the protocol format but violates the physical laws of photovoltaics; Sequence Mutation: Changes the order of fields in a message or inserts abnormal message segments.

[0069] After the state feature vector is input into the reinforcement learning network, the network performs forward propagation calculations, and the output layer outputs the selection priority corresponding to each mutation action type. In a preferred embodiment, the selection priority is represented by a Q-value, where a higher Q-value indicates a greater expected cumulative reward after performing the mutation action in the current state.

[0070] Based on the selection priority of the reinforcement learning network output, the current mutation action is determined from a variety of preset mutation action types.

[0071] In one implementation, a greedy strategy is used, directly selecting the mutation action type with the largest Q value as the current mutation action:

[0072] in For a set of mutated action types, To enhance the learning network in state Next action The output Q value, These are network parameters.

[0073] In another implementation, using -greedy strategy: based on probability Select the action with the highest Q value, with probability. One action is randomly selected from all actions to balance utilization and exploration. The initial value is set to 0.3, and it decays exponentially with each test round.

[0074] Furthermore, in a preferred embodiment, before the reinforcement learning network determines the current mutation action, the semantic labels of the target data object are also considered. The action space is pre-filtered. Specifically, based on the pre-defined mapping relationship between semantic tags and variant action types, variant action types that do not match the semantic tag are filtered out, and action types are only filtered out from the subset of candidate actions. Selection of reinforcement learning networks for implementation:

[0075] For example, for semantic labels as For data objects with semantic violation mutations and boundary value mutations, only semantic violation mutations and boundary value mutations are retained as candidate actions; for semantically labeled data objects... The data objects are pre-selected, retaining boundary value mutation, overflow mutation, sign flip mutation, and type confusion mutation as candidate actions. This pre-screening mechanism narrows the action selection space and improves the decision-making efficiency and accuracy of reinforcement learning networks.

[0076] The final selected current mutation action Output.

[0077] In one embodiment of the present invention, based on step S3, the following will provide a possible embodiment and describe its specific implementation in a non-limiting manner.

[0078] S301. Generate the variant values ​​of the target data object. Based on the current mutation action The type, combined with the target data object data types Valid numerical range and current value Generate specific mutated values The methods for generating mutated values ​​for different mutation action types are as follows: when When performing boundary value mutation: select one of the following candidate values ​​as the mutation value. :

[0079] in and Used to test the device's processing logic when the data exceeds the legal boundaries.

[0080] when For overflow mutations: based on data type Generate extreme values ​​that far exceed the legal range:

[0081] in The bit width of the data type, such as uint16. The maximum value is .

[0082] when When performing a sign-flipping mutation: the sign of the current value is inverted.

[0083] when When type confusion occurs: This is related to the original data type. Different parsing methods construct mutated values. For example, if the original type is float32, a random integer is selected. The integer is reinterpreted as a floating-point number using the float32 byte representation:

[0084] in for A random integer within the specified range. If the original type is an integer, the byte representation of the floating-point number or string is directly filled into the integer field.

[0085] when For semantic violation variations: based on the semantic tags of the target data object. Generate values ​​that do not violate the protocol format specifications but violate the physical laws of photovoltaics or business logic:

[0086] Semantic violation mutations generated It is completely legal at the protocol format level (data type matches, byte length is correct), but the value it carries is impossible or should not appear in a photovoltaic physical scenario.

[0087] when When it is a sequence mutation: the mutation does not generate field replacement values, but rather operates at the message structure level.

[0088] S302. Replace the mutated value with the corresponding field in the seed test case. Retrieve the raw message data for the current seed use case. A seed use case is a complete protocol message, stored as a sequence of bytes:

[0089] in This represents the total length of the message (in bytes).

[0090] Based on the target data object Field identifier Determine its offset position in the seed use case message. and field length : For the Modbus protocol, based on the register address The protocol specification calculates the starting byte offset and length of the register in the message data field (e.g., a holding register occupies 2 bytes). For the IEC61850 protocol, the encoding / decoding position of the data attribute in the MMS message is determined based on the logical node path and SCL model definition, and is synchronously recorded and cached by the protocol parser when parsing the seed use case.

[0091] If the field value for this data object does not yet exist in the current seed use case, it will be initialized and populated with the default value or the middle value of the valid value range:

[0092] The generated mutated values According to data type The corresponding encoding format (such as big-endian, little-endian, IEEE 754 floating-point format, ASCII encoding, etc.) is converted into a byte sequence:

[0093] Then Write to seed use case message Replace the original field value at the location to obtain the mutated message data. :

[0094] when When performing sequence mutation, instead of performing field replacement, the message structure is manipulated, including at least one of the following methods: rearranging the order of multiple fields in the current message and recombining them, or inserting a preset abnormal message segment (such as additional CRC bytes, duplicate function codes, etc.) into the message to generate a test message with an abnormal structure.

[0095] S303. Construct a test message conforming to the protocol specification. The mutated message data after replacing field values Assemble into a complete test message that can be transmitted over the network.

[0096] Specifically, the modified message data is encapsulated for protocol compliance according to the communication protocol requirements of the target device: For the Modbus TCP protocol, the message length field (the Length field in the MBAP header) is recalculated, and the CRC16 checksum is recalculated and padded to the end of the message as needed. The CRC16 calculation formula is:

[0097] in This is to remove the data field portion after the MBAP header.

[0098] For the IEC61850 protocol (based on MMS / ASN.1 encoding), the Length field value in the BER-TLV encoding is recalculated according to the SCL model, and the modified message is fully encapsulated with ASN.1 structural integrity to ensure that the message is syntactically complete and can pass the initial parsing of the protocol stack.

[0099] If the mutation action type is sequence mutation, the mutated message structure is directly used as the test message without additional length or verification correction (thus testing the protocol stack's ability to handle abnormal structures); if it is other types of mutation, the verification field is recalculated according to the above rules to ensure that the test message can pass the underlying integrity verification and reach the application layer protocol parsing logic, thereby covering deeper code paths.

[0100] The final encapsulated test message is represented as follows:

[0101] S304. Send a test message to the target device. The generated test message is transmitted through the communication interface. Send to the target photovoltaic device. The sending method depends on the network environment: If the target device is connected via Ethernet, use the TCP / IP or UDP / IP protocol stack to send messages. For ModbusTCP, establish a TCP connection with port 502 of the target device before sending; for IEC61850, use the MMS protocol stack or GOOSE / SMV multicast messages for sending.

[0102] Record the timestamp of the sending time when sending. This is used in subsequent steps to calculate the change in response delay. .

[0103] After sending, start a response receiving timer to wait for a response message or behavioral feedback from the target device. If the preset timeout period applies... If no response is received, it is determined to be a communication disconnection anomaly; if a response is received, behavioral characteristics are collected and anomaly scoring is performed.

[0104] In one embodiment of the present invention, based on step S4, the following will provide a possible embodiment and describe its specific implementation in a non-limiting manner.

[0105] S401. Data Acquisition Device Response Status After sending the test message, a response reception timer is started to wait for the target device's response message or behavioral feedback. The collection of response status includes the following three categories: (1) Equipment reset or communication disconnection detection If within the preset timeout period If no response message is received from the target device, and there is still no response after a preset number of retransmission attempts (e.g., 3 times), it is determined that the communication link is broken. If the target device automatically restarts and resends the online notification (such as a Modbus device startup message or an IEC61850 association request) after sending the test message, it is determined that the device has been reset. Both of the above situations are recorded as device-level anomalies, and the corresponding indicator functions are... .

[0106] (2) Detection of abnormal protocol responses If a response message from the target device is received within the timeout period, the status field is extracted from the response message to determine whether a protocol layer exception code is returned. For the Modbus protocol, the function code in the response message is checked to see if it equals the requested function code plus 0x80 (an exception response identifier). If so, the exception code field (such as illegal function code, illegal data address, illegal data value, etc.) is further extracted. For the IEC61850 protocol, the error flag bits in the MMS protocol layer or GOOSE message are checked. If a protocol exception response is detected, the exception code type is recorded, and the indicator function is set. .

[0107] (3) Normal response record If the response message does not contain any of the above abnormal states, that is, the device returns a normal data response without reset or disconnection, it is determined to be a normal response, and the indicator function is set. .

[0108] S402. Collect behavioral feature data For both normal responses and responses containing protocol anomalies, multi-dimensional behavioral data of the device is collected before and after sending the test message to form a behavioral feature vector. The behavioral feature data is collected once before and once after each test message execution.

[0109] Define time The behavioral feature vector is:

[0110] The methods for collecting and calculating each component are as follows: (1) Change in response time delay

[0111] Record the time when the test message is sent. and the time when the complete response message is received Calculate the current response latency:

[0112] Query the historical average response time of the target device. (take the nearest) The moving average of response latency for a normal interaction. (Preferred value is 100), calculate the change in response delay:

[0113] in It is a very small positive number (e.g.) This is to prevent division by zero errors. A positive value indicates a slower response, a negative value indicates a faster response, and a larger absolute value indicates a more significant deviation in behavior.

[0114] (2) Change in active power

[0115] Before sending the test message, read the current active power value from the target device's response message or the monitoring system. After sending the test message and receiving the response, the active power value is read again. Calculate the change in active power:

[0116] in This is the rated power of the device (in W), used to normalize variations to a dimensionless value. If the test message triggers an abnormal power jump (sudden increase or decrease), the absolute value of this component will increase significantly.

[0117] (3) DC voltage change

[0118] Similar to the active power acquisition method, the DC bus voltage value is read before and after sending the test message. and Calculate the change in DC voltage:

[0119] in This is the rated DC voltage of the device (unit: V), used for normalization.

[0120] (4) Changes in power grid status

[0121] Read the power grid connection status field of the target device; this field contains discrete enumerated values. (Definition) Indicates an offline status. This indicates the grid connection status. If the test message causes this status to switch, then:

[0122] (5) Protocol state machine changes

[0123] Read the current state number of the target device's protocol state machine. The protocol state machine refers to the current parsing or interaction phase state of the device's communication protocol stack, such as the initialization state, connection establishment state, data exchange state, and closing state. If the test message causes an illegal jump in the protocol state (e.g., a direct jump from the data exchange state to the initialization state without passing through the closing state), then:

[0124] If the device does not explicitly provide protocol state machine information, the state change can be indirectly inferred by analyzing changes in fields such as session identifier and sequence number in the response message.

[0125] S403. Constructing a behavioral anomaly scoring model The behavioral anomaly scoring model is implemented using the Logistic Regression algorithm. The model uses the aforementioned behavioral feature vectors... As input, output a score value between 0 and 1. The score indicates the degree of abnormality in the current device behavior; a higher score indicates a more significant abnormality.

[0126] The logistic regression model is defined as:

[0127] in The weight coefficient vector for each behavioral feature is obtained through offline training using historical anomaly samples.

[0128] S404. Training process of the behavioral anomaly scoring model Before the system is put into use, the behavior anomaly scoring model needs to be trained to determine the weight vector. The training process is as follows: (1) Constructing the training dataset Extract positive and negative samples from historical test logs. Positive samples are labeled as abnormal samples if any of the following conditions are met: device reset or connection loss, return of a protocol error code, physical quantity mutation rate exceeding 20%, or illegal transition of the protocol state machine. The labeling criteria for negative samples are: normal response, stable changes in all physical quantities with a rate of change of less than 5%, and state machine transitions according to specifications. Samples meeting all these criteria are labeled as normal samples. .

[0129] The definition of the mutation rate of a physical quantity is:

[0130] When the mutation rate is greater than 20%, it is considered that an abnormal mutation of physical quantity has occurred.

[0131] Each sample consists of a feature vector. and tags Composition, collection The training set consists of 10 samples. .

[0132] (2) Define the loss function Using belt A regularized weighted cross-entropy loss function is used to address class imbalance when outliers are far fewer than normal samples.

[0133] in For the model to the first The predicted value for each sample, The weights for positive samples are set to 3 to 5 times the weights for negative samples, with a preferred value of 4 times. This is the regularization coefficient, used to prevent overfitting.

[0134] (3) Optimization solution The loss function is optimized using stochastic gradient descent. The update formula for the weight vector is:

[0135] in The learning rate is preferably set to 0.01. Iterate training until the loss function converges (the change in loss value is less than 0.01 over 10 consecutive iterations). Alternatively, the maximum number of iterations (e.g., 1000) can be reached to obtain the trained weight vector. .

[0136] S405. Calculate behavioral abnormality scores and determine abnormalities. During the online testing phase, the behavioral feature vectors collected after each execution of the test message... ,Will Input the trained logistic regression model to calculate the behavioral anomaly score:

[0137] The calculated Compared with the preset judgment threshold Compare and determine the threshold. The preferred value is 0.85, which can be adjusted according to the specific equipment type and safety requirements (the value range is usually 0.7 to 0.9).

[0138] like If the current device behavior is abnormal, the current test message is marked as a test case that triggered the abnormality, and the abnormality score at this time is recorded. and the collected behavioral feature vectors This is used for subsequent steps to accumulate output and for genetic algorithm optimization. If If the current behavior is normal, the next round of mutation testing will continue.

[0139] In some implementations, it is also based on The numerical range is used to classify the severity of the anomaly, for example: This is a high-risk abnormality. It is an intermediate-risk abnormality. This is classified as a low-risk anomaly, and will be used for subsequent report generation and priority sorting.

[0140] In one embodiment of the present invention, based on step S5, a possible embodiment will be given below, and its specific implementation will be described in a non-limiting manner.

[0141] S501. Generate feedback signals based on equipment response status and abnormal behavior scores. Feedback signals in the form of reward values The reward value is quantitatively represented in the form of a quantification, indicating the quality of the current mutated action. The generation of the reward value comprehensively considers the device response status collected in step four and the calculated behavioral anomaly score.

[0142] Specifically, the response status type is determined based on the device's response status, which includes at least one of device reset or disconnection, protocol anomaly response, and normal response. The degree of behavioral deviation is then determined based on a behavioral anomaly score. A reward signal is then generated based on the response status type and the degree of behavioral deviation, according to the following rules: Device reset or communication disconnection: When a device reset or communication disconnection is detected, it indicates that the current mutation has successfully triggered a device-level anomaly, which is the most valuable test result. At this point, an indicator function is set. Assign the first positive reward value :

[0143] in The first positive reward value is the highest among all reward scenarios.

[0144] Protocol Error Response: When the device returns a protocol layer error response, it indicates that the current mutation has triggered an exception handling branch in the protocol stack, which has some testing value. At this time, setting an indicator function... Assign a second positive reward value :

[0145] in The second positive reward value is lower than the first positive reward value but higher than the normal response value.

[0146] Normal response but abnormal behavior: When the device returns a normal response (i.e., no protocol layer anomaly), but the behavior is abnormally rated. Greater than the preset threshold This indicates that although the device returns to normal at the protocol level, its operational behavior has deviated abnormally, which is a hidden defect. In this case, the abnormal behavior score is used directly as the source of reward.

[0147] in This is the weighting coefficient for rewards based on abnormal behavior. Because... The value range of this reward is: This processing method avoids [the following issues]: The instantaneous drop in reward has a negative impact, ensuring that the optimization direction of reinforcement learning is completely consistent with the vulnerability discovery goal.

[0148] Normal response and normal behavior: When the device returns a normal response and the behavior is abnormal, a score is given. Less than or equal to the preset threshold If this occurs, it indicates that the current mutation has no effect on the device and is considered an invalid test. In this case, an indicator function should be set. Assign a negative penalty value:

[0149] in This represents a slight penalty for invalid tests. This penalty causes reinforcement learning networks to tend to avoid selecting mutation actions that are known to be difficult to trigger anomalies.

[0150] S502. Calculate the temporal difference objective and update the reinforcement learning network parameters. Utilize the generated reward value Update reinforcement learning network The parameters enable the network's subsequent decisions to tend to select mutation actions that can generate higher reward values.

[0151] Using Deep Q-Network (DQN) as the preferred implementation of reinforcement learning network, its parameter update process is as follows: (1) Storing experience samples Record the decision-making process at the current moment as an experience sample and store it in the experience replay pool. :

[0152] in: This includes execution status information (including semantic tags, current values, data types, read / write attributes, current operating conditions, historical hit rates, and protocol parser status). For the current mutation action ; This is the reward value; The new state information to be constructed after the current mutation action is executed and the next round is entered.

[0153] The capacity of the experience replay pool is no less than For each sample, when the storage capacity reaches its limit, the oldest sample is discarded according to the first-in, first-out principle.

[0154] (2) Sample training data When the number of experience samples accumulated in the experience replay pool reaches a preset threshold (such as...) After that, a small batch of samples is randomly sampled from the experience replay pool:

[0155] in For small batch sizes, the preferred value is [value]. or .

[0156] (3) Calculate the time-series difference objective For each empirical sample in the mini-batch, the temporal difference (TD) target value is calculated according to the Bellman optimal equation:

[0157] in: This is the discount factor, with a value of [value missing]. The preferred value is This is used to balance the importance of current rewards and future rewards; For the target network in state Next action The output Q value; The target network parameter is periodically obtained from the main network parameter. Replication is performed within the system to stabilize the training process; For the target network in state The maximum Q-value of the output for all actions represents the expected optimal reward that can be obtained in the future.

[0158] (4) Calculate the loss function and update the network parameters. Using mean squared error as the loss function, the difference between the main network output Q-value and the time-difference target value is calculated:

[0159] in The main network in its current state The following are the actual actions to be performed. The output Q value.

[0160] Update the main network parameters using gradient descent. :

[0161] in To enhance the learning rate, the optimal value is [value to be filled in]. to .

[0162] Each time a preset number (e.g.) is executed After the mutation operation (step), the main network parameters are... Copy to the target network:

[0163] The network update execution frequency is every execution After each mutation, a small batch of training is performed to control computational overhead.

[0164] S503. Accumulate and output test cases that trigger exceptions as exception fuzzy test cases. When the score for abnormal device response status or behavior exceeds the corresponding threshold, the current test case is marked as an abnormal fuzzy test case, and then accumulated, stored, and output.

[0165] (1) Constructing anomaly fuzz test case records For test cases marked as exceptions, construct a complete exception fuzz test case record, including the following information: the original byte sequence of the test message. Identifier of the target data object and semantic tags The selected variant action type ; Field value before mutation With the mutated field value Behavioral abnormality score Current operating conditions Timestamp and response latency Device response status type (device reset / protocol error / normal response but abnormal behavior).

[0166] The above information is associated and stored as a single abnormal fuzz test case record:

[0167] (2) Deduplication of abnormal test cases Before storing the current abnormal test case into the abnormal test case database, perform deduplication to improve the quality of abnormal test cases.

[0168] For a currently pending abnormal fuzz test case, calculate the similarity between its test message and the test messages of existing abnormal fuzz test cases in the abnormal test case database. The similarity calculation method is as follows: compare the degree of difference between the two test messages in three dimensions: protocol header fields, mutation positions, and mutation values. Two messages with the same mutation positions have a higher similarity than two messages with different mutation positions.

[0169] When the similarity is greater than a preset threshold (preferably 0.9), the current abnormal fuzz test case is determined to be a duplicate test case and is discarded, or the trigger frequency of the existing test case is updated without adding it to the database. When the similarity is less than or equal to the preset threshold, the current abnormal fuzz test case is stored as a new test case in the abnormal test case database.

[0170] (3) Hierarchical storage of abnormal test cases Based on behavioral abnormality score The numerical range is used to record the associated anomaly severity level for each anomaly fuzzy test case. The anomaly severity level includes at least three levels: high-risk, medium-risk, and low-risk.

[0171] The abnormal test case database is stored hierarchically according to the severity level of the abnormality, with abnormal test cases of the same severity level stored together for easy subsequent querying and analysis.

[0172] (4) Cumulative output Anomaly fuzz test cases are appended to an anomaly test case database, forming a cumulative set of anomaly fuzz test cases. Upon user query or completion of testing, the cumulative set of anomaly test cases is output as an anomaly fuzz test case report. The report displays each anomaly fuzz test case in descending order of anomaly severity, and each anomaly fuzz test case includes at least the original byte sequence of the test message, the mutation location, the field values ​​before and after the mutation, and a behavioral anomaly score.

[0173] S504. The dual moderating effect of feedback signals on mutation strategies Feedback signal (reward value) The mutation strategy is adjusted through the following two paths, which work synergistically to drive test cases to converge towards high-value regions: Path 1: Adjusting the selection of mutation actions by updating network parameters through reinforcement learning Reward Value Through temporal difference objective Affecting the loss function Then, the network parameters are updated through gradient descent. Specifically, when a mutation action generates a high reward, the Q-value corresponding to that action is updated to be closer to the positive target value, increasing the probability that the action will be selected in similar future states; conversely, the Q-value corresponding to a mutation action that generates a penalty is lowered, reducing the probability of it being selected in the future. Through this mechanism, the decision-making strategy of the reinforcement learning network is gradually adjusted towards higher rewards.

[0174] Path Two: Influencing the selection of target data objects through historical hit rates Historical anomaly hit rate for each data object It updates dynamically as the testing process progresses. Specifically, when a data object is selected as a mutation target and an exception is successfully triggered (i.e., the test case is marked as an anomalous fuzz test case), the data object... Increase; regardless of whether an exception is triggered, this data object All increased. Updated This further influences the overall selection weight of each data object. This alters the probability distribution of data objects being selected in subsequent rounds. This path ensures that data objects with high business importance and a high historical anomaly trigger rate receive higher sampling priority in subsequent tests.

[0175] The two paths described above are independent of each other, operating at two different stages of the mutation process (data object selection and mutation action selection), and share the same feedback signal source, enabling efficient feedback of anomaly detection results to the front-end stage of test case generation. The two paths can be implemented independently or collaboratively.

[0176] Although the present invention has been described in detail with reference to the accompanying drawings and preferred embodiments, the present invention is not limited thereto. Various equivalent modifications or substitutions can be made to the embodiments of the present invention by those skilled in the art without departing from the spirit and essence of the invention, and such modifications or substitutions should all be within the scope of the present invention. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should also be covered within the protection scope of the present invention.

Claims

1. A method for generating fuzz test cases for a distributed photovoltaic communication protocol, the method comprising: include: Obtain the protocol description information of the target photovoltaic equipment, and construct a protocol semantic model based on the protocol description information. The protocol semantic model contains multiple data objects, and each data object is associated with a semantic label for characterizing the meaning of its photovoltaic physical quantities and a business importance weight. Target data objects are selected based on the business importance weights, and the current mutation action is selected from a variety of preset mutation action types using a reinforcement learning network based on the relevant information of the target data objects and the operating conditions of the target photovoltaic equipment. Based on the current mutation action, replace the field values ​​in the seed use case that correspond to the target data object, generate a test message, and send the test message to the target device; Collect device response status and behavioral characteristic data of the target device after executing the test message, and calculate a behavioral anomaly score based on the behavioral characteristic data; Feedback signals are generated based on the device response status and the abnormal behavior score. The parameters of the reinforcement learning network are adjusted using the feedback signals, and the test cases that trigger the abnormality are accumulated and output as abnormal fuzzy test cases.

2. The method according to claim 1, characterized in that, Obtain the protocol description information of the target photovoltaic device, and construct a protocol semantic model based on the protocol description information, including: Obtain the protocol description file of the target photovoltaic device, which contains the communication protocol types and field definition information supported by the target photovoltaic device; Multiple field definition records are parsed from the protocol description file, and each field definition record contains at least a field identifier, data type, and physical quantity meaning description; According to the physical quantity meaning description, each field is matched with a corresponding photovoltaic semantic tag, which is used to characterize the type of physical quantity expressed by the field in photovoltaic business; Based on the physical quantity type of the field and / or the photovoltaic semantic tag, set the legal numerical range and business importance weight of each field; Each parsed field is treated as a data object, and the field identifier, data type, legal numerical range, and photovoltaic semantic tag of the data object are associated and stored to construct the protocol semantic model.

3. The method according to claim 2, characterized in that, The communication protocol types include Modbus protocol and IEC61850 protocol: When the protocol description file is a Modbus point table, the register address, data type, scaling factor and physical quantity meaning description are parsed from the Modbus point table, and the register address is used as the field identifier. When the protocol description file is an IEC61850 SCL model file, the logical node path, data object and data attribute are parsed from the SCL model file, and the logical node path is used as the field identifier.

4. The method according to claim 2, characterized in that, Based on the physical quantity meaning description, each field is matched with a corresponding photovoltaic semantic tag, including: Construct a semantic mapping table, which contains multiple photovoltaic semantic tags and a set of keywords corresponding to each photovoltaic semantic tag; The physical quantity is matched with the keyword set. If the match is successful, the field is assigned the matched photovoltaic semantic tag. If a match fails, a default semantic label is selected from the semantic mapping table and assigned to the field based on the data type and valid numerical range of the field.

5. The method according to claim 2, characterized in that, Based on the physical quantity type of the field and / or the photovoltaic semantic tag, define the legal numerical range for each field, including: If the photovoltaic semantic tag of the field belongs to the preset first type of tag, then the legal value range is set according to the photovoltaic physical limit value corresponding to the photovoltaic semantic tag; If the photovoltaic semantic tag of the field belongs to the preset second type of tag, then the range of legal values ​​is set according to the range of allowed protocol format corresponding to the data type of the field; If the physical quantity meaning description of the field contains enumerated value definitions, then the enumerated value list is extracted from the protocol description file as the legal numerical range.

6. The method according to claim 1, characterized in that, Target data objects are selected based on the aforementioned business importance weights, including: Obtain the current operating status of the target photovoltaic equipment, and determine the corresponding active data object subset based on the current operating status and a preset mapping relationship; Based on the business importance weight of each data object in the active data object subset, the probability of each data object being selected is determined in a positive correlation manner, so that the data object with the higher business importance weight has a greater probability of being selected, and the target data object is selected from the active data object subset based on the probability of being selected.

7. The method according to claim 1, characterized in that, Based on the relevant information of the target data object and the operating condition of the target photovoltaic equipment, a reinforcement learning network is used to select the current mutation action from a variety of preset mutation action types, including: Construct status information, which includes the current value, data type, read / write attributes, semantic tags of the target data object, current operating status of the target device, and historical hit rate of the target data object; The current state information is input into the reinforcement learning network as input data, and the reinforcement learning network outputs the selection priority of each of the preset multiple mutation action types; The current mutation action is determined from the preset multiple mutation action types according to the selection priority.

8. The method according to claim 7, characterized in that, The reinforcement learning network comprises multiple subnetworks, each corresponding to a different communication protocol type. Before inputting the current state information as input data into the reinforcement learning network, the network further includes: Determine the type of communication protocol used in the current test message; The corresponding sub-network is invoked according to the communication protocol type, and the mutation action type is selected in the corresponding sub-network.

9. The method according to claim 1, characterized in that, Based on the device response status and the behavioral anomaly score, a feedback signal is generated, and the mutation strategy is adjusted using the feedback signal, including: The response status type is determined based on the device response status, and the response status type includes at least one of device reset or disconnection, protocol abnormal response, and normal response. The degree of behavioral deviation is determined based on the aforementioned behavioral anomaly score; A reward signal is generated based on the response state type and the degree of deviation of the behavior, and the reward signal is either a positive incentive or a negative penalty; The network parameters of the reinforcement learning network are updated using the reward signal, causing the reinforcement learning network to tend to select mutation actions that can generate higher reward signals.

10. The method according to claim 1, characterized in that, Test cases that trigger exceptions will be accumulated and output as exception fuzzy test cases, including: Obtain the test message that is determined to trigger an anomaly and its corresponding target data object, the selected mutation action type, the current operating condition, and the behavior anomaly score, and store the above information as an anomaly fuzzy test case record. Multiple records of the aforementioned abnormal fuzz test cases are appended to the abnormal test case database to form an accumulated set of abnormal fuzz test cases. The abnormal fuzz test cases in the aforementioned abnormal fuzz test case set are used as a regression test case set. After the release of a new version of the protocol stack or a new firmware, the abnormal fuzz test cases are re-executed to verify whether the discovered vulnerabilities have been fixed.