Complex calculation program generation method and system of control system
By providing complex computing program generation methods and systems in the control system, users can quickly adjust the flow and parameters of complex computing programs, solving the inefficiency problem when developing complex computing applications in the prior art, and achieving a more efficient development process.
Patent Information
- Application Number
- CN202510089554.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-05-16
AI Technical Summary
When developing complex computing applications, the execution effect of existing control systems is not intuitive and the development is difficult. The existing development model requires frequent adjustment of program flow and parameters, resulting in low development efficiency.
It provides a method and system for generating complex computing programs for controlling the system, including user interface, function management, debugging components and generation components. It constructs complex computing models through user customized results, finds the optimal matching solution from computing nodes to runtime, and generates corresponding complex computing programs.
It realizes the rapid adjustment of the flow and parameters of complex computing programs during the development process, improves development efficiency, and finds the best matching solution based on the available resources of the running platform, and automatically generates corresponding complex computing programs for the control system.
Smart Images

Figure CN120012194A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of control systems, and in particular to a method and system for generating a complex calculation program of a control system. Background Art
[0002] With the development of intelligent manufacturing, complex calculations such as image processing and artificial intelligence are gradually being introduced into production and manufacturing. Some existing work has developed a large number of basic function blocks related to complex calculations to support field engineers in developing complex computing applications through the control system language they are familiar with. However, the following problems still exist: Compared with traditional control logic development, the execution effect of complex computing applications is not intuitive and the development is difficult. The existing development mode of the control system is divided into two steps: configuration programming and compilation, downloading and execution. In the process of developing complex computing applications, it is necessary to frequently adjust the program flow and parameters. Each adjustment requires recompilation and downloading, and the development efficiency is low. Summary of the invention
[0003] The purpose of the present invention is to provide a method and system for generating complex computing programs for a control system, to provide users with a customized way of complex computing applications, to support rapid adjustment of the processes and parameters of complex computing programs during the development process, and to find the optimal matching solution based on the available runtime resources of the operating platform, so as to automatically generate corresponding complex computing programs for the control system.
[0004] Specifically, the following technical solutions are provided: a complex computing program generation system for a control system, including functional units of a user interface, a function management, a debugging component, and a generation component;
[0005] The user interface is used to provide a customized interface for complex computing programs;
[0006] The function management is responsible for the synchronization and storage of complex calculation related function blocks;
[0007] The debugging component is used to support instant feedback of complex calculation results and backtracking of historical customization processes;
[0008] The generation component is responsible for generating a complex calculation program according to the customized result;
[0009] The complex calculation program generated according to the customization result is imported into the target control system configuration development platform, compiled into an executable file together with other control programs, and downloaded to the target control system operation platform for execution.
[0010] A method for generating a complex calculation program for a control system comprises the following steps:
[0011] Step S301: constructing a complex calculation model according to the user customization result;
[0012] Preferably, the complex computing model is a directed graph, including a node set and a directed edge set, wherein the computing nodes correspond one-to-one to the computing modules selected by the customized application, and at least include computing module index information and set parameters; the directed edges include at least a logic path and a data path, wherein the logic path corresponds one-to-one to the process designed by the customized application, and the data path records the data flow between two computing nodes;
[0013] The node set includes:
[0014] Conditional nodes select the logical path flow of complex computing models according to execution conditions;
[0015] Input node: serves as the starting point for complex computational models;
[0016] Output node: serves as the end of a complex computational model.
[0017] Step S302: Find the optimal matching solution from computing node to runtime;
[0018] Preferably, the optimal matching scheme includes the runtime matched to each computing node and its priority on the runtime. According to the matching scheme, the execution order of computing nodes on the same runtime is consistent with the priority, and the computing nodes with higher priority are executed first, and the computing nodes with lower priority can be executed only after the computing nodes with higher priority have finished executing. The optimal matching scheme refers to the matching scheme that makes the total execution time of the generated complex computing program shortest;
[0019] The step S302 further includes:
[0020] Evaluate the execution time of computing nodes on each runtime and the data transfer rate between runtimes, and establish a matching optimization problem model;
[0021] Create constraints as follows:
[0022]
[0023] and
[0024] Among them, (u, v, d) represents the data path, u and v represent the predecessor node that generates data and the successor node that receives data, respectively, and s v 、s u Respectively represent the start execution time of the predecessor node and the successor node, f u 、f v Respectively represent the end execution time of the predecessor node and the successor node, Respectively represent the runtime matched by the predecessor node and the successor node, Respectively represent the priorities of the predecessor node and the successor node, Tu represents the execution time required by the predecessor node on the matched runtime, d represents the data size, and R represents the transmission rate matrix.
[0025] Solve the matching optimization problem through optimization algorithm;
[0026] The optimization algorithm is a heuristic algorithm. By constructing a code, the code length is It is divided into two parts: runtime matching and priority division. The encoding value range of the runtime matching part is The priority division part encoding value range is The fitness function is reconstructed, and the execution end time of the complex computing model corresponding to the encoding is calculated according to the above constraints. Finally, the encoding corresponding to the minimum execution end time is found as the optimal matching solution through population initialization and iteration.
[0027] Step S303: Generate a complex calculation program corresponding to the runtime matching result.
[0028] Preferably, the method specifically comprises the following steps:
[0029] Step b1: Map the nodes to control system components;
[0030] Step b2: Bind variables to components according to data paths;
[0031] Step b3: declare an end flag for the component, and generate execution start trigger logic and execution end setting logic corresponding to the complex calculation model;
[0032] Step b4: Add communication logic according to the runtime matching scheme and integrate the program segments corresponding to the nodes to form a complex calculation program that needs to be executed at each runtime.
[0033] Compared with the prior art, the beneficial effects achieved by the present invention are: the present invention constructs a complex computing model according to user customization results; finds the optimal matching solution from computing nodes to runtime; generates a complex computing program corresponding to the runtime matching results. Based on this method, a user interface for providing a customized interface for complex computing programs is designed; a functional management component for synchronization and storage of complex computing related functional blocks; a debugging component for supporting instant feedback of complex computing results and backtracking of historical customization processes; and a generation component for generating complex computing programs according to customization results. By adopting the technical solution of the present invention, the process and parameters of the complex computing program can be quickly adjusted during the development process, and the optimal matching solution can be found according to the available runtime resources of the operating platform, so as to automatically generate the corresponding complex computing program for the control system and improve the development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] 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.
[0035] In the attached picture:
[0036] Figure 1 It is an application schematic diagram of a complex calculation program generating device for a control system according to an embodiment of the present invention;
[0037] Figure 2 It is a schematic diagram of the execution of a complex calculation program generating device for a control system according to an embodiment of the present invention;
[0038] Figure 3 A schematic diagram of a flow chart of a method for generating a complex calculation program for a control system according to an embodiment of the present invention;
[0039] Figure 4 An example diagram optimized for a complex computing model according to an embodiment of the present invention;
[0040] Figure 5 A schematic diagram of a process of finding an optimal matching solution from computing node to runtime according to an embodiment of the present invention;
[0041] Figure 6 A schematic diagram of a flow chart of generating a complex computing program corresponding to a runtime matching result according to an embodiment of the present invention;
[0042] Figure 7 This is an example diagram generated by the computing node related program segments of an embodiment of the present invention. DETAILED DESCRIPTION
[0043] 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.
[0044] Embodiments of the present invention are combined Figures 1 to 7 , exemplary, combined Figure 1 The following technical solution is provided: a complex computing program generation system for a control system, comprising: a user interface 101, a function management 102, a debugging component 103, and a generation component 104, wherein the user interface 101 provides a customized interface for complex computing applications, the function management 102 is responsible for the synchronization and storage of complex computing related function blocks, the debugging component 103 supports instant feedback of complex computing results and backtracking of historical customization processes, and the generation component 104 is responsible for generating a complex computing program that can be imported by a target control system configuration development platform based on the customization results.
[0045] In this embodiment, the complex calculation program generated by the control system complex calculation program generation system is imported into the target control system configuration development platform, compiled into an executable file together with other control programs, and downloaded to the target control system operation platform for execution.
[0046] Optionally, the control system complex calculation program generation system can be presented in the form of a control system configuration development platform, and can also exist in the form of independent software.
[0047] In a preferred embodiment, the target control system operating platform includes at least one runtime. Optionally, these runtimes can be on the same device or on different devices, and the complex computing programs can be executed collaboratively through physical connections and communication logic. The generated complex computing programs are stored in XML file format, and the execution part of each runtime corresponds to an XML file.
[0048] In this embodiment, combined Figure 2 ,like Figure 2 A schematic diagram of executing a complex computing program generation system for a control system provided by an embodiment of the present invention includes the following steps:
[0049] Step S201: Synchronizing the computing module of the target control system configuration development platform;
[0050] In this embodiment, all complex calculation-related function blocks of the target control system configuration development platform are synchronized through the function management 102 to form corresponding calculation modules, which are stored in XML file format.
[0051] Step S202: dynamically adjusting complex computing applications based on the just-in-time debugging results;
[0052] In this embodiment, the user uses the synchronously obtained computing module on the user interface 101 to customize a complex computing application that meets the application requirements. The real-time debugging result is given by the debugging component 103, which is consistent with the execution result on the target control system running platform and is visually displayed on the user interface 101; the dynamic adjustment includes at least process modification and parameter modification of the complex computing application, wherein the process modification includes at least adding or deleting computing modules, and creating or merging process branches, and the operation object of the parameter modification is the selected computing module, and the modifiable parameters are consistent with the input pins of the complex computing function block corresponding to the computing module.
[0053] Preferably, the user can trace back the historical customization process through the debugging component 103 on the user interface 101 .
[0054] Step S203: generating a complex calculation program according to the customized result;
[0055] In this embodiment, the generation component 104 executes the following control system complex calculation program generation method to generate a corresponding complex calculation program, which is imported into the target control system configuration development platform, compiled into an executable file together with other control programs, and downloaded to the target control system operating platform for execution.
[0056] On the basis of the above embodiments, the control system complex calculation program generation method provided in the following embodiments can be applied to any of the above system embodiments.
[0057] In this embodiment, combined Figure 3 , Figure 3 A flowchart of a method for generating a complex calculation program for a control system provided by an embodiment of the present invention includes the following steps:
[0058] Step S301: constructing a complex calculation model according to the user customization result;
[0059] In this embodiment, the complex computing model is a directed graph, including a node set and a directed edge set, wherein the computing nodes correspond one-to-one to the computing modules selected by the customized application, and at least include computing module index information and set parameters; the directed edges include at least a logic path and a data path, wherein the logic path corresponds one-to-one to the process designed by the customized application, and the data path records the data flow between two computing nodes;
[0060] Exemplarily, the direction of the logic path depends on the design flow, and the direction of the data path depends on the logic path;
[0061] Exemplarily, the nodes also include at least conditional nodes, input nodes and output nodes, which do not undertake specific computing tasks, wherein the conditional nodes select the logical path flow of the model according to the execution conditions, and the input nodes and output nodes serve as the start and end of the complex computing model respectively.
[0062] Furthermore, step S301 also includes: optimizing complex computing models, identifying dependencies between computing module parameters, and ensuring serial relationships by merging process branches for computing modules with dependencies; and parallelizing computing by creating new process branches for computing modules without dependencies.
[0063] In this embodiment, combined Figure 4 , Figure 4An example diagram of complex computing model optimization provided in an embodiment of the present invention, wherein the exemplified complex computing model has 1 input node, 4 computing nodes, 1 conditional node and 1 output node, wherein FB1 to FB4 are all computing nodes, storing index information and related parameter information of corresponding computing modules, CondN1 is a conditional node, storing logic information of corresponding conditional elements; In and Out, as virtual nodes, respectively represent the input and output of the computing model; there are 7 data paths and 6 logic paths in total, wherein the input parameter InPara of the input node In is respectively passed to computing nodes FB1 and FB2, the calculation results Para1 and Para2 of FB1 and FB2 are passed as two parameters to computing node FB3, the calculation results Para3 and Para4 of FB3 are respectively passed to the conditional node CondN1 and computing node FB4, and finally the calculation result OutPara of FB4 is passed to the output node Out as the final result.
[0064] For example, compared with the complex data path, the logical path of the complex computing model exemplified only constitutes a complex computing sequence executed serially. By analyzing the data path between the nodes, it is found that there is no dependency relationship between the computing nodes FB1 and FB2. A new process branch is created at the input node In to parallelize the execution of the computing nodes FB1 and FB2.
[0065] Step S302: Find the optimal matching solution from computing node to runtime.
[0066] In this embodiment, the matching scheme includes the runtime matched to each computing node and its priority on the runtime. According to the matching scheme, the execution order of the computing nodes on the same runtime is consistent with the priority. The higher priority is executed first, and the lower priority can be executed only after the higher priority computing node is executed. The optimal matching scheme refers to the matching scheme that makes the total execution time of the generated complex computing program the shortest.
[0067] Exemplarily, the set of computing nodes in the complex computing model is recorded as Runtime collection notation The matching scheme is represented by a two-tuple, denoted as in represents the matching function from compute node to runtime, A mapping function representing the priority of a compute node.
[0068] In this embodiment, combined Figure 5 , Figure 5 The schematic diagram of the process of finding the optimal matching solution from computing node to runtime provided by the embodiment of the present invention, wherein step S302 further includes the following steps:
[0069] Step a1: Evaluate the execution time of the computing nodes on each runtime and the data transfer rate between runtimes, and establish a matching optimization problem model.
[0070] Exemplarily, a data path is represented by a triple, denoted as (u, v, d), where u and v represent a node generating data and a node receiving data, respectively, and d represents the data size. A logical path is represented by a triple, denoted as (u, v, d 0 ), where u and v represent the predecessor node and successor node respectively, d 0 Indicates the data size of the relevant flag bit, and the execution start time of the computing node c is recorded as s c , the execution end time is recorded as f c ,The evaluation results of execution time at different runtimes are represented as the execution time matrix, denoted as T, and the evaluation results of data transfer rate between runtimes are represented as the transfer rate matrix, denoted as R.
[0071] Specifically, in a complex computing model containing an input node In and an output node Out, In and Out are regarded as computing nodes with an execution time of 0, and the execution start time of the model is s In , the execution end time is f Out The optimization goal of the matching optimization problem is to minimize the execution end time of the complex computing model, denoted as minf Out , based on data paths, logic paths and matching schemes, constraints are established, and the data path set in the complex computing model is recorded as The set of logical paths is denoted by First, merge the data path set and the logic path set to form an execution dependency set, denoted as The execution dependency (u, v, d) means that v can only be executed after u is executed and receives the transmission data of size d. The transmission data includes the data in the data path and the flag of logical reasoning. Then consider the execution of different computing nodes on the same runtime. The low priority can only be executed after the high priority computing node is executed. The constraints are established as follows:
[0072]
[0073] and
[0074] Step a2: Solve the matching optimization problem through an optimization algorithm;
[0075] In this embodiment, the matching optimization problem is solved by a heuristic algorithm. First, a code is constructed, and the code length is It is divided into two parts: runtime matching and priority division. The encoding value range of the runtime matching part is The priority division part encoding value range is Then, a fitness function is constructed to calculate the execution end time of the complex computing model corresponding to the code according to the above constraints. Finally, the code corresponding to the minimum execution end time is found as the optimal matching solution through population initialization and iteration.
[0076] Step S303: Generate a complex calculation program corresponding to the runtime matching result;
[0077] In this embodiment, combined Figure 6 , Figure 6 A flowchart diagram of generating a complex computing program corresponding to the runtime matching result provided by an embodiment of the present invention, according to which the following specific steps can be obtained:
[0078] Step b1: Map the nodes to control system components;
[0079] Exemplarily, the calculation nodes are mapped to corresponding function blocks, the condition nodes are mapped to components such as contact elements, coil elements, and logic elements, and the input and output nodes are not mapped.
[0080] Step b2: Bind variables to components according to data paths;
[0081] Exemplarily, for a data path (u, v, d), the same variable is bound to the output pin of the function block corresponding to the node u and the input pin of the function block corresponding to the node v.
[0082] Step b3: declare an end flag for the component, and generate execution start trigger logic and execution end setting logic corresponding to the complex calculation model;
[0083] Exemplarily, executing the start trigger logic means that the end flags of all predecessor node components are simultaneously true, and executing the end setting logic means setting the end flag of the current node component to true.
[0084] Step b4: Add communication logic according to the runtime matching scheme and integrate the program segments corresponding to the nodes to form a complex calculation program that needs to be executed at each runtime;
[0085] Exemplarily, the communication logic refers to transmitting the flag bits corresponding to the logic path and the data corresponding to the data path to the corresponding runtime.
[0086] In this embodiment, combined Figure 7The control system complex calculation program generation method provided by the present invention can be implemented in any control system programming language. Exemplarily, the LD language is used as an example to illustrate the generation method of a computing node related program segment. First, the function block corresponding to the computing node FB3 is instantiated, and then the variables Para1, Para2, Para3 and Para4 are bound according to the input and output pins of the data path FB3, wherein the input pin binding variables Para1 and Para2 are also bound to the output pins of the predecessor nodes FB1 and FB2, and then the end flag FB3_Done is declared, and the execution start trigger logic before the execution of the function block is generated, including the judgment of the end flags FB1_Done and FB2_Done of the predecessor nodes FB1 and FB2, and the execution end setting logic after the execution of the function block, FB3_Done is set to true, and finally the communication logic is added to send the end flag FB3_Done and the output data Para3 and Para4 to the runtime where FB4 is located.
[0087] 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.
[0088] 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 complex computing program generation system for a control system, characterized in that: Functional units including user interface, function management, debugging components and generation components; The user interface is used to provide a customized interface for complex computing programs; The function management is responsible for the synchronization and storage of complex calculation related function blocks; The debugging component is used to support instant feedback of complex calculation results and backtracking of historical customization processes; The generation component is responsible for generating a complex calculation program according to the customized results.
2. The complex calculation program generation system for a control system according to claim 1, characterized in that: The complex calculation program generated according to the customization result is imported into the target control system configuration development platform, compiled into an executable file together with other control programs, and downloaded to the target control system operation platform for execution.
3. The complex calculation program generation system for a control system according to claim 2, characterized in that: The system includes the following steps: Synchronize the calculation module of the target control system configuration development platform; the calculation module corresponds one-to-one with all the complex calculation related functional blocks of the target control system configuration development platform; Dynamically adjust complex computing applications based on real-time debugging results; the dynamic adjustment at least includes process modification and parameter modification of complex computing applications, wherein the process modification at least includes adding or deleting computing modules, and creating or merging process branches, the operation object of parameter modification is the selected computing module, and the modifiable parameters are consistent with the input pins of the complex computing function blocks corresponding to the computing modules; A method for generating a complex calculation program for a control system is executed to generate a complex calculation program according to customized results.
4. A method for generating a complex calculation program for a control system, characterized in that: The following steps are involved: Step S301: constructing a complex calculation model according to the user customization result; Step S302: Find the optimal matching solution from computing node to runtime; Step S303: Generate a complex calculation program corresponding to the runtime matching result.
5. The method for generating a complex calculation program for a control system according to claim 4, characterized in that: The complex computing model is a directed graph, including a node set and a directed edge set, wherein the computing nodes correspond one-to-one to the computing modules selected by the customized application, and at least include computing module index information and set parameters; the directed edges include at least a logic path and a data path, wherein the logic path corresponds one-to-one to the process designed by the customized application, and the data path records the data flow between two computing nodes; The node set includes at least: Conditional nodes select the logical path flow of complex computing models according to execution conditions; Input node: serves as the starting point for complex computational models; Output node: serves as the end of a complex computational model.
6. The method for generating a complex calculation program for a control system according to claim 5, characterized in that: The step S301 also includes: optimizing the complex computing model, identifying the dependencies between the computing module parameters, and ensuring the serial relationship by merging process branches for the computing modules with dependencies; and parallelizing the computing by creating new process branches for the computing modules without dependencies.
7. A method and system for generating a complex calculation program for a control system according to claim 6, characterized in that: The matching scheme includes the runtime matched to each computing node and its priority on the runtime. According to the matching scheme, the execution order of the computing nodes on the same runtime is consistent with the priority. The high priority is executed first, and the low priority can only be executed after the high priority computing node is executed. The optimal matching scheme refers to the matching scheme that makes the total execution time of the generated complex computing program the shortest.
8. The method for generating a complex calculation program for a control system according to claim 7, characterized in that: The step S302 further includes: Evaluate the execution time of computing nodes on each runtime and the data transfer rate between runtimes, and establish a matching optimization problem model; Create constraints as follows: and Among them, (u, v, d) represents the data path, u and v represent the predecessor node that generates data and the successor node that receives data, respectively, and s v 、s u Respectively represent the start execution time of the predecessor node and the successor node, f u 、f v Respectively represent the end execution time of the predecessor node and the successor node, Respectively represent the runtime matched by the predecessor node and the successor node, Respectively represent the priorities of the predecessor node and the successor node, T u represents the execution time required by the predecessor node on the matched runtime, d represents the data size, and R represents the transmission rate matrix; The matching optimization problem is solved by optimization algorithm.
9. The method for generating a complex calculation program for a control system according to claim 8, characterized in that: The step S303 specifically includes the following steps: Step b1: Map the nodes to control system components; Step b2: Bind variables to components according to data paths; Step b3: declare an end flag for the component, and generate execution start trigger logic and execution end setting logic corresponding to the complex calculation model; Step b4: Add communication logic according to the runtime matching scheme and integrate the program segments corresponding to the nodes to form a complex calculation program that needs to be executed at each runtime.