Non-real-time function block execution boundary evaluation method and system

By converting non-real-time functional blocks into intermediate programs and building a control flow chart, and deriving the parameterized evaluation formula for execution boundary, the problem of long and large fluctuations in the industrial control system is solved, and the rapid evaluation of execution boundaries and reasonable allocation of system resources is achieved, ensuring the certainty of the system's execution.

CN119937517AActive Publication Date: 2025-05-06HANGZHOU DIANZI UNIV
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510089021.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-21
Publication Date
2025-05-06
Estimated Expiration
2045-01-21

AI Technical Summary

Technical Problem

In industrial control systems, the execution time of non-real-time functional blocks is long and fluctuating greatly, resulting in excessive system resource usage, affecting the execution of real-time functional blocks, destroying the certainty of the system, and affecting control accuracy.

Method used

By converting non-real-time functional blocks into intermediate programs, a control flow chart is constructed, the execution boundary parameterized evaluation formula is derived, and the execution time of the basic execution unit is analyzed in combination with the processor information of the running platform, a control flow tree is generated, and the nodes are iteratively analyzed to calculate the execution boundary evaluation formula.

Benefits of technology

It realizes a rapid evaluation of the execution boundary of non-real-time functional blocks, provides reasonable scanning cycle settings, ensures the execution certainty of the industrial control system, and avoids system chaos caused by execution timeout.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119937517A_ABST
    Figure CN119937517A_ABST
Patent Text Reader

Abstract

The invention discloses a non-real-time function block execution boundary evaluation method and system, and the method comprises the steps: converting a non-real-time function block into an intermediate program, and constructing a control flow diagram according to the intermediate program; deducing and executing a boundary parameterization evaluation formula; the non-real-time function block input pin value is substituted into an evaluation formula to obtain an evaluation result, the system comprises an import module, an analysis module, an export module, a downloading module, an evaluation module and an execution module, and each module is responsible for import of various non-real-time function blocks; analyzing an internal control flow and an operation platform of the imported non-real-time function block, and giving an execution boundary evaluation formula; simplifying the evaluation formula, and generating an evaluation program segment; packaging and downloading the non-real-time function block and the evaluation program segment thereof to an operation platform; and synchronously running the evaluation program segment to obtain an execution boundary of the function block, finally making a response according to an evaluation result, and executing the non-real-time function block only when a given scanning period is not exceeded.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of industrial control technology, and in particular to a method and system for executing boundary assessment for a non-real-time function block. Background Art

[0002] Industrial control systems are executed cyclically according to a fixed scanning cycle with high determinism. They have been widely used in the discrete manufacturing industry. With the development of intelligent manufacturing, advanced information technologies such as image processing and artificial intelligence are gradually introduced into control systems in the form of function blocks, which can adaptively adjust control parameters according to dynamic environments. However, these function blocks have long execution times, large fluctuations, and are non-real-time. When the system needs to process real-time and non-real-time function blocks at the same time, how to balance their execution time and system resources becomes a difficult problem. If a non-real-time function block occupies too many system resources, the execution of other function blocks may be affected. Once the execution time exceeds the set scanning cycle, it will destroy the determinism of the industrial control system, affect the control accuracy, and even damage the processing object. Therefore, it is necessary to evaluate the execution boundaries of these non-real-time function blocks and set a reasonable scanning cycle based on their upper boundaries.

[0003] However, due to the complexity and diversity of advanced information technologies such as image processing and artificial intelligence, their execution time is often affected by multiple factors, such as the scale of input data, the efficiency of the algorithm, and the performance of the hardware, which are difficult to accurately predict. In particular, when these technologies are integrated into industrial control systems in the form of functional blocks, they need to be quickly evaluated based on the system execution status. However, existing evaluation methods for IT programming languages ​​do not support rapid analysis of OT programming languages, especially graphical programming languages. Summary of the invention

[0004] The object of the present invention is to provide a method and system for evaluating the execution boundary of a non-real-time function block to solve the problems raised in the above-mentioned background technology.

[0005] The present invention provides the following technical solution: a method for evaluating the execution boundary of a non-real-time function block, comprising the following steps:

[0006] Step S1: converting the non-real-time function block into an intermediate program;

[0007] Preferably, the conversion route includes direct conversion and indirect conversion, wherein ST, SFC and LD can be directly converted to IL, while FBD needs to be converted to LD first and then to IL.

[0008] Step S2: construct a control flow graph according to the intermediate program;

[0009] Preferably, constructing a control flow graph according to the intermediate program includes:

[0010] S201: Divide the intermediate program into a number of basic execution units;

[0011] The basic execution unit of the intermediate program is a maximum continuous instruction sequence that satisfies the division rule;

[0012] The division rules at least include:

[0013] Rule R1: The basic execution unit does not contain jump instructions;

[0014] Rule R2: The target of the jump instruction is the starting instruction of the basic execution unit;

[0015] Rule R3: The subsequent instruction of the jump instruction is the starting instruction of the basic execution unit;

[0016] Rule R4: Merge two consecutive basic execution units without violating Rule R2.

[0017] S202: Generate a control flow graph with basic execution units as nodes and control flows as edges.

[0018] Step S3: deriving an execution boundary parameterization evaluation formula;

[0019] Preferably, the derivation of the execution boundary parameterization evaluation formula comprises the following steps:

[0020] S301: Analyze the execution time ω required by the basic execution unit in combination with the processor information of the operating platform;

[0021] S302: Convert the control flow graph into a control flow tree;

[0022] S303: recursively analyze all nodes of the control flow tree, and obtain a non-real-time function block execution boundary evaluation formula through calculation of the operation operator of the node execution boundary.

[0023] Step S4: Substitute the value of the non-real-time function block input pin into the evaluation formula to obtain the evaluation result.

[0024] Preferably, it includes repeated execution in a development platform and an operation platform. In the development platform, step S4 is executed multiple times to obtain the maximum execution boundary under common input pin values ​​as a set scan cycle. In the operation platform, step S4 is executed each time before executing a non-real-time function block to evaluate the execution boundary.

[0025] The present invention provides a non-real-time function block execution boundary evaluation system, comprising the following functional modules: an import module, an analysis module, an export module, a download module of a development platform, and an evaluation module and an execution module of an operation platform;

[0026] The import module is responsible for importing various non-real-time function blocks;

[0027] The analysis module is used to analyze the internal control flow and operation platform of the imported non-real-time function block and provide an execution boundary evaluation formula;

[0028] The export module is used to further simplify the evaluation formula and generate a corresponding evaluation program segment;

[0029] The download module is used to package and download the non-real-time function blocks and evaluation program segments to the operation platform;

[0030] The evaluation module is used to obtain the input pin value of the non-real-time function block during the execution process, and run the evaluation program segment to obtain the execution boundary of the function block;

[0031] The execution module is used to respond according to the evaluation result and execute the non-real-time function block only when the given scanning cycle is not exceeded.

[0032] Compared with the prior art, the beneficial effects achieved by the present invention are as follows: the present invention converts a non-real-time function block into an intermediate program, constructs a control flow graph according to the intermediate program; derives an execution boundary parameterized evaluation formula; brings the value of the input pin of the non-real-time function block into the evaluation formula to obtain an evaluation result. Based on this method, a system including an import module, an analysis module, an export module and a download module on the development platform side and an evaluation module and an execution module on the operation platform side is designed. By adopting the technical solution of the present invention, the execution boundary of the non-real-time function block can be evaluated, thereby providing a basis for setting the scan cycle and ensuring the certainty of the execution of the industrial control system. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.

[0034] In the attached picture:

[0035] Figure 1 A schematic diagram of the effect of a non-real-time function block execution boundary evaluation method provided by an embodiment of the present invention;

[0036] Figure 2 A flowchart of a non-real-time function block execution boundary evaluation method provided by an embodiment of the present invention;

[0037] Figure 3 A schematic diagram of a conversion route for converting a non-real-time function block into an intermediate program provided by an embodiment of the present invention;

[0038] Figure 4 An example of converting a non-real-time function block provided in an embodiment of the present invention into an intermediate program;

[0039] Figure 5 An example of derivation of parameterized evaluation formula for execution boundary provided in an embodiment of the present invention;

[0040] Figure 6 A schematic diagram of the module composition of a system for implementing a non-real-time function block execution boundary assessment method provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0042] This embodiment combines Figure 1 , Figure 1 A schematic diagram of the effect of implementing a method for evaluating the execution boundary of a non-real-time function block provided in an embodiment of the present invention. Exemplarily, the execution object of this embodiment is any non-real-time function block developed in a programming language that complies with the IEC 61131-3 standard specification. The evaluation method provided in this embodiment can automatically generate an execution boundary evaluation program segment for it under a given platform, and the program segment returns the upper bound of the execution time required for different input pin values ​​of the non-real-time function block.

[0043] This embodiment further combines Figure 2 , Figure 2 The flowchart of the non-real-time function block execution boundary evaluation method provided by the embodiment of the present invention comprises the following steps:

[0044] Step S1: converting the non-real-time function block into an intermediate program;

[0045] Exemplarily, IL is an assembly-like language that can better reflect the execution logic of the underlying hardware of the industrial control system program and is supported by most industrial control system manufacturers. Considering the universality and accuracy of the evaluation method, preferably, the intermediate program used to evaluate the execution boundary uses the IL language;

[0046] Preferably, in a specific implementation, Figure 3 , Figure 3 A schematic diagram of a conversion route for converting a non-real-time function block into an intermediate program provided in an embodiment of the present invention, wherein the conversion route includes direct conversion and indirect conversion, wherein ST, SFC and LD can be directly converted to IL, while FBD needs to be converted to LD first and then to IL.

[0047] Specifically, ST is a text language and can be directly converted to IL by referring to the compiler of existing text languages; SFC, LD and FBD are all graphical languages ​​and need to formulate conversion strategies according to the graphical logic. Among them, the graphical logic of SFC includes steps, transfers and jumps, etc., which can be directly converted through rule mapping; the graphical logic of LD includes contacts, coils, functions and connections, etc. The series and parallel relationships between elements are intertwined, and the program needs to be abstracted into a series-parallel unilateral directed graph first, and then the series-parallel unilateral directed graph is converted into a binary decomposition tree through series reduction and parallel reduction operations, and finally the conversion is completed according to the reduction rules; the graphical logic of FBD is close to LD, and the AOV graph corresponding to FBD can be adjusted and converted into an AOV graph with LD characteristics, and finally converted to IL.

[0048] Step S2: construct a control flow graph according to the intermediate program;

[0049] Exemplarily, the method further comprises the following steps:

[0050] S201: Divide the intermediate program into a number of basic execution units;

[0051] In this embodiment, the basic execution unit of the intermediate program is a maximum continuous instruction sequence that satisfies the division rule, where the division rule at least includes:

[0052] Rule R1: The basic execution unit does not contain jump instructions;

[0053] Rule R2: The target of the jump instruction is the starting instruction of the basic execution unit;

[0054] Rule R3: The subsequent instruction of the jump instruction is the starting instruction of the basic execution unit;

[0055] Rule R4: Merge two consecutive basic execution units without violating Rule R2.

[0056] S202: Generate a control flow graph with basic execution units as nodes and control flows as edges;

[0057] In this embodiment, the program logic and feasible paths inside the non-real-time function block can be intuitively displayed through the control flow graph.

[0058] Step S3: deriving an execution boundary parameterization evaluation formula;

[0059] In this embodiment, the following steps are also included:

[0060] S301: Analyze the execution time ω required for the basic execution unit in combination with the processor information of the operation platform; wherein the processor information at least includes the instruction set architecture, main frequency, number of instructions per clock cycle, number of floating point operations per second and other performance indicators, cache hits, pipelines, branch prediction and other behaviors; in particular, the execution time ω is a sorted non-increasing sequence, indicating the time required for continuous execution of the same basic execution unit;

[0061] Exemplarily, before deriving the evaluation formula, it is necessary to model the processor of the operating platform, wherein the processor instruction set architecture determines the mapping relationship of IL instructions, the processor performance index determines the time required to execute a single instruction, and the processor behavior affects the time required to execute multiple consecutive instructions;

[0062] Furthermore, execution time ω=[5,5,3,1] means that the first execution of the basic execution unit requires ω[1]=5 units of time, and the second execution still requires ω[2]=5 units of time. The third execution is reduced to ω[3]=3 units of time, and the fourth and subsequent executions only require ω[≥4]=1 unit of time each time.

[0063] S302: Convert the control flow graph into a control flow tree; wherein the control flow tree includes four types of nodes: leaf, sequence, branch, and loop. A leaf node has no child nodes and corresponds to a basic execution unit; a sequence node Sep(T 1 , T 2 …) are executed from left to right; the branch node Alt(C 1 →T 1 , C 2 →T 2 …) of all subtrees according to the execution condition, only one is executed; the left subtree L of the loop node Loop(L,M,R) is executed cyclically at most m times, and the right subtree R is executed once before exiting the loop.

[0064] S303: recursively analyze all nodes of the control flow tree, and obtain a non-real-time function block execution boundary evaluation formula through calculation of the operation operator of the node execution boundary, wherein the operation operator at least includes:

[0065] Accumulation: ω = ω 1 +ω 2 ,ω[i]=ω 1 [i]+ω 2 [i];

[0066] For example, ω 1 =[1,2,3],ω 2 =[4,5,6], then ω = ω 1 +ω 2 =[5,7,9];

[0067] condition: Where c is the branch node Alt(C 1 →T 1 , C 2 →T 2 ...);

[0068] Cycle: ω n =∑ω[i],

[0069] In this embodiment, combined with Figure 4 and Figure 5 , Figure 4 The non-real-time function block provided in the embodiment of the present invention is converted into an intermediate program example. A simple internal program segment of a non-real-time function block is taken as an example. The code segment is developed in ST language and includes a conditional branch and a loop. After being converted into an IL instruction sequence, it is divided into five basic execution units B1, B2, B3, B4 and B5 according to the division rule. Then, as shown in FIG. Figure 5 As shown, Figure 5 An example of derivation of the execution boundary parameterized evaluation formula provided in an embodiment of the present invention is provided. A control flow graph is constructed with these basic execution units as nodes and control flows as edges. The control flow graph is then converted into a control flow tree with 2 sequential nodes, 1 branch node, 1 loop node and 6 leaf nodes, wherein the maximum number of loops of the loop node is the input pin n. Finally, the control flow tree is iterated to obtain the execution boundary evaluation formula of the non-real-time function block according to the mapping relationship between the node type and the operation operator.

[0070] Step S4: Substitute the input pin value of the non-real-time function block into the evaluation formula to obtain the evaluation result;

[0071] In this embodiment, for a given operating platform, steps S1-S3 only need to be executed once in the development platform, while step S4 can be repeatedly executed in the development platform or in the operating platform. For example, in the development platform, step S4 is executed multiple times to obtain the maximum execution boundary under common input pin values ​​as the set scan cycle; in the operating platform, step S4 is executed before each execution of a non-real-time function block to evaluate the execution boundary to avoid execution timeout causing execution confusion in the industrial control system.

[0072] Embodiments of the present invention are combined Figure 6 , Figure 6A schematic diagram of the module composition of a system for implementing a method for evaluating the execution boundary of a non-real-time function block provided in an embodiment of the present invention, that is, this embodiment provides the following technical solutions: a system for evaluating the execution boundary of a non-real-time function block, comprising an import module 201, an analysis module 202, an export module 203, a download module 204 of a development platform, and an evaluation module 205 and an execution module 206 of an operation platform; wherein the import module 201 is responsible for importing various types of non-real-time function blocks, which are saved in the form of XML files; the analysis module 202 analyzes the internal control flow and the operation platform of the imported non-real-time function block, and gives an execution boundary evaluation formula; the export module 203 further simplifies the evaluation formula and generates a corresponding evaluation program segment; the download module 204 is responsible for packaging and downloading the non-real-time function block and its evaluation program segment to the operation platform; the evaluation module 205 obtains the input pin value of the non-real-time function block during execution, and runs the evaluation program segment to obtain the execution boundary of the function block; the execution module 206 responds according to the evaluation result, and executes the non-real-time function block only when it does not exceed a given scan cycle.

[0073] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0074] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for evaluating execution boundaries of non-real-time function blocks, characterized in that: The following steps are involved: Step S1: converting the non-real-time function block into an intermediate program; Step S2: construct a control flow graph according to the intermediate program; Step S3: deriving an execution boundary parameterization evaluation formula; Step S4: Substitute the input pin value of the non-real-time function block into the evaluation formula to obtain the evaluation result.

2. The method for evaluating the execution boundary of a non-real-time function block according to claim 1, characterized in that: The conversion route for converting the non-real-time function blocks includes direct conversion and indirect conversion.

3. A non-real-time function block execution boundary assessment method according to claim 2, characterized in that: The constructing of the control flow graph according to the intermediate program comprises: Divide the intermediate program into a plurality of basic execution units; the basic execution unit of the intermediate program is a maximum continuous instruction sequence that satisfies the division rule; A control flow graph is generated with basic execution units as nodes and control flows as edges.

4. The method for evaluating the execution boundary of a non-real-time function block according to claim 3, characterized in that: The division rules at least include: Rule R1: The basic execution unit does not contain jump instructions; Rule R2: The target of the jump instruction is the starting instruction of the basic execution unit; Rule R3: The subsequent instruction of the jump instruction is the starting instruction of the basic execution unit; Rule R4: Merge two consecutive basic execution units without violating Rule R2.

5. The method for evaluating the execution boundary of a non-real-time function block according to claim 4, characterized in that: The derivation of the execution boundary parameterization evaluation formula comprises the following steps: S301: Analyze the execution time ω required by the basic execution unit in combination with the processor information of the operating platform; S302: Convert the control flow graph into a control flow tree; S303: recursively analyze all nodes of the control flow tree, and obtain a non-real-time function block execution boundary evaluation formula through calculation of the operation operator of the node execution boundary.

6. The method for evaluating the execution boundary of a non-real-time function block according to claim 5, characterized in that: The processor information in S301 includes at least the instruction set architecture, main frequency, number of instructions per clock cycle, performance indicators of floating-point operations per second, cache hits, pipelines, and branch prediction behaviors, and the processor of the operating platform is modeled before deriving the evaluation formula; The execution time ω is a sorted non-increasing sequence, indicating the time required for continuously executing the same basic execution unit.

7. The method for evaluating the execution boundary of a non-real-time function block according to claim 5, characterized in that: In S302, the control flow tree includes four types of nodes: leaf, sequence, branch and loop, among which the leaf node has no child nodes and corresponds to a basic execution unit; all subtrees of the sequence node Sep(T1, T2...) are executed from left to right in sequence; of all subtrees of the branch node Alt(C1→T1, C2→T2...), only one is executed according to the execution condition; the left subtree L of the loop node Loop(L,M,R) is executed cyclically, at most m times, and the right subtree R is executed once before exiting the loop.

8. The method for evaluating the execution boundary of a non-real-time function block according to claim 7, characterized in that: The operation operator at least includes: Accumulation: ω=ω1+ω2, ω[i]=ω1[i]+ω2[i]; condition: Where c is the condition in the branch node Alt (C1→T1, C2→T2…); Cycle: ω n =∑ω[i].

9. The method for evaluating the execution boundary of a non-real-time function block according to claim 8, characterized in that: The step S4 includes repeated execution in the development platform and the operation platform. In the development platform, step S4 is executed multiple times to obtain the maximum execution boundary under common input pin values ​​as the set scan cycle. In the operation platform, it is evaluated whether the execution boundary exceeds the set scan cycle.

10. A non-real-time function block execution boundary assessment system, characterized in that: It includes the following functional modules: import module, analysis module, export module, download module of the development platform, and evaluation module and execution module of the operation platform; The import module is responsible for importing various non-real-time function blocks; The analysis module is used to analyze the internal control flow and operation platform of the imported non-real-time function block and provide an execution boundary evaluation formula; The export module is used to further simplify the evaluation formula and generate a corresponding evaluation program segment; The download module is used to package and download the non-real-time function blocks and evaluation program segments to the operation platform; The evaluation module is used to obtain the input pin value of the non-real-time function block during the execution process, and run the evaluation program segment to obtain the execution boundary of the function block; The execution module is used to respond according to the evaluation result and execute the non-real-time function block only when the given scanning cycle is not exceeded.

Citation Information

Patent Citations

  • Circulation boundary inward direction analysis method of real-time system

    CN104317572A

  • System, method and device for automatically generating program according to function block diagram

    CN110147226A

  • Visual function block execution time prediction method and system

    CN115017021A

  • Field apparatus and field control system using the same

    JP2010176548A

  • Program optimization method, and compiler using the same

    US20020095666A1