PLC program editing method, compiling method, executing method and device

By marking the function blocks in the PLC program as asynchronous execution and utilizing asynchronous service threads, the problems of insufficient flexibility and low execution efficiency of the PLC system are solved, and more efficient task execution and application of complex algorithms are achieved.

CN120596096AActive Publication Date: 2025-09-05BEIJING WANSHENG INTELLIGENT TECH CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202510596657.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-09
Publication Date
2025-09-05
Estimated Expiration
2045-05-09

AI Technical Summary

Technical Problem

When faced with complex and diverse industrial task requirements, existing PLC systems are not flexible enough and have low execution efficiency. In particular, when combined with AI reasoning tasks, the execution time of the main task is significantly extended.

Method used

Asynchronous execution is achieved by marking the function block instance as asynchronous execution in the PLC program editing interface, adding asynchronous execution parameters, setting the asynchronous function block call entry and memory layout, and using the asynchronous service thread to execute the asynchronous function block instance.

Benefits of technology

It improves the execution efficiency and flexibility of PLC programs, enables faster application of complex algorithms, and supports the efficient operation of AI reasoning tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120596096A_ABST
    Figure CN120596096A_ABST
Patent Text Reader

Abstract

The invention discloses a PLC program editing method, compiling method, execution method and device, and relates to the technical field of industrial control and PLC, and the method comprises the steps: displaying an editing interface which comprises a to-be-edited function block instance and a function block instance editing item of the function block instance; when the executed editing operation of the function block instance editing item shows that the function block instance is set to be executed asynchronously, the function block instance in the PLC program edited this time is marked to be executed asynchronously; in an editing interface, aiming at the asynchronous function block instance, displaying a parameter editing item of the asynchronous function block instance, the parameter editing item being used for editing an asynchronous execution parameter of the asynchronous function block instance, and the asynchronous execution parameter being used for asynchronously executing the asynchronous function block instance; and obtaining actual parameters of the asynchronous execution parameters set based on the parameter editing item to obtain a defined asynchronous function block instance. By adopting the scheme, the function block instance is set to be asynchronous execution more flexibly.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the fields of industrial control technology and PLC technology, and in particular to a PLC program editing method, compilation method, execution method and device. Background Art

[0002] In today's era of rapid industrial automation and intelligent development, the scope of tasks performed by programmable logic controllers (PLCs) continues to expand and deepen. In the traditional PLC operating model, function blocks are executed sequentially within the main task cycle. This model exposes numerous difficult-to-ignore issues when faced with today's complex and diverse task demands.

[0003] As the transformation to intelligent industry progresses, more and more AI (artificial intelligence) technologies are being integrated into industrial control processes. For example, in quality inspection, AI algorithms are used to analyze product images to determine product conformity. In fault prediction, machine learning models are used to analyze equipment operating data in real time to predict potential failures.

[0004] However, AI inference tasks usually require a large amount of data processing and complex algorithm calculations, and their execution process is extremely time-consuming. When such AI inference function blocks are executed sequentially with other conventional function blocks within the main task cycle, the execution time of the main task will be greatly extended.

[0005] On the other hand, today's increasingly complex industrial applications and diverse processes are driving a growing demand for diverse algorithms. The traditional PLC's cyclical execution model prevents many existing algorithms from being quickly and easily implemented in PLC systems. These algorithms require specialized designs tailored to the system's execution characteristics, hindering the development of intelligent industrial applications.

[0006] That is, the existing technology has the problems of insufficient flexibility in the application of PLC and low execution efficiency. Summary of the Invention

[0007] The embodiments of the present application provide a PLC program editing method, a compiling method, an execution method and a device to solve the problems of insufficient flexibility and low execution efficiency in the prior art for PLC applications.

[0008] The present invention provides a method for editing a PLC program, including: Displaying an editing interface, wherein the editing interface includes a function block instance to be edited and a function block instance editing item of the function block instance; When the editing operation executed on the function block instance editing item indicates that the function block instance is set to be executed asynchronously, the function block instance in the currently edited PLC program is marked as being executed asynchronously, and the function block instance marked as being executed asynchronously is used as an asynchronous function block instance; In the editing interface, for the asynchronous function block instance, a parameter editing item of the asynchronous function block instance is displayed, wherein the parameter editing item is used to edit the asynchronous execution parameters of the asynchronous function block instance, and the asynchronous execution parameters are used to asynchronously execute the asynchronous function block instance; The actual parameters of the asynchronous execution parameters set based on the parameter editing items are acquired to obtain the defined asynchronous function block instance.

[0009] Furthermore, the display editing interface includes: Displaying a text editing interface, wherein the function block instance editing item is used to perform an editing operation by adding a preset grammatical markup, indicating that the function block instance is set to be executed asynchronously; or A graphical editing interface is displayed, wherein the function block instance editing item includes a preset editing option. When the preset editing option is selected, it indicates that the function block instance is set to be executed asynchronously.

[0010] Furthermore, the function block editing item is a check box corresponding to all function block instances to be edited, and when the check box is checked, it indicates that the corresponding function block instance is set to be executed asynchronously.

[0011] Furthermore, the asynchronous execution parameters include: Input parameters used to trigger asynchronous execution of function block instances as start execution parameters; Output parameter used to indicate that the function block instance is being executed, as the executing parameter; Output parameter used to indicate that the function block instance has completed execution, as the execution completion parameter.

[0012] The present application also provides a PLC program compiling method, including: For a function block instance defined in a PLC program to be compiled, when the function block instance is marked as an asynchronous function block instance for asynchronous execution, adding an asynchronous execution parameter of the asynchronous function block instance, wherein the asynchronous execution parameter is used to asynchronously execute the asynchronous function block instance; Setting the calling entry of the asynchronous function block instance as the asynchronous function block calling entry, wherein the parameter of the asynchronous function block calling entry is the memory address allocated for the asynchronous function block instance; A memory layout is created for the asynchronous function block instance according to the memory layout defined in the function block corresponding to the asynchronous function block instance, and compiled code for asynchronously executing the asynchronous function block instance is obtained.

[0013] Furthermore, the asynchronous execution parameters include: Input parameters used to trigger asynchronous execution of function block instances as start execution parameters; Output parameter used to indicate that the function block instance is being executed, as the executing parameter; Output parameter used to indicate that the function block instance has completed execution, as the execution completion parameter.

[0014] Furthermore, for the function block instance defined in the PLC program to be compiled, when the function block instance is marked as an asynchronous function block instance for asynchronous execution, before adding the asynchronous execution parameter of the asynchronous function block instance, the method further includes: For a function block instance defined in a PLC program to be compiled, when the function block instance is marked as an asynchronous function block instance for asynchronous execution, generating source code of an asynchronous function block having the same function as the function block corresponding to the asynchronous function block instance, wherein the source code includes asynchronous execution parameters and an asynchronous function block call entry of the asynchronous function block instance; The adding of the asynchronous execution parameters of the asynchronous function block instance includes: Adding asynchronous execution parameters of the asynchronous function block instance by compiling the source code of the asynchronous function block; The step of setting the calling entry of the asynchronous function block instance as the asynchronous function block calling entry includes: By compiling the source code of the asynchronous function block, setting the calling entry of the asynchronous function block instance as the asynchronous function block calling entry; The creating a memory layout for the asynchronous function block instance according to the memory layout defined in the function block corresponding to the asynchronous function block instance includes: By compiling the source code of the asynchronous function block, a memory layout is created for the asynchronous function block instance according to the memory layout defined in the function block corresponding to the asynchronous function block instance.

[0015] Furthermore, the asynchronous function block call entry includes: for determining whether to start executing a program statement of the asynchronous function block instance based on a current parameter value of the asynchronous execution parameter; A program statement for calling a runtime asynchronous function block service, wherein the runtime asynchronous function block service is used to asynchronously execute the asynchronous function block instance.

[0016] Furthermore, the parameters of the runtime asynchronous function block service include: a memory address allocated to the asynchronous function block instance, and a function block call entry of the function block corresponding to the asynchronous function block instance; The runtime asynchronous function block service is used to execute the asynchronous function block instance through an asynchronous service thread.

[0017] The present application also provides a PLC program execution method, including: For an asynchronous function block instance to be executed in a PLC program, asynchronously executing the asynchronous function block instance by calling an asynchronous function block call entry of the asynchronous function block instance based on a current parameter value of an asynchronous execution parameter of the asynchronous function block instance and a memory layout, wherein the parameter of the asynchronous function block call entry is a memory address allocated for the asynchronous function block instance; While the asynchronous function block instance is being asynchronously executed, statements following the asynchronous function block instance in the PLC program are executed.

[0018] Furthermore, asynchronously executing the asynchronous function block instance based on the current parameter value of the asynchronous execution parameter of the asynchronous function block instance and the memory layout includes: When the current parameter value of the asynchronous execution parameter of the asynchronous function block instance indicates that execution is started, calling a runtime asynchronous function block service, wherein the parameters of the runtime asynchronous function block service include: a memory address allocated for the asynchronous function block instance, and a function block call entry of a function block corresponding to the asynchronous function block instance; The runtime asynchronous function block service is used to execute the asynchronous function block instance through an asynchronous service thread.

[0019] Furthermore, the runtime asynchronous function block service is used to execute the asynchronous function block instance through the asynchronous service thread by adopting the following steps: Creating an asynchronous task, wherein the asynchronous task includes a memory address allocated to the asynchronous function block instance according to the memory layout of the asynchronous function block instance, and a function block call entry of a function block corresponding to the asynchronous function block instance; Calling the function block call entry by using the memory address as a parameter through an asynchronous service thread to execute the function block; Updating the current parameter value of the asynchronous execution parameter; Releases the memory allocated for executing the asynchronous task.

[0020] Furthermore, the asynchronous execution parameters include: Input parameters used to trigger asynchronous execution of function block instances as start execution parameters; Output parameter used to indicate that the function block instance is being executed, as the executing parameter; Output parameter used to indicate that the function block instance has completed execution, as the execution completion parameter.

[0021] The present application also provides a PLC program editing device, comprising: An instance editing and displaying module, configured to display an editing interface, wherein the editing interface includes a function block instance to be edited and a function block instance editing item of the function block instance; an asynchronous setting module, configured to mark the function block instance in the currently edited PLC program as asynchronously executed when the editing operation executed on the function block instance editing item indicates that the function block instance is set to be executed asynchronously, and to use the function block instance marked as asynchronously executed as an asynchronous function block instance; A parameter editing and display module is used to display parameter editing items of the asynchronous function block instance in an editing interface, wherein the parameter editing items are used to edit asynchronous execution parameters of the asynchronous function block instance, and the asynchronous execution parameters are used to asynchronously execute the asynchronous function block instance; The actual parameter acquisition module is used to acquire the actual parameters of the asynchronous execution parameters set based on the parameter editing items, and obtain the defined asynchronous function block instance.

[0022] Furthermore, the display editing interface includes: Displaying a text editing interface, wherein the function block instance editing item is used to perform an editing operation by adding a preset grammatical markup, indicating that the function block instance is set to be executed asynchronously; or A graphical editing interface is displayed, wherein the function block instance editing item includes a preset editing option. When the preset editing option is selected, it indicates that the function block instance is set to be executed asynchronously.

[0023] Furthermore, the function block editing item is a check box corresponding to all function block instances to be edited, and when the check box is checked, it indicates that the corresponding function block instance is set to be executed asynchronously.

[0024] Furthermore, the asynchronous execution parameters include: Input parameters used to trigger asynchronous execution of function block instances as start execution parameters; Output parameter used to indicate that the function block instance is being executed, as the executing parameter; Output parameter used to indicate that the function block instance has completed execution, as the execution completion parameter.

[0025] The present application also provides a PLC program compiling device, including: a parameter adding module for adding, for a function block instance defined in a PLC program to be compiled, asynchronous execution parameters of the asynchronous function block instance when the function block instance is marked as an asynchronous function block instance for asynchronous execution, wherein the asynchronous execution parameters are used to asynchronously execute the asynchronous function block instance; A calling entry setting module, used to set the calling entry of the asynchronous function block instance to be an asynchronous function block calling entry, wherein the parameter of the asynchronous function block calling entry is a memory address allocated for the asynchronous function block instance; A memory layout creation module is used to create a memory layout for the asynchronous function block instance according to the defined memory layout contained in the function block corresponding to the asynchronous function block instance, and obtain compiled code for asynchronously executing the asynchronous function block instance.

[0026] Furthermore, the asynchronous execution parameters include: Input parameters used to trigger asynchronous execution of function block instances as start execution parameters; Output parameter used to indicate that the function block instance is being executed, as the executing parameter; Output parameter used to indicate that the function block instance has completed execution, as the execution completion parameter.

[0027] Furthermore, it also includes: a source code generation module for generating, for a function block instance defined in a PLC program to be compiled, source code of an asynchronous function block having the same function as the function block corresponding to the asynchronous function block instance when the function block instance is marked as an asynchronous function block instance for asynchronous execution, the source code including asynchronous execution parameters and an asynchronous function block call entry of the asynchronous function block instance; The parameter adding module is specifically used to add the asynchronous execution parameters of the asynchronous function block instance by compiling the source code of the asynchronous function block; The calling entry setting module is specifically used to set the calling entry of the asynchronous function block instance as the asynchronous function block calling entry by compiling the source code of the asynchronous function block; The memory layout creation module is specifically used to create a memory layout for the asynchronous function block instance according to the defined memory layout contained in the function block corresponding to the asynchronous function block instance by compiling the source code of the asynchronous function block.

[0028] Furthermore, the asynchronous function block call entry includes: for determining whether to start executing a program statement of the asynchronous function block instance based on a current parameter value of the asynchronous execution parameter; A program statement for calling a runtime asynchronous function block service, wherein the runtime asynchronous function block service is used to asynchronously execute the asynchronous function block instance.

[0029] Furthermore, the parameters of the runtime asynchronous function block service include: a memory address allocated to the asynchronous function block instance, and a function block call entry of the function block corresponding to the asynchronous function block instance; The runtime asynchronous function block service is used to execute the asynchronous function block instance through an asynchronous service thread.

[0030] The present application also provides a PLC program execution device, including: an asynchronous execution module, configured to asynchronously execute an asynchronous function block instance to be executed in a PLC program by calling an asynchronous function block call entry of the asynchronous function block instance based on a current parameter value of an asynchronous execution parameter of the asynchronous function block instance and a memory layout, wherein the parameter of the asynchronous function block call entry is a memory address allocated for the asynchronous function block instance; A statement execution module is used to execute the statements following the asynchronous function block instance in the PLC program while asynchronously executing the asynchronous function block instance.

[0031] Furthermore, the asynchronous execution module is specifically configured to call a runtime asynchronous function block service when the current parameter value of the asynchronous execution parameter of the asynchronous function block instance indicates starting execution, wherein the parameters of the runtime asynchronous function block service include: a memory address allocated to the asynchronous function block instance, and a function block call entry of the function block corresponding to the asynchronous function block instance; The runtime asynchronous function block service is used to execute the asynchronous function block instance through an asynchronous service thread.

[0032] Furthermore, the runtime asynchronous function block service is used to execute the asynchronous function block instance through the asynchronous service thread by adopting the following steps: Creating an asynchronous task, wherein the asynchronous task includes a memory address allocated to the asynchronous function block instance according to the memory layout of the asynchronous function block instance, and a function block call entry of a function block corresponding to the asynchronous function block instance; Calling the function block call entry by using the memory address as a parameter through an asynchronous service thread to execute the function block; Updating the current parameter value of the asynchronous execution parameter; Releases the memory allocated for executing the asynchronous task.

[0033] Furthermore, the asynchronous execution parameters include: Input parameters used to trigger asynchronous execution of function block instances as start execution parameters; Output parameter used to indicate that the function block instance is being executed, as the executing parameter; Output parameter used to indicate that the function block instance has completed execution, as the execution completion parameter.

[0034] An embodiment of the present application also provides an electronic device, including a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to: implement any of the above-mentioned PLC program editing methods, or implement any of the above-mentioned PLC program compiling methods, or implement any of the above-mentioned PLC program execution methods.

[0035] An embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, it implements any of the above-mentioned PLC program editing methods, or implements any of the above-mentioned PLC program compiling methods, or implements any of the above-mentioned PLC program execution methods.

[0036] An embodiment of the present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the above-described PLC program editing methods, or any of the above-described PLC program compiling methods, or any of the above-described PLC program execution methods.

[0037] The beneficial effects of this application include: In the PLC program editing method provided in an embodiment of the present application, when editing a PLC program, for a function block instance to be edited contained in the editing interface, the function block instance can be marked as asynchronously executed based on the function block instance editing item, and the asynchronous execution parameters can be edited based on the parameter editing item to obtain a defined asynchronous function block instance, thereby achieving more flexible setting of the function block instance to asynchronous execution.

[0038] In the PLC program compilation method provided by an embodiment of the present application, when a function block instance defined in a PLC program to be compiled is marked as asynchronous execution, it indicates that the function block instance is an asynchronous function block instance, the asynchronous execution parameters of the asynchronous function block instance are added, the calling entry of the asynchronous function block instance is set to the asynchronous function block calling entry, and a memory layout is created for the asynchronous function block instance according to the memory layout defined in the function block corresponding to the asynchronous function block instance, and a compilation code for asynchronously executing the asynchronous function block instance is obtained, thereby realizing compilation of the function block instance set to asynchronous execution.

[0039] The PLC program execution method provided in the embodiment of the present application targets an asynchronous function block instance to be executed in the PLC program, asynchronously executes the asynchronous function block instance based on the current parameter value of the asynchronous execution parameter of the asynchronous function block instance and the memory layout by calling the asynchronous function block call entry of the asynchronous function block instance, and at the same time as the asynchronous execution of the asynchronous function block instance, executes the statements following the asynchronous function block instance in the PLC program. Compared with the prior art, the overall execution time of the PLC program can be reduced by flexibly setting the function block instance in the PLC program to asynchronous execution, thereby improving the flexibility and execution efficiency of the PLC application.

[0040] Other features and advantages of the present application will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present application. The purposes and other advantages of the present application can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The accompanying drawings are used to provide a further understanding of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. In the accompanying drawings: Figure 1 A flowchart of a PLC program editing method provided in an embodiment of the present application; Figure 2-1 A schematic diagram of a text editing interface including a function block instance editing item shown in an embodiment of the present application; Figure 2-2 This is a schematic diagram of a text editing interface including parameter editing items shown in an embodiment of the present application; Figure 2-3 A schematic diagram of a graphical editing interface including a function block instance editing item shown in an embodiment of the present application; Figure 2-4 This is a schematic diagram of a graphical editing interface including parameter editing items shown in an embodiment of the present application; Figure 3 A flowchart of a PLC program compilation method provided in an embodiment of the present application; Figure 4 A schematic diagram of compiling a function block instance in an embodiment of the present application; Figure 5 A flowchart of a PLC program execution method provided for an embodiment of the application; Figure 6 A flowchart of a PLC program compiling method provided in another embodiment of the application; Figure 7 A schematic diagram of the structure of a PLC program editing device provided in an embodiment of the present application; Figure 8 A schematic diagram of the structure of a PLC program compiling device provided in an embodiment of the present application; Figure 9 A schematic diagram of the structure of a PLC program execution device provided in an embodiment of the present application; Figure 10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] In order to provide an implementation scheme for improving the flexibility and execution efficiency of PLC applications, the embodiments of the present application provide a PLC program editing method, compilation method, execution method, and apparatus. The preferred embodiments of the present application are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application and are not intended to limit the present application. Furthermore, the embodiments and features of the embodiments in the present application may be combined with each other if there is no conflict.

[0043] The present application embodiment provides a PLC program editing method, such as Figure 1 Shown, including: Step 11: displaying an editing interface, which includes a function block instance to be edited and a function block instance editing item of the function block instance; Step 12: When the edit operation executed on the function block instance edit item indicates that the function block instance is set to be executed asynchronously, the function block instance in the currently edited PLC program is marked as being executed asynchronously, and the function block instance marked as being executed asynchronously is used as an asynchronous function block instance; Step 13: In the editing interface, for the asynchronous function block instance, a parameter editing item of the asynchronous function block instance is displayed, where the parameter editing item is used to edit the asynchronous execution parameters of the asynchronous function block instance, and the asynchronous execution parameters are used to asynchronously execute the asynchronous function block instance; Step 14: Get the actual parameters of the asynchronous execution parameters set based on the parameter editing items, and obtain the defined asynchronous function block instance.

[0044] By adopting the PLC program editing method provided in the embodiment of the present application, when editing a PLC program, for the function block instance to be edited contained in the editing interface, the function block instance can be marked as asynchronously executed based on the function block instance editing item, and the asynchronous execution parameters can be edited based on the parameter editing item to obtain the defined asynchronous function block instance, thereby achieving more flexible setting of the function block instance to asynchronous execution.

[0045] In one embodiment of the present application, the above-mentioned PLC program editing method can be implemented on an editor of the PLC IDE (Integrated Development Environment), such as Figure 2-1As shown, during the PLC program editing process, a text editing interface can be displayed on the IDE. Developers can add text content of the selected function block instance in the text editing interface. In addition, the text content of the function block instance in the text editing interface has a function block instance editing item. Based on the function block instance editing item, the developer can add a preset syntax mark for the function block instance in the text editing interface, indicating that the function block instance is set to asynchronous execution, that is, as an asynchronous function block instance; Figure 2-1 For the same function block A, "no_async_inst: function block A" is an instance of function block A, and "async_inst{{ASYNC:"TRUE"}}: function block A" is an asynchronous instance of function block A. That is, for the same function block A, the corresponding function block instance can be flexibly set to asynchronous execution or non-asynchronous execution.

[0046] Correspondingly, such as Figure 2-2 As shown, after adding the preset syntax mark to the function block instance, the parameter editing items of the asynchronous function block instance are displayed in the text editing interface. Developers can set the actual parameters (actual parameters) of the asynchronous execution parameters based on the parameter editing items. For example, Figure 2-2 In, "async_inst(Execute:=TRUE,Done=>done,Busy=>busy)".

[0047] In another embodiment of the present application, Figure 2-3 As shown, during the PLC program editing process, a graphical editing interface can be displayed on the IDE. The developer can select a function block icon of a function block instance to be used on the graphical editing interface. Furthermore, the function block instance editing item for the selected function block instance in the graphical editing interface includes a preset editing option. The developer can set the function block instance to asynchronous execution by selecting the preset editing option, that is, as an asynchronous function block instance. Correspondingly, such as Figure 2-4 As shown, when the preset editing option is selected for the function block instance, the parameter editing items of the function block instance are displayed in the graphical editing interface. The parameter editing items can be the pins corresponding to each execution parameter on the function block icon. Developers can set the actual parameters (actual parameters) of the asynchronous execution parameters based on the parameter editing items.

[0048] Figure 2-3 In the example, for the function block instance "counter_1" in the middle, the corresponding function block instance editing item is displayed. After selecting "Convert to asynchronous call", the function block instance is set to an asynchronous function block instance and displayed. Figure 2-4The graphical editing interface shown in the figure has a parameter editing item on the function block icon. Compared with the non-asynchronous execution function block instance "cpp_counter-1", it corresponds to the same function block, but the parameter editing item adds pins corresponding to asynchronous execution parameters, such as "Execute", "Busy", "Done", etc. Click the pin to set the actual parameters of the corresponding asynchronous execution parameter.

[0049] In addition to using the above-mentioned text editing interface and graphic editing interface to set the function block instance to asynchronous execution, in another embodiment of the present application, a check box method can also be used, that is, the function block instance editing item in the editing interface is a check box corresponding to all the function block instances selected for use. When the check box is checked, it means that the corresponding function block instance is set to asynchronous execution.

[0050] In the embodiment of the present application, the asynchronous execution parameters used for asynchronous execution may include: The input parameter used to trigger the asynchronous execution of the function block instance, as the start execution parameter, can be named execute; Output parameter used to indicate that the function block instance is being executed. As an executing parameter, it can be named busy. The output parameter used to indicate that the function block instance has been executed is an execution completion parameter and can be named done.

[0051] Accordingly, the present application also provides a PLC program compilation method, such as Figure 3 Shown, including: Step 31: For a function block instance defined in a PLC program to be compiled, when the function block instance is marked as an asynchronous function block instance and is executed asynchronously, an asynchronous execution parameter of the asynchronous function block instance is added, where the asynchronous execution parameter is used to asynchronously execute the asynchronous function block instance. Step 32: Set the call entry of the asynchronous function block instance to the asynchronous function block call entry, where the parameter of the asynchronous function block call entry is the memory address allocated for the asynchronous function block instance; Step 33: Create a memory layout for the asynchronous function block instance according to the memory layout defined in the function block corresponding to the asynchronous function block instance, and obtain compiled code for asynchronously executing the asynchronous function block instance.

[0052] Using the PLC program compilation method provided by the embodiment of the present application, when the function block instance defined in the PLC program to be compiled is marked as asynchronous execution, it indicates that the function block instance is an asynchronous function block instance, the asynchronous execution parameters of the asynchronous function block instance are added, the call entry of the asynchronous function block instance is set to the asynchronous function block call entry, and according to the memory layout defined in the function block corresponding to the asynchronous function block instance, a memory layout is created for the asynchronous function block instance, and the compilation code for asynchronously executing the asynchronous function block instance is obtained, thereby realizing the compilation of the function block instance set for asynchronous execution.

[0053] In one embodiment of the present application, the above-mentioned PLC program compilation method can be implemented on the compiler of the PLC IDE. For the function block instance defined in the PLC program to be compiled, if the function block instance is not marked as asynchronous execution, the source code of the function block corresponding to the function block instance can be directly compiled and compiled into the compiled code corresponding to the function block instance that is not asynchronously executed. Compilation can also be understood as the instantiation of the function block, such as Figure 4 As shown, for function block A, it can be compiled into function block A instance 1 and function block A instance 2 that are not executed asynchronously.

[0054] For the function block instance defined in the PLC program to be compiled, if the function block instance is marked as asynchronous execution, the above compilation method can be used to directly compile the source code of the function block corresponding to the function block instance according to the asynchronous execution compilation method, and compile it into the compiled code corresponding to the asynchronous execution function block instance, such as Figure 4 As shown, for the same function block A, it can be compiled into a function block A instance 3 that is executed asynchronously.

[0055] In another embodiment of the present application, for an asynchronous function block instance marked as asynchronous execution in a PLC program, such as Figure 4 As shown, the source code of an asynchronous function block with the same function as the function block corresponding to the asynchronous function block instance can also be generated first. The source code can be used as a temporary source code. The temporary source code contains the asynchronous execution parameters and the asynchronous function block call entry of the asynchronous function block instance. Then, by compiling the source code of the asynchronous function block, the asynchronous execution parameters of the asynchronous function block instance are added, the call entry is set to the asynchronous function block call entry, and the memory layout is created, as shown in FIG. Figure 4 As shown, for the same function block A, the source code of the asynchronous function block A corresponding to the function block A is automatically generated first, and the source code of the asynchronous function block A is compiled to obtain the asynchronously executed function block A instance 3.

[0056] In the embodiment of the present application, the asynchronous function block call entry may include: A program statement for determining whether to start executing the asynchronous function block instance based on the current parameter value of the asynchronous execution parameter; A program statement used to call a runtime asynchronous function block service that is used to asynchronously execute an asynchronous function block instance.

[0057] The above-mentioned asynchronous function block call entry and runtime asynchronous function block service are both functions.

[0058] Furthermore, the parameters of the runtime asynchronous function block service may include: a memory address allocated for the asynchronous function block instance, and a function block call entry of the function block corresponding to the asynchronous function block instance; The runtime asynchronous function block service is used to execute the asynchronous function block instance through an asynchronous service thread.

[0059] Accordingly, the embodiment of the present application also provides a PLC program execution method, such as Figure 5 Shown, including: Step 51: For an asynchronous function block instance to be executed in the PLC program, asynchronously execute the asynchronous function block instance by calling an asynchronous function block call entry of the asynchronous function block instance based on the current parameter value of the asynchronous execution parameter of the asynchronous function block instance and the memory layout, where the parameter of the asynchronous function block call entry is the memory address allocated for the asynchronous function block instance; Step 52: While asynchronously executing the asynchronous function block instance, execute the statements following the asynchronous function block instance in the PLC program.

[0060] The PLC program execution method provided in the embodiment of the present application is adopted. For an asynchronous function block instance to be executed in the PLC program, the asynchronous function block call entry of the asynchronous function block instance is called, and based on the current parameter value of the asynchronous execution parameter of the asynchronous function block instance and the memory layout, the asynchronous function block instance is asynchronously executed. Moreover, while the asynchronous function block instance is asynchronously executed, the statements following the asynchronous function block instance in the PLC program are executed. Compared with the existing technology, the overall execution time of the PLC program can be reduced by flexibly setting the function block instance in the PLC program to asynchronous execution, thereby improving the flexibility and execution efficiency of the PLC application.

[0061] In the application of PLC, PLC application is often realized by periodically executing PLC tasks. A PLC task can include multiple function block instances and multiple functions, and the functions and function block instances are called through program statements to complete the execution of the PLC task.

[0062] In one embodiment of the present application, for the above-mentioned PLC program execution method, as shown in FIG. Figure 6 As shown, the following steps may be specifically included: Step 61: During the execution of the PLC program, for an asynchronous function block instance to be executed asynchronously, the asynchronous function block call entry of the asynchronous function block instance is called, and the parameter of the asynchronous function block call entry is the memory address allocated for the asynchronous function block instance.

[0063] In actual applications, during the periodic execution of PLC tasks, when an asynchronous function block instance that needs to be executed asynchronously is encountered, this step is used to call the asynchronous function block call entry.

[0064] Step 62: Based on the current parameter value of the asynchronous execution parameter of the asynchronous function block instance, determine whether to start executing the asynchronous function block instance. If it is determined to start execution, execute step 63. If it is determined not to start execution, return directly and continue to execute the statements after the asynchronous function block instance.

[0065] In this step, if it is determined not to start execution, it can be understood that the asynchronous function block instance is in the process of being executed, and the start-up execution of the asynchronous function block instance in this cycle can be skipped.

[0066] In an embodiment of the present application, when the asynchronous execution parameters specifically include the above-mentioned start execution parameter execute, the executing parameter busy, and the execution completion parameter done, if the start execution parameter execute is a rising edge, that is, changes from 0 to 1, and the executing parameter busy is 0, indicating that it is not being executed, it is determined that the asynchronous function block instance is started to be executed; otherwise, it returns directly and continues to execute the statements after the asynchronous function block instance.

[0067] In actual applications, the value of the execution parameter execute changes from 1 to 0, depending on the actual value of the variable that the caller needs to pass in, which will not be described in detail here.

[0068] Step 63: Call the runtime asynchronous function block service. The parameters of the runtime asynchronous function block service include: the memory address allocated to the asynchronous function block instance, and the function block call entry of the function block corresponding to the asynchronous function block instance. The function block call entry can be understood as the original function block call entry of the function block, which is different from the above-mentioned asynchronous function block call entry.

[0069] By calling the runtime asynchronous function block service, the following steps 64 to 67 are executed.

[0070] Step 64 : Create an asynchronous task, which includes a memory address allocated to the asynchronous function block instance according to the memory layout of the asynchronous function block instance, and a function block call entry of the function block corresponding to the asynchronous function block instance.

[0071] The busy parameter is set to 1, indicating that the function block instance is being executed asynchronously, and the done parameter is set to 0, indicating that the execution is not completed.

[0072] Step 65: The asynchronous service thread uses the memory address as a parameter to call the function block call entry to execute the function block corresponding to the asynchronous function block instance.

[0073] In this step, the asynchronous service thread can be created in advance or created when needed.

[0074] In actual applications, the asynchronous task created in the above step 64 can be put into an asynchronous task queue, waiting for the asynchronous service thread to obtain the asynchronous task from the asynchronous task queue and execute it.

[0075] Step 66: After completing the execution of the asynchronous function block instance, the current parameter value of the asynchronous execution parameter is updated through the asynchronous service thread.

[0076] Specifically, the busy parameter can be set to 0, and the done parameter can be set to 1, indicating that the execution is complete.

[0077] Step 67: Release the memory allocated for executing the asynchronous task through the asynchronous service thread.

[0078] Step 68: After executing the above step 64 to create the asynchronous task, enter this step 68, and while asynchronously executing the asynchronous function block instance through the asynchronous task thread, execute the statements after the asynchronous function block instance in the PLC program.

[0079] This enables asynchronous execution of the asynchronous function block instance relative to other program statements of the PLC task to which it belongs, thereby improving task execution efficiency.

[0080] By adopting the above-mentioned PLC program editing method, compilation method and execution method provided in the embodiment of the present application, the selected function block can be flexibly set to asynchronous execution or non-asynchronous execution without modifying the existing function block. That is to say, there is no need to make a specific implementation for the asynchronous execution mode within the function block. By adopting the above-mentioned method provided in the embodiment of the present application, the asynchronous execution function of the function block can be automatically provided, so that in the application of PLC, the asynchronous execution scheme has greater flexibility and practicality.

[0081] Moreover, function blocks written in various languages ​​can be set to asynchronous execution using the above-mentioned method provided in the embodiment of the present application, thereby more conveniently bringing existing algorithm implementations and ecosystems of multiple writing languages ​​into the PLC system, and making it possible to run complex algorithms and AI reasoning tasks in the PLC.

[0082] Based on the same inventive concept, according to the PLC program editing method provided in the above embodiment of the present application, correspondingly, another embodiment of the present application also provides a PLC program editing device, whose structural diagram is shown in FIG. Figure 7 As shown, specifically including: An instance editing and displaying module 71 is used to display an editing interface, wherein the editing interface includes a function block instance to be edited and a function block instance editing item of the function block instance; an asynchronous setting module 72 for marking the function block instance in the currently edited PLC program as asynchronously executed when the editing operation executed on the function block instance editing item indicates that the function block instance is set to be executed asynchronously, and treating the function block instance marked as asynchronously executed as an asynchronous function block instance; A parameter editing and display module 73 is used to display parameter editing items of the asynchronous function block instance in an editing interface, wherein the parameter editing items are used to edit asynchronous execution parameters of the asynchronous function block instance, and the asynchronous execution parameters are used to asynchronously execute the asynchronous function block instance; The actual parameter acquisition module 74 is used to acquire the actual parameters of the asynchronous execution parameters set based on the parameter editing items, and obtain the defined asynchronous function block instance.

[0083] Furthermore, the display editing interface includes: Displaying a text editing interface, wherein the function block instance editing item is used to perform an editing operation by adding a preset grammatical markup, indicating that the function block instance is set to be executed asynchronously; or A graphical editing interface is displayed, wherein the function block instance editing item includes a preset editing option. When the preset editing option is selected, it indicates that the function block instance is set to be executed asynchronously.

[0084] Furthermore, the function block editing item is a check box corresponding to all function block instances to be edited, and when the check box is checked, it indicates that the corresponding function block instance is set to be executed asynchronously.

[0085] Furthermore, the asynchronous execution parameters include: Input parameters used to trigger asynchronous execution of function block instances as start execution parameters; Output parameter used to indicate that the function block instance is being executed, as the executing parameter; Output parameter used to indicate that the function block instance has completed execution, as the execution completion parameter.

[0086] Based on the same inventive concept, according to the PLC program compiling method provided in the above embodiment of the present application, another embodiment of the present application also provides a PLC program compiling device, whose structural diagram is shown in FIG. Figure 8 As shown, specifically including: a parameter adding module 81 for adding asynchronous execution parameters of a function block instance defined in a PLC program to be compiled, when the function block instance is marked as an asynchronous function block instance for asynchronous execution, wherein the asynchronous execution parameters are used to asynchronously execute the asynchronous function block instance; A calling entry setting module 82 is used to set the calling entry of the asynchronous function block instance to be an asynchronous function block calling entry, wherein the parameter of the asynchronous function block calling entry is the memory address allocated for the asynchronous function block instance; The memory layout creation module 83 is used to create a memory layout for the asynchronous function block instance according to the defined memory layout contained in the function block corresponding to the asynchronous function block instance, and obtain compiled code for asynchronously executing the asynchronous function block instance.

[0087] Furthermore, the asynchronous execution parameters include: Input parameters used to trigger asynchronous execution of function block instances as start execution parameters; Output parameter used to indicate that the function block instance is being executed, as the executing parameter; Output parameter used to indicate that the function block instance has completed execution, as the execution completion parameter.

[0088] Furthermore, it also includes: a source code generation module 84 for generating, for a function block instance defined in a PLC program to be compiled, source code for an asynchronous function block having the same functionality as the function block corresponding to the asynchronous function block instance when the function block instance is marked as an asynchronous function block instance for asynchronous execution, the source code including asynchronous execution parameters and asynchronous function block call entry points of the asynchronous function block instance; The parameter adding module 81 is specifically used to add the asynchronous execution parameters of the asynchronous function block instance by compiling the source code of the asynchronous function block; The calling entry setting module 82 is specifically used to set the calling entry of the asynchronous function block instance as the asynchronous function block calling entry by compiling the source code of the asynchronous function block; The memory layout creation module 83 is specifically configured to create a memory layout for the asynchronous function block instance according to the memory layout defined in the function block corresponding to the asynchronous function block instance by compiling the source code of the asynchronous function block.

[0089] Furthermore, the asynchronous function block call entry includes: for determining whether to start executing a program statement of the asynchronous function block instance based on a current parameter value of the asynchronous execution parameter; A program statement for calling a runtime asynchronous function block service, wherein the runtime asynchronous function block service is used to asynchronously execute the asynchronous function block instance.

[0090] Furthermore, the parameters of the runtime asynchronous function block service include: a memory address allocated to the asynchronous function block instance, and a function block call entry of the function block corresponding to the asynchronous function block instance; The runtime asynchronous function block service is used to execute the asynchronous function block instance through an asynchronous service thread.

[0091] Based on the same inventive concept, according to the PLC program execution method provided in the above embodiment of the present application, another embodiment of the present application also provides a PLC program execution device, whose structural diagram is shown in FIG. Figure 9 As shown, specifically including: an asynchronous execution module 91 for asynchronously executing an asynchronous function block instance to be executed in a PLC program by calling an asynchronous function block call entry of the asynchronous function block instance based on a current parameter value of an asynchronous execution parameter of the asynchronous function block instance and a memory layout, wherein the parameter of the asynchronous function block call entry is a memory address allocated for the asynchronous function block instance; The statement execution module 92 is used to execute the statements following the asynchronous function block instance in the PLC program while asynchronously executing the asynchronous function block instance.

[0092] Furthermore, the asynchronous execution module 91 is specifically configured to call a runtime asynchronous function block service when the current parameter value of the asynchronous execution parameter of the asynchronous function block instance indicates starting execution, wherein the parameters of the runtime asynchronous function block service include: a memory address allocated to the asynchronous function block instance, and a function block call entry of the function block corresponding to the asynchronous function block instance; The runtime asynchronous function block service is used to execute the asynchronous function block instance through an asynchronous service thread.

[0093] Furthermore, the runtime asynchronous function block service is used to execute the asynchronous function block instance through the asynchronous service thread by adopting the following steps: Creating an asynchronous task, wherein the asynchronous task includes a memory address allocated to the asynchronous function block instance according to the memory layout of the asynchronous function block instance, and a function block call entry of a function block corresponding to the asynchronous function block instance; Calling the function block call entry by using the memory address as a parameter through an asynchronous service thread to execute the function block; Updating the current parameter value of the asynchronous execution parameter; Releases the memory allocated for executing the asynchronous task.

[0094] Furthermore, the asynchronous execution parameters include: Input parameters used to trigger asynchronous execution of function block instances as start execution parameters; Output parameter used to indicate that the function block instance is being executed, as the executing parameter; Output parameter used to indicate that the function block instance has completed execution, as the execution completion parameter.

[0095] The functions of the above modules can correspond to Figures 1-6 The corresponding processing steps in the shown process will not be repeated here.

[0096] The PLC program editing device, PLC program compiling device, and PLC program executing device provided in the embodiments of the present application can be implemented via computer programs. Those skilled in the art should understand that the aforementioned module division method is only one of many module division methods, and that if the PLC program editing device, PLC program compiling device, and PLC program executing device are divided into other modules or not divided into modules, as long as they have the aforementioned functions, they should be within the scope of protection of the present application.

[0097] The present application also provides an electronic device, such as Figure 10 As shown, it includes a processor 101 and a machine-readable storage medium 102, and the machine-readable storage medium 102 stores machine-executable instructions that can be executed by the processor 101. The processor 101 is prompted by the machine-executable instructions to: implement any of the above-mentioned PLC program editing methods, or implement any of the above-mentioned PLC program compiling methods, or implement any of the above-mentioned PLC program execution methods.

[0098] An embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, it implements any of the above-mentioned PLC program editing methods, or implements any of the above-mentioned PLC program compiling methods, or implements any of the above-mentioned PLC program execution methods.

[0099] An embodiment of the present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the above-described PLC program editing methods, or any of the above-described PLC program compiling methods, or any of the above-described PLC program execution methods.

[0100] The machine-readable storage medium in the electronic device may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Alternatively, the memory may be at least one storage device located remotely from the processor.

[0101] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0102] Each embodiment in this specification is described in a related manner. Similar portions between the various embodiments can be referenced to each other. Each embodiment focuses on the differences between the other embodiments. In particular, the device, electronic device, computer-readable storage medium, and computer program product embodiments are generally similar to the method embodiments, so their descriptions are relatively simple. For related portions, reference can be made to the descriptions of the method embodiments.

[0103] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0104] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0105] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0106] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.

[0107] Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.

Claims

1. A PLC program editing method, characterized in that: include: Displaying an editing interface, wherein the editing interface includes a function block instance to be edited and a function block instance editing item of the function block instance; When the editing operation executed on the function block instance editing item indicates that the function block instance is set to be executed asynchronously, the function block instance in the currently edited PLC program is marked as being executed asynchronously, and the function block instance marked as being executed asynchronously is used as an asynchronous function block instance; In the editing interface, for the asynchronous function block instance, a parameter editing item of the asynchronous function block instance is displayed, wherein the parameter editing item is used to edit the asynchronous execution parameters of the asynchronous function block instance, and the asynchronous execution parameters are used to asynchronously execute the asynchronous function block instance; The actual parameters of the asynchronous execution parameters set based on the parameter editing items are acquired to obtain the defined asynchronous function block instance.

2. The method according to claim 1, wherein The display editing interface includes: Displaying a text editing interface, wherein the function block instance editing item is used to perform an editing operation by adding a preset grammatical markup, indicating that the function block instance is set to be executed asynchronously; or A graphical editing interface is displayed, wherein the function block instance editing item includes a preset editing option. When the preset editing option is selected, it indicates that the function block instance is set to be executed asynchronously.

3. The method according to claim 1, wherein The function block editing items are check boxes corresponding to all function block instances to be edited. Checking the check boxes indicates that the corresponding function block instances are set to be executed asynchronously.

4. The method according to claim 1, wherein The asynchronous execution parameters include: Input parameters used to trigger asynchronous execution of function block instances as start execution parameters; Output parameter used to indicate that the function block instance is being executed, as the executing parameter; Output parameter used to indicate that the function block instance has completed execution, as the execution completion parameter.

5. A PLC program compiling method, characterized in that: include: For a function block instance defined in a PLC program to be compiled, when the function block instance is marked as an asynchronous function block instance for asynchronous execution, adding an asynchronous execution parameter of the asynchronous function block instance, wherein the asynchronous execution parameter is used to asynchronously execute the asynchronous function block instance; Setting the calling entry of the asynchronous function block instance as the asynchronous function block calling entry, wherein the parameter of the asynchronous function block calling entry is the memory address allocated for the asynchronous function block instance; A memory layout is created for the asynchronous function block instance according to the memory layout defined in the function block corresponding to the asynchronous function block instance, and compiled code for asynchronously executing the asynchronous function block instance is obtained.

6. The method according to claim 5, wherein The asynchronous execution parameters include: Input parameters used to trigger asynchronous execution of function block instances as start execution parameters; Output parameter used to indicate that the function block instance is being executed, as the executing parameter; Output parameter used to indicate that the function block instance has completed execution, as the execution completion parameter.

7. The method according to claim 5, wherein For the function block instance defined in the PLC program to be compiled, when the function block instance is marked as an asynchronous function block instance for asynchronous execution, before adding the asynchronous execution parameter of the asynchronous function block instance, the method further includes: For a function block instance defined in a PLC program to be compiled, when the function block instance is marked as an asynchronous function block instance for asynchronous execution, generating source code of an asynchronous function block having the same function as the function block corresponding to the asynchronous function block instance, wherein the source code includes asynchronous execution parameters and an asynchronous function block call entry of the asynchronous function block instance; The adding of the asynchronous execution parameters of the asynchronous function block instance includes: Adding asynchronous execution parameters of the asynchronous function block instance by compiling the source code of the asynchronous function block; The step of setting the calling entry of the asynchronous function block instance as the asynchronous function block calling entry includes: By compiling the source code of the asynchronous function block, setting the calling entry of the asynchronous function block instance as the asynchronous function block calling entry; The creating a memory layout for the asynchronous function block instance according to the memory layout defined in the function block corresponding to the asynchronous function block instance includes: By compiling the source code of the asynchronous function block, a memory layout is created for the asynchronous function block instance according to the memory layout defined in the function block corresponding to the asynchronous function block instance.

8. The method according to claim 5, wherein The asynchronous function block call entry includes: for determining whether to start executing a program statement of the asynchronous function block instance based on a current parameter value of the asynchronous execution parameter; A program statement for calling a runtime asynchronous function block service, wherein the runtime asynchronous function block service is used to asynchronously execute the asynchronous function block instance.

9. The method according to claim 8, wherein The parameters of the runtime asynchronous function block service include: a memory address allocated to the asynchronous function block instance, and a function block call entry of the function block corresponding to the asynchronous function block instance; The runtime asynchronous function block service is used to execute the asynchronous function block instance through an asynchronous service thread.

10. A PLC program execution method, characterized in that: include: For an asynchronous function block instance to be executed in a PLC program, asynchronously executing the asynchronous function block instance by calling an asynchronous function block call entry of the asynchronous function block instance based on a current parameter value of an asynchronous execution parameter of the asynchronous function block instance and a memory layout, wherein the parameter of the asynchronous function block call entry is a memory address allocated for the asynchronous function block instance; While the asynchronous function block instance is being asynchronously executed, statements following the asynchronous function block instance in the PLC program are executed.

Citation Information

Patent Citations

  • Information processing device, information processing method, and computer readable recording medium

    CN109388096A

  • Method and device for compiling PLC (Programmable Logic Controller) program code into WebAssembly code

    CN114661300A

  • Logic function customization method and device and computer readable storage medium

    CN115047829A

  • Adaptive detection method and device of controller

    CN118963316A

  • Method for carrying out the computer-assisted programming of a programmable logic controller

    EP3451089A1