Control logic code key point location identification method and system based on data dependence

Through the control logic code identification method based on data dependence, the problem of key point recognition in industrial control systems is solved, and more efficient and accurate key point recognition and dynamic adaptability are achieved.

CN119225201APending Publication Date: 2024-12-31GUANGZHOU UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411195515.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

The identification of key points in existing industrial control systems relies on manual methods, which are subjective, inefficient, difficult to adapt to complex systems and large amounts of data processing, and the response speed is not timely enough to meet the needs of modern industrial control systems.

Method used

Using the control logic code recognition method based on data dependence, the control logic code is converted into readable sentences by constructing a lexical analyzer, establishing a dependency subgraph of points, and using the weight dependency attenuation model to calculate the dependency score of points to identify Control key points in the logic code.

Benefits of technology

It improves the accuracy and efficiency of key point identification, reduces manual intervention, better adapts to the needs of modern industrial control systems, and enhances the dependency processing capabilities and dynamic adaptability of complex systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119225201A_ABST
    Figure CN119225201A_ABST
Patent Text Reader

Abstract

The invention discloses a control logic code key point identification method and system based on data dependence, and the method comprises the steps: constructing a lexical analyzer of a control logic code, and converting the control logic code into a readable control logic sentence; constructing data dependency of the control logic code, and establishing a dependency subgraph of each point location in the control logic code; and constructing a weight dependency attenuation model, calculating dependency scores of the point locations, and identifying key point locations in the control logic code. According to the method, the accuracy and efficiency of key point location identification can be improved while manual intervention is reduced, so that the requirements of a modern industrial control system are better met, and the method can be widely applied to the technical field of industrial control systems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of industrial control systems, and in particular to a method and system for identifying key points of control logic codes based on data dependency. Background Art

[0002] Modern industrial control systems (ICS) have been widely used in various automation scenarios. These systems rely on complex control logic to achieve precise control of production processes. In these control systems, points refer to variables of programmable logic controllers (PLCs), which are divided into program tags and controller tags according to the access scope. Among them, key points refer to points that play a vital role in controlling and monitoring ICS physical processes. Therefore, the identification and monitoring of key points are crucial. Accurate identification of key points can help operators better understand the system status, detect anomalies in time, and take appropriate control measures.

[0003] Currently, in industrial control systems, the identification of key points mainly relies on manual methods, that is, relying on experienced experts and engineers to make judgments and analyses based on prior knowledge. This method has a certain effectiveness in the past industrial development stage, especially when the system is small in scale and low in complexity. Experts usually identify key points through the following steps:

[0004] (1) System understanding: Experts have an in-depth understanding of the system’s design, operating logic, and historical data. Based on actual operating experience, they make a preliminary judgment on which points may have a significant impact on the system’s stability and efficiency.

[0005] (2) Fault analysis: By analyzing the system's historical fault data, experts can determine which points have frequently experienced problems in past operations, thereby identifying potential critical points.

[0006] (3) Prior knowledge: Combining general knowledge in the industry and experience in specific application scenarios, experts can further confirm key points.

[0007] These key point identification methods mainly rely on expert experience and prior knowledge, and can achieve good results in some cases. However, as the scale and complexity of industrial control systems continue to increase, traditional methods have exposed many shortcomings:

[0008] (1) Reliance on manual judgment: The reliance on expert experience makes the key point identification process highly subjective, and the results are easily affected by personal experience. Faced with increasingly complex control systems, the relationship between variables has become more diverse and complex, and manual methods are difficult to fully consider all possible factors and dependencies.

[0009] (2) Inefficiency: The manual analysis process is cumbersome and time-consuming. Especially when the system complexity increases, the workload of identifying key points will increase significantly. The amount of data in modern industrial systems is huge, and manual recognition methods are difficult to effectively process and analyze this data, which affects the accuracy of key point recognition.

[0010] (3) Poor scalability: When the system scale expands or the control logic changes, traditional methods are difficult to adapt and may require re-analysis and identification of key points.

[0011] (4) Insufficient response speed: Changes in system status may require real-time updates of key points, but manual methods are difficult to meet this requirement, which may cause the industrial control system to miss the critical opportunity to deploy the defense system and expose key points to attackers. Summary of the invention

[0012] The main purpose of the embodiments of the present invention is to propose a control logic code key point identification method and system based on data dependence, which can improve the accuracy and efficiency of key point identification while reducing human intervention, so as to better meet the needs of modern industrial control systems.

[0013] To achieve the above purpose, an embodiment of the present invention provides a method for identifying key points of a control logic code based on data dependency, comprising the following steps:

[0014] Construct a lexical analyzer for the control logic code and convert the control logic code into readable control logic sentences;

[0015] Constructing data dependency of the control logic code and establishing a dependency subgraph for each point in the control logic code;

[0016] Construct a weight dependency decay model, calculate the dependency scores of points, and use it to identify key points in the control logic code.

[0017] In some embodiments, the lexical analyzer for constructing the control logic code converts the control logic code into a readable control logic sentence, including the following steps:

[0018] The control logic code in the form of STL language includes operation code and operand; wherein the operation code indicates the operation to be performed, and the operand indicates the specific input value, output value or constant value;

[0019] Distinguish and parse the opcode and operand of the control logic code, and perform intermediate representation on the STL statement according to the type characteristics of the opcode to obtain the intermediate representation form;

[0020] According to the intermediate representation of the STL statement, a readable control logic sentence of the control logic code is obtained.

[0021] In some embodiments, the type characteristics of the operation code include logic operation, set operation and edge detection operation;

[0022] Wherein, the logic operation includes AND operation, AND NOT operation, OR operation, and OR NOT operation;

[0023] The setting operation includes a SET operation and a RESET operation;

[0024] The edge detection operation includes an FP operation and an FN operation.

[0025] In some embodiments, constructing the data dependency of the control logic code and establishing the dependency subgraph of each point in the control logic code includes the following steps:

[0026] Dividing the control logic code into points; the points are used to represent variables associated with physical input, output and storage in the PLC;

[0027] According to the divided points, dependency point bytes are established in the form of point byte representation, and then the dependency subgraph of each point is determined according to the dependency point bytes.

[0028] In some embodiments, the step of establishing dependency point bytes according to the divided points in the form of point bytes, and then determining the dependency subgraph of each point according to the dependency point bytes, comprises the following steps:

[0029] Extract the point set in all control logic sentences;

[0030] If the current control logic sentence is not the last one of all the current sentences, the points of the current sentence are spliced ​​into point bytes, and the point bytes are put into the data dependency, and the point splicing of the next sentence is continued until the last sentence;

[0031] If the current control logic sentence is the last one of all the current sentences, then set the nesting level. When the nesting value is greater than or equal to the nesting level, concatenate the two tuples with the same rear dependency point and front dependency point in the data dependency, then update the data dependency, and increase the nesting value by one until the nesting value is less than the nesting level.

[0032] According to the latest data dependency, the dependency subgraph of each point is obtained.

[0033] In some embodiments, the step of constructing a weight dependency attenuation model, calculating the dependency scores of the points, and using the models to identify the key points in the control logic code includes the following steps:

[0034] According to the constructed weight dependency model, the dependency score of each point is calculated to determine the data dependency degree of all points in the dependency subgraph;

[0035] According to the sorting results of the data dependence of the points, the points with the highest data dependence are selected as key points, and the key points in the control logic code to be identified are identified.

[0036] In some embodiments, the data dependency of the point The expression is:

[0037]

[0038] Among them, the point tag n It is a point tag i is the nth-order dependency of , α is the decay factor, and e is the natural exponent.

[0039] Another aspect of the embodiment of the present invention further provides a control logic code key point identification system based on data dependency, including:

[0040] The first module is used to construct a lexical analyzer for control logic code, which converts the control logic code into a readable control logic sentence;

[0041] The second module is used to construct data dependencies of the control logic code and establish a dependency subgraph for each point in the control logic code;

[0042] The third module is used to build a weight dependency decay model, calculate the dependency score of the point, and use it to identify the key points in the control logic code.

[0043] Another aspect of an embodiment of the present invention further provides an electronic device, including a processor and a memory;

[0044] The memory is used to store programs;

[0045] The processor executes the program to implement the method described above.

[0046] Another aspect of the embodiments of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a program, and the program is executed by a processor to implement the method described above.

[0047] The embodiment of the present invention also discloses a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the above method.

[0048] The embodiments of the present invention include at least the following beneficial effects: The present invention provides a method and system for identifying key points of control logic code based on data dependency, which constructs a lexical analyzer of the control logic code to convert the control logic code into a readable control logic sentence; constructs the data dependency of the control logic code to establish a dependency subgraph for each point in the control logic code; constructs a weight dependency attenuation model to calculate the dependency score of the point and use it to identify the key points in the control logic code. The present invention can improve the accuracy and efficiency of key point identification while reducing manual intervention, thereby better adapting to the needs of modern industrial control systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 It is a schematic diagram of an implementation environment provided by an embodiment of the present invention;

[0050] Figure 2 is a flow chart of the overall steps provided by an embodiment of the present invention;

[0051] Figure 3 It is a flowchart of specific implementation steps provided by an embodiment of the present invention;

[0052] Figure 4 is a flow chart of a data dependency process for constructing control logic code provided by an embodiment of the present invention;

[0053] Figure 5 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention 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 invention and are not intended to limit the present invention. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present invention. They are only examples of devices and methods consistent with some aspects of the embodiments of the present invention as detailed in the attached claims.

[0055] It is understood that the terms "first", "second", etc. used in the present invention may be used herein to describe various concepts, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of the present invention, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0056] The terms "at least one", "multiple", "each", "any", etc. used in the present invention, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.

[0057] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein are only for the purpose of describing the embodiments of the present invention and are not intended to limit the present invention.

[0058] The control logic code key point identification method and system based on data dependence provided by the embodiment of the present invention relate to the technical field of industrial control systems. The control logic code key point identification method based on data dependence provided by the embodiment of the present invention can be applied to a terminal, can also be applied to a server, and can also be software running in a terminal or a server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and a car terminal, etc., but is not limited to this; the server side can be configured as an independent physical server, or it can be configured as a server cluster or a distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network; the software can be an application that implements the control logic code key point identification method based on data dependence, etc., but is not limited to the above forms.

[0059] The present invention can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present invention can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0060] like Figure 1 FIG. 1 is a schematic diagram of an implementation environment provided by an embodiment of the present invention. Figure 1 The implementation environment includes at least one terminal 102 and a server 101. The terminal 102 and the server 101 can be connected to a network wirelessly or wired to complete data transmission and exchange.

[0061] Server 101 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.

[0062] In addition, the server 101 can also be a node server in the blockchain network. Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm.

[0063] The terminal 102 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc. The terminal 102 may also be a vehicle-mounted terminal of various device types described above, but is not limited thereto. The terminal 102 and the server 101 may be directly or indirectly connected via wired or wireless communication, which is not limited in this embodiment of the present invention.

[0064] Based on the example Figure 1In the implementation environment shown, an embodiment of the present invention provides a method for identifying key points of control logic codes based on data dependency. The following is explained using the example of applying the method for identifying key points of control logic codes based on data dependency in the server 101. It can be understood that the method can also be applied to the terminal 102.

[0065] Reference Figure 2 , Figure 2 The flowchart of the method for identifying key points of control logic code based on data dependency applied to a server provided in an embodiment of the present invention, the execution subject of the method can be any of the aforementioned computer devices (including servers or terminals). Figure 2 , the method may include the following steps:

[0066] Construct a lexical analyzer for the control logic code and convert the control logic code into readable control logic sentences;

[0067] Constructing data dependency of the control logic code and establishing a dependency subgraph for each point in the control logic code;

[0068] Construct a weight dependency decay model, calculate the dependency scores of points, and use it to identify key points in the control logic code.

[0069] In some embodiments, the lexical analyzer for constructing the control logic code converts the control logic code into a readable control logic sentence, including the following steps:

[0070] The control logic code in the form of STL language includes operation code and operand; wherein the operation code indicates the operation to be performed, and the operand indicates the specific input value, output value or constant value;

[0071] Distinguish and parse the opcode and operand of the control logic code, and perform intermediate representation on the STL statement according to the type characteristics of the opcode to obtain the intermediate representation form;

[0072] According to the intermediate representation of the STL statement, a readable control logic sentence of the control logic code is obtained.

[0073] In some embodiments, the type characteristics of the operation code include logic operation, set operation and edge detection operation;

[0074] Wherein, the logic operation includes AND operation, AND NOT operation, OR operation, and OR NOT operation;

[0075] The setting operation includes a SET operation and a RESET operation;

[0076] The edge detection operation includes an FP operation and an FN operation.

[0077] In some embodiments, constructing the data dependency of the control logic code and establishing the dependency subgraph of each point in the control logic code includes the following steps:

[0078] Dividing the control logic code into points; the points are used to represent variables associated with physical input, output and storage in the PLC;

[0079] According to the divided points, dependency point bytes are established in the form of point byte representation, and then the dependency subgraph of each point is determined according to the dependency point bytes.

[0080] In some embodiments, the step of establishing dependency point bytes according to the divided points in the form of point bytes, and then determining the dependency subgraph of each point according to the dependency point bytes, comprises the following steps:

[0081] Extract the point set in all control logic sentences;

[0082] If the current control logic sentence is not the last one of all the current sentences, the points of the current sentence are spliced ​​into point bytes, and the point bytes are put into the data dependency, and the point splicing of the next sentence is continued until the last sentence;

[0083] If the current control logic sentence is the last one of all the current sentences, then set the nesting level. When the nesting value is greater than or equal to the nesting level, concatenate the two tuples with the same rear dependency point and front dependency point in the data dependency, then update the data dependency, and increase the nesting value by one until the nesting value is less than the nesting level.

[0084] According to the latest data dependency, the dependency subgraph of each point is obtained.

[0085] In some embodiments, the step of constructing a weight dependency attenuation model, calculating the dependency scores of the points, and using the models to identify the key points in the control logic code includes the following steps:

[0086] According to the constructed weight dependency model, the dependency score of each point is calculated to determine the data dependency degree of all points in the dependency subgraph;

[0087] According to the sorting results of the data dependence of the points, the points with the highest data dependence are selected as key points, and the key points in the control logic code to be identified are identified.

[0088] In some embodiments, the data dependency of the point The expression is:

[0089]

[0090] Among them, the point tag n It is a point tag i is the nth-order dependency of , α is the decay factor, and e is the natural exponent.

[0091] The implementation process of the present invention in a specific scenario is described in detail below with reference to the accompanying drawings of the specification:

[0092] The existing technology relies on manual identification of key points, which has the disadvantages of strong subjectivity, low efficiency, lack of real-time adaptability, and difficulty in processing complex systems and large amounts of data. The present invention aims to propose a control logic key point identification method based on data dependency. First, a specially designed PLC control logic language lexical analyzer is used to optimize the characteristics of the PLC language, thereby improving the accuracy of code parsing. However, the method of establishing data flow in traditional high-level languages ​​(such as C language, Java language, etc.) is not suitable for PLC control logic language. Because these high-level languages ​​support complex expressions and control flow structures, they have obvious data inlets and outlets. Secondly, by constructing a data dependency subgraph adapted to the PLC working scene, the complex dependencies in the system are fully reflected. In contrast, traditional methods are difficult to cover the multi-level dependencies of complex systems. Finally, the present invention introduces a dependency weight decay model to identify the key points in the control logic code by calculating the dependency score, thereby improving the accuracy and feasibility of key point identification.

[0093] The present invention can solve the following problems:

[0094] (1) The lexical analyzer for PLC control logic language determines the value update status of the control logic code through the change of the status word register. Furthermore, it divides the points of operation statements and control logic statements, and extracts the control information and point sets in the control logic code. Compared with dividing the control logic code based on function blocks and organization blocks, this type of lexical analyzer can use a smaller granularity - statement level, to convert the control logic code into readable control logic sentences.

[0095] (2) A data dependency establishment method for PLC control logic code is proposed. By determining the dependency relationship and nested dependency relationship of each point, a dependency subgraph of each point is established. This data dependency method overcomes the problem of the lack of obvious data entry and data exit in the control logic code and establishes a data flow method suitable for the control logic code.

[0096] (3) A method for identifying key points in control logic code is proposed. By establishing a dependency decay model, the data dependency weight score of the point is calculated, and the key points in the control logic code are obtained. This overcomes the problems of existing key point identification methods, such as strong subjectivity, low efficiency, lack of real-time adaptability, and difficulty in handling complex systems and large amounts of data.

[0097] The present invention uses a lexical analyzer to extract the points of the control logic code, constructs the data flow of the control logic code, and uses a dependency weight decay model to identify the key points. Figure 3 As shown in the figure, the proposed method includes three main processes: (1) constructing a lexical analyzer for the control logic code to convert the control logic code into readable control logic sentences; (2) constructing the data dependency of the control logic code and establishing a dependency subgraph for each point; (3) identifying the key points in the control logic code, thus overcoming the problems of existing key point identification methods, such as strong subjectivity, low efficiency, lack of dynamic adaptability, and difficulty in handling complex systems and large amounts of data.

[0098] The following is a detailed description of the process of constructing a lexical analyzer for control logic code:

[0099] Unlike high-level programming languages, which have rich syntax and semantics, support complex expressions and control flow structures, and have simple lexical control logic codes, STL (Structured Text Language) is a form of control logic code. Nevertheless, the intermediate representation of STL lexical analysis also brings certain challenges. For example, it is necessary to determine the boundaries of opcodes and operands. Because instructions in STL language usually consist of opcodes and operands, opcodes represent the operations to be performed, and operands represent specific input values, output values, or constant values. When performing lexical analysis, it is necessary to accurately distinguish and parse opcodes and operands, which puts forward requirements for processing instructions of different lengths and formats.

[0100] In the control logic code, the control logic statements that comply with the IE6111-3 coding standard will cause the status value of the point to be updated when performing logical operations. These operation codes mainly include: (1) logical operations such as AND, AND NOT, OR, and OR NOT; (2) setting operations such as SET and RESET; (3) edge detection operations such as FP and FN. Therefore, after lexical analysis of the STL control logic code and generating an intermediate representation, the STL statement can be represented in an intermediate representation based on these three types of operation codes. For example, in the STL statement "AI 0.1; AN I 0.2; = M 4.0;", AND (A) and AND NOT (AN) operations occur, and the results of these logical operations are assigned to the point M4.0. At this time, it can be considered that the status of the point M4.0 is updated. Therefore, the intermediate representation of this STL statement can be constructed as "I:0.1 AND NOT I:0.2=>M:4.0". After analyzing the lexical analyzer constructed for control logic codes such as STL, a readable control logic sentence, that is, an intermediate representation of the control logic code, can be obtained.

[0101] The following is a detailed description of the process of building data dependencies for control logic code:

[0102] The first thing to do when building data dependencies for control logic code is to divide the control logic code into points. Points are variables in the PLC that are associated with physical input, output, and storage. In the control logic code, each logical operation is an end-to-end result of input-output. This dependency is represented by a point byte (tagi, tagj). Among them, tagi is the pre-dependency of tagj, and tagj is the post-dependency of tagi. Using the established dependency point bytes, nested dependencies can be constructed. The process of building data dependencies for control logic code is as follows: Figure 4 The specific process is as follows:

[0103] 1. Extract all the point tags in the control logic sentences and go to step 2;

[0104] 2. Determine whether the current control logic sentence is the last one of all current sentences. If so, go to step 5; otherwise, go to step 3;

[0105] 3. Concatenate the points of the current sentence into a point byte group (tagi, tagj), and go to step 4;

[0106] 4. Put the point byte into the data dependency list and go to step 2.

[0107] 5. Set the number of nesting levels k and go to step 6;

[0108] 6. Determine whether the value count is less than k. If so, go to step 10; otherwise, go to step 7.

[0109] 7. Concatenate the two tuples in Dependencies that have the same back-dependency point and front-dependency point, and go to step 8;

[0110] 8. Update Dependencies and go to step 9;

[0111] 9. Add 1 to count and go to step 6;

[0112] 10. End.

[0113] The following is a detailed description of the process of identifying key points in the control logic code:

[0114] The decay model is used to describe the process of a quantity decreasing over time. The data dependency of a point shows a hierarchical structure. Therefore, the degree of data dependency of a point must take into account the relationship and influence between different levels. The degree of data dependency of a point shows an exponential decline - as the number of data dependency layers increases, its influence decreases exponentially. The degree of data dependency can be defined as the influence of a point on other parts of the system. The degree of data dependency of a point is shown in the following formula.

[0115]

[0116] In the above formula, the point tag n It is a point tag i The nth-order dependency of is, α is the decay factor, and e is the natural exponent. After calculating the dependency weight scores of all points in the data dependency graph, the process of determining the key points becomes crucial. Pipeline attack analyzes and sorts the dependency scores of each point to determine which points are important in the overall structure, and selects the points with the highest dependency scores as key points, realizing the identification of key points in ICS.

[0117] In summary, compared with the prior art, the present invention has the following characteristics:

[0118] 1. Lexical analyzer for PLC control logic language. A lexical analyzer specifically for PLC control logic language has been developed to determine the value update status of the control logic code through the change of the status word register. Furthermore, the points of the operation statements and control logic statements are divided, and the control information and point sets in the control logic code are extracted. It can convert complex PLC control logic codes into readable control logic sentences.

[0119] 2. Data dependency subgraph adapted to PLC working scenarios. A data dependency subgraph adapted to specific PLC working scenarios is constructed, which details the dependency relationship between various variables in the control logic. This subgraph takes into account the interaction of variables in the actual working environment and can more comprehensively reflect the complexity of the system.

[0120] 3. Application of dependency weight decay model. The dependency weight decay model is used to dynamically adjust the dependency weights of variables during the key point identification process. This model overcomes the problems of existing key point identification methods, such as strong subjectivity, low efficiency, and difficulty in handling complex systems and large amounts of data, thereby more accurately identifying key points.

[0121] Compared with the prior art, the present invention has the following advantages:

[0122] 1. Improved the accuracy of key point identification. By constructing a lexical analyzer for PLC control logic language, complex PLC codes can be converted into readable control logic sentences. This processing method greatly reduces the error in code understanding, making it possible to more accurately identify the key points in the system in data dependency analysis.

[0123] 2. Enhanced the ability to handle complex system dependencies. By building a data dependency subgraph that adapts to the PLC work scenario, the dependencies between various variables and operations in the control logic are systematically presented. This graph structure can fully reflect the key points in the system and their mutual influence, solving the shortcomings of traditional methods in dealing with complex systems.

[0124] 3. Improved dynamic adaptability and real-time performance. By introducing the dependency weight decay model, the point information of the control logic language is fully considered to be changing in real time, and the identification of key points is realized. This model not only makes full use of the influence of the data dependency degree of the point and the level of the point, but also overcomes the problem of lack of data entry in the control logic language, so as to more accurately identify key points, especially in dynamically changing industrial control systems, and can respond and adapt to new conditions in a timely manner.

[0125] Another aspect of the embodiment of the present invention further provides a control logic code key point identification system based on data dependency, including:

[0126] The first module is used to construct a lexical analyzer for control logic code, which converts the control logic code into a readable control logic sentence;

[0127] The second module is used to construct data dependencies of the control logic code and establish a dependency subgraph for each point in the control logic code;

[0128] The third module is used to build a weight dependency decay model, calculate the dependency score of the point, and use it to identify the key points in the control logic code.

[0129] It can be understood that the contents of the above method embodiments are all applicable to the present system embodiments, the functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0130] The embodiment of the present invention further provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned control logic code key point identification method based on data dependence when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.

[0131] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0132] See also Figure 5 , Figure 5 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:

[0133] The processor 501 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present invention;

[0134] The memory 502 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 502 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 502, and the processor 501 calls and executes the key point identification method of the control logic code based on data dependence in the embodiment of the present invention;

[0135] Input / output interface 503, used to implement information input and output;

[0136] Communication interface 504, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);

[0137] A bus 505 that transmits information between the various components of the device (e.g., the processor 501, the memory 502, the input / output interface 503, and the communication interface 504);

[0138] The processor 501 , the memory 502 , the input / output interface 503 and the communication interface 504 are connected to each other in communication within the device via the bus 505 .

[0139] An embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the method for identifying key points of control logic codes based on data dependency is implemented.

[0140] It can be understood that the contents of the above method embodiments are all applicable to the present storage medium embodiments, the functions specifically implemented by the present storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0141] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0142] The embodiments described in the embodiments of the present invention are intended to more clearly illustrate the technical solutions of the embodiments of the present invention, and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. Those skilled in the art can appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.

[0143] Those skilled in the art will appreciate that the technical solutions shown in the figures do not limit the embodiments of the present invention and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0144] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0145] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0146] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0147] It should be understood that in the present invention, "at least one (item)" refers to one or more, and "plurality" refers to two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can represent: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0148] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0149] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0150] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0151] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including multiple instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store programs.

[0152] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the embodiments of the present invention is not limited thereby. Any modification, equivalent substitution and improvement made by those skilled in the art without departing from the scope and essence of the embodiments of the present invention shall be within the scope of the rights of the embodiments of the present invention.

Claims

1. A method for identifying key points of control logic code based on data dependence, characterized in that: The following steps are involved: Construct a lexical analyzer for the control logic code and convert the control logic code into readable control logic sentences; Constructing data dependency of the control logic code and establishing a dependency subgraph for each point in the control logic code; Construct a weight dependency decay model, calculate the dependency scores of points, and use it to identify key points in the control logic code.

2. A control logic code key point identification method based on data dependence according to claim 1, characterized in that: The lexical analyzer for constructing the control logic code converts the control logic code into a readable control logic sentence, comprising the following steps: The control logic code in the form of STL language includes operation code and operand; wherein the operation code indicates the operation to be performed, and the operand indicates the specific input value, output value or constant value; Distinguish and parse the opcode and operand of the control logic code, and perform intermediate representation on the STL statement according to the type characteristics of the opcode to obtain the intermediate representation form; According to the intermediate representation of the STL statement, a readable control logic sentence of the control logic code is obtained.

3. A control logic code key point identification method based on data dependence according to claim 2, characterized in that: The type characteristics of the operation code include logic operation, setting operation and edge detection operation; Wherein, the logic operation includes AND operation, AND NOT operation, OR operation, and OR NOT operation; The setting operation includes a SET operation and a RESET operation; The edge detection operation includes an FP operation and an FN operation.

4. The method for identifying key points of control logic codes based on data dependence according to claim 1, characterized in that: The step of constructing the data dependency of the control logic code and establishing a dependency subgraph for each point in the control logic code includes the following steps: Dividing the control logic code into points; the points are used to represent variables associated with physical input, output and storage in the PLC; According to the divided points, dependency point bytes are established in the form of point byte representation, and then the dependency subgraph of each point is determined according to the dependency point bytes.

5. The method for identifying key points of control logic codes based on data dependence according to claim 4 is characterized in that: The method of establishing dependency point bytes according to the divided points in the form of point bytes, and then determining the dependency subgraph of each point according to the dependency point bytes, comprises the following steps: Extract the point set in all control logic sentences; If the current control logic sentence is not the last one of all the current sentences, the points of the current sentence are spliced ​​into point bytes, and the point bytes are put into the data dependency, and the point splicing of the next sentence is continued until the last sentence; If the current control logic sentence is the last one of all the current sentences, then set the nesting level. When the nesting value is greater than or equal to the nesting level, concatenate the two tuples with the same rear dependency point and front dependency point in the data dependency, then update the data dependency, and increase the nesting value by one until the nesting value is less than the nesting level. According to the latest data dependency, the dependency subgraph of each point is obtained.

6. The method for identifying key points of control logic codes based on data dependence according to claim 1, characterized in that: The weight dependency attenuation model is constructed to calculate the dependency scores of the points and use them to identify the key points in the control logic code, including the following steps: According to the constructed weight dependency model, the dependency score of each point is calculated to determine the data dependency degree of all points in the dependency subgraph; According to the sorting results of the data dependence of the points, the points with the highest data dependence are selected as key points, and the key points in the control logic code to be identified are identified.

7. A method for identifying key points of control logic codes based on data dependence according to claim 6, characterized in that: The data dependence of the points The expression is: Among them, the point tag n It is a point tag i is the nth-order dependency of , α is the decay factor, and e is the natural exponent.

8. A control logic code key point identification system based on data dependence, characterized in that: include: The first module is used to construct a lexical analyzer for control logic code, which converts the control logic code into a readable control logic sentence; The second module is used to construct data dependencies of the control logic code and establish a dependency subgraph for each point in the control logic code; The third module is used to build a weight dependency decay model, calculate the dependency score of the point, and use it to identify the key points in the control logic code.

9. An electronic device, characterized in that: including a processor and a memory; The memory is used to store programs; The processor executes the program to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The storage medium stores a program, and the program is executed by a processor to implement the method according to any one of claims 1 to 7.