Multi-task operation method and device, storage medium and computer program product

By creating shared memory between PLCs and configuring timers, the complexity and delay problems of PLC multi-tasking collaboration scheme in the prior art are solved, the execution efficiency and real-timeness of industrial control tasks are improved, and the high real-time requirements are met.

CN119310921APending Publication Date: 2025-01-14CHINA MOBILE COMM LTD RES INST +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411312491.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2025-01-14

Smart Images

  • Figure CN119310921A_ABST
    Figure CN119310921A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a multi-task operation method and device, a storage medium and a computer program product. The method comprises the steps that a shared memory between different virtual programmable logic controllers (PLC) is created; accessing the shared memory according to an industrial control task execution sequence by utilizing PLC programs of different virtual PLCs, and executing data reading operation and / or data writing operation on the shared memory; wherein the PLC programs of different virtual PLCs are used for executing different industrial control tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of electronic communication technology, and in particular, to a multi-tasking operation method, device, storage medium and computer program product. Background Art

[0002] Industrial control tasks are the core of industrial production. With the cross-integration of control science with computing, information, communications and other disciplines, control theory has evolved from classical feedback control and modern control to data-driven intelligent control, and control systems have evolved from single-point control and networked control to distributed cloud control.

[0003] At present, there are mainly two distributed multi-task collaborative processing technology solutions for industrial control tasks: multi-task collaboration of distributed physical nodes, see Figure 1 During the task execution, each programmable logic controller (PLC) executes specific control logic and actions, such as equipment start and stop, speed regulation, etc. PLCs exchange equipment status and production data in real time through industrial Ethernet or dedicated communication protocols to achieve functions such as status update and task data synchronization. PLCs can be deployed on general hardware devices in a virtualized manner, not limited to the deployment of hard PLC or soft PLC; multi-task collaboration of distributed virtual nodes, see Figure 2 In the same physical node, virtual PLCs are created through containers or virtual machine technology. Each virtual PLC runs on a shared hardware platform and communicates and collaborates with other services through a virtual network isolated by the container internal network or a virtual local area network (VLAN). The overall service results are mapped to the physical network port through the address, and are further transmitted to the next processing node through the switch based on communication protocols such as industrial bus and Ethernet.

[0004] For multi-task coordination solutions of distributed physical nodes, the complexity of managing and maintaining multiple distributed PLC nodes and their communication networks increases, requiring professional skills and additional resource investment. Although industrial Ethernet or dedicated communication protocols are used, network communication delays may affect control tasks with high real-time requirements. For multi-task system solutions of distributed virtual nodes, communication management and network isolation management between multiple containers or virtual machines are complex, requiring specialized tools and technologies to ensure the normal operation of communication, and network communication in a virtualized environment may introduce certain delays, especially when frequent communication or large amounts of data transmission are required between containers or virtual machines, which will affect applications with high real-time requirements.

[0005] Based on the above reasons, the existing PLC multi-task collaboration solution has a certain delay, which makes it difficult to meet the needs of industrial control with high real-time requirements, and the work efficiency of multi-task collaboration is low. Summary of the invention

[0006] The embodiments of the present application provide a multi-tasking operation method, device, storage medium and computer program product, which improve the overall efficiency of the collaborative execution of industrial control tasks and can meet the needs of industrial control business scenarios with relatively high real-time requirements.

[0007] The technical solution of the embodiment of the present application is implemented as follows:

[0008] The present application provides a multi-task operation method, including:

[0009] Create shared memory between different virtual programmable logic controllers PLC;

[0010] Using PLC programs of different virtual PLCs, accessing the shared memory in the order of industrial control task execution, and performing data reading operations and / or data writing operations on the shared memory;

[0011] Among them, the PLC programs of different virtual PLCs are used to execute different industrial control tasks.

[0012] In the above method, the step of creating a shared memory between different virtual programmable logic controllers (PLCs) includes:

[0013] Calling a system interface to create the shared memory;

[0014] Set a name, access rights, and memory size for the shared memory.

[0015] In the above method, it also includes:

[0016] In a PLC programming environment, an external function interface is defined; the external function interface is used for being called by PLC programs of different virtual PLCs to access the shared memory.

[0017] In the above method, it also includes:

[0018] Writing a dynamic link library, wherein the dynamic link library is used to provide a function for accessing the shared memory;

[0019] Wherein, the PLC programs of different virtual PLCs perform data reading operations and / or data writing operations on the shared memory by calling functions in the dynamic link library.

[0020] In the above method, before the PLC programs using different virtual PLCs access the shared memory in the order of industrial control task execution, the method further includes:

[0021] Configure timers separately in the PLC programs of different virtual PLCs;

[0022] Wherein, each timer is used to enable the corresponding PLC program to access the shared memory regularly according to the execution order of the industrial control task to be implemented.

[0023] In the above method, the first virtual PLC and the second virtual PLC share the shared memory; wherein,

[0024] The first PLC program of the first virtual PLC is configured with a first timer, and the second PLC program of the second virtual PLC is configured with a second timer;

[0025] The first PLC program is used to execute a first industrial control task, the second PLC program is used to execute a second industrial control task, and the first industrial control task and the second industrial control task are executed sequentially;

[0026] The time of the first timer is the task cycle of the first industrial control task;

[0027] The time of the second timer is greater than or equal to the total time of executing the first industrial control task and writing the generated task data into the shared memory.

[0028] In the above method, the PLC programs using different virtual PLCs access the shared memory according to the execution order of the industrial control tasks, and perform data reading operations and / or data writing operations on the shared memory, including:

[0029] Run the first PLC program on the first virtual PLC, execute the first industrial control task and start the first timer;

[0030] When the first timer times out, using the first PLC program to perform a data write operation on the shared memory, and writing the task data generated by executing the first industrial control task into the shared memory;

[0031] Run the second PLC program on the second virtual PLC to start the second timer;

[0032] When the second timer times out, the second PLC program is used to perform a data read operation on the shared memory, the task data is read from the shared memory, and the second industrial control task is executed based on the task data.

[0033] The embodiment of the present application provides a multi-task operation device, including:

[0034] Create a module for creating shared memory between different virtual programmable logic controllers PLC;

[0035] An operation module, used to access the shared memory by using PLC programs of different virtual PLCs according to the execution order of industrial control tasks, and to perform a data reading operation and / or a data writing operation on the shared memory;

[0036] Among them, the PLC programs of different virtual PLCs are used to execute different industrial control tasks.

[0037] The embodiment of the present application provides a multi-task operation device, including: a processor, a memory and a communication bus;

[0038] The communication bus is used to realize the communication connection between the processor and the memory;

[0039] The processor is used to execute one or more computer programs stored in the memory to implement the above multi-tasking operation method.

[0040] An embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the multi-tasking operation method described above is implemented.

[0041] An embodiment of the present application provides a computer program product, including a computer program, which implements the above-mentioned multi-tasking operation method when executed.

[0042] The embodiment of the present application provides a multi-tasking operation method, device, storage medium and computer program product, the method comprising: creating a shared memory between different virtual programmable logic controllers PLC; using the PLC programs of different virtual PLCs to access the shared memory in the order of industrial control task execution, and performing data reading operations and / or data writing operations on the shared memory; wherein the PLC programs of different virtual PLCs are used to execute different industrial control tasks. The technical solution provided by the embodiment of the present application improves the overall efficiency of the collaborative execution of industrial control tasks by introducing a PLC sequential access mechanism of shared memory, and can meet the needs of industrial control business scenarios with relatively high real-time requirements. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 A schematic diagram of a framework for multi-task collaboration of distributed physical nodes in the prior art;

[0044] Figure 2 A schematic diagram of a framework for multi-task collaboration of distributed virtual nodes in the prior art;

[0045] Figure 3 A flowchart of a multi-task operation method provided in an embodiment of the present application;

[0046] Figure 4 An exemplary multi-task interaction diagram provided in an embodiment of the present application;

[0047] Figure 5 A schematic diagram of an exemplary multi-task collaboration framework provided in an embodiment of the present application;

[0048] Figure 6 An exemplary interactive diagram of data reading and writing provided in an embodiment of the present application;

[0049] Figure 7 A schematic diagram of a multi-task operation device provided in an embodiment of the present application Figure 1 ;

[0050] Figure 8 A schematic diagram of a multi-task operation device provided in an embodiment of the present application Figure 2 . DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0052] The following will specifically describe the technical solution of the present application and how the technical solution of the present application solves the above technical problems through embodiments and in conjunction with the accompanying drawings. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

[0053] In addition, the technical solutions described in the embodiments of the present application can be combined arbitrarily without conflict.

[0054] The embodiment of the present application provides a multi-tasking operation method, which is implemented by a multi-tasking operation device. The specific type of the device is not limited in the embodiment of the present application, and it can be any electronic device.

[0055] Figure 3 A flowchart of a multi-task operation method provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, in the embodiment of the present application, the multi-task operation method mainly includes the following steps:

[0056] S101. Create shared memory between different virtual programmable logic controllers (PLCs).

[0057] In an embodiment of the present application, the multi-task operation device can create a shared memory between different virtual PLCs.

[0058] It should be noted that in the embodiments of the present application, the multi-tasking operation device can create a publicly available memory, i.e., a shared memory, for multiple virtual PLCs. The specific number of virtual PLCs involved can be set according to the actual configuration and application scenario, and the embodiments of the present application are not limited thereto.

[0059] In an embodiment of the present application, the multi-task operation device creates shared memory between different virtual PLCs, including: calling a system interface to create the shared memory; setting a name, access rights, and memory size for the shared memory.

[0060] It should be noted that in the embodiments of the present application, Linux-RT can be used as the underlying real-time operating system, and the container can be used as the supporting base of the virtual PLC.

[0061] Exemplarily, in an embodiment of the present application, the system interface may be a portable operating system interface (POSIX), and the creation of shared memory may be completed using a POSIX shared memory interface, specifically, the following contents are involved:

[0062] 1. Create shared memory: Create a shared memory by calling the system interface and specify the name and access rights of the shared memory. In Linux-RT, you can use the shm_open() function to create a shared memory area and use the mmap() function to map the shared memory area;

[0063] 2. Set the memory size of the shared memory: Adjust the memory size of the shared memory to meet the needs of the application. You can use the ftruncate() function to set the memory size of the shared memory.

[0064] S102. Using PLC programs of different virtual PLCs, access the shared memory in the order of industrial control task execution, and perform data reading and / or data writing operations on the shared memory; wherein the PLC programs of different virtual PLCs are used to execute different industrial control tasks.

[0065] In an embodiment of the present application, when creating a shared memory, the multi-task operation device can use PLC programs of different virtual PLCs to access the shared memory in the order of industrial control task execution and perform data reading and / or data writing operations on the shared memory.

[0066] It should be noted that in the embodiments of the present application, the PLC program needs to call the corresponding interface to access the shared memory. Based on this, the multi-tasking operation device can also perform the following steps: in the PLC programming environment, define an external function interface; the external function interface is used for PLC programs of different virtual PLCs to call to access the shared memory.

[0067] It should be noted that, in an embodiment of the present application, the PLC program needs to call corresponding functions to perform data reading operations and / or data writing operations on the shared memory. Based on this, the multi-tasking operation device can also perform the following steps: write a dynamic link library, which is used to provide functions for accessing the shared memory; wherein, the PLC programs of different virtual PLCs perform data reading operations and / or data writing operations on the shared memory by calling the functions in the dynamic link library.

[0068] It can be understood that in the embodiments of the present application, the PLC programs of different virtual PLCs are used to execute different industrial control tasks. Industrial control tasks are usually executed periodically and in a certain order. For example, for industrial control tasks in a certain order, the execution of the latter industrial control task usually requires the use of the task data generated by the previous industrial control task. In this case, the task data generated by the previous industrial control task can be written into the shared memory and read and used by the latter industrial control task. Based on this, the PLC programs of different virtual PLCs can access the shared memory in the order of execution of the industrial control tasks, thereby performing corresponding data reading operations and / or data writing operations, thereby meeting the actual task execution requirements.

[0069] Figure 4 An exemplary multi-task interaction diagram provided in the embodiment of the present application is as follows: Figure 4 , details the relevant implementation process of deploying PLC programs on PLC for PLC programs of different virtual PLCs, accessing shared memory according to the execution order of industrial control tasks, and performing data reading operations and / or data writing operations on the shared memory.

[0070] In an embodiment of the present application, a PLC program can be developed by developing an application platform. Based on this, the multi-task operation device can perform the following steps before using the PLC programs of different virtual PLCs to access the shared memory in the execution order of the industrial control tasks: timers are configured in the PLC programs of different virtual PLCs respectively; wherein each timer is used to enable the corresponding PLC program to access the shared memory in a regular manner in the execution order of the industrial control tasks implemented.

[0071] It should be noted that in an embodiment of the present application, in a PLC program, timed access to a shared memory can be achieved by configuring a timer, that is, the time for the PLC program to access the shared memory is constrained by configuring the timer, wherein the time setting of the timer can be determined based on the execution order of the industrial control tasks, so that the PLC program can access the shared memory in sequence and at a regular intervals.

[0072] It should be noted that, in the embodiments of the present application, the design of the PLC program mainly involves the following contents:

[0073] 1. Define external function interfaces and variables: In the PLC program, define a pointer to the external function and define a timer function block for timed access.

[0074] 2. Initialize the external function pointer: Initialize the external function pointer to point to the function in the dynamic link library.

[0075] 3. Implement the timer control logic: Use the timer to control the timed access to the shared memory. For example, set the timer period to 5ms-10ms, and perform data read operations and / or data write operations on the shared memory each time the timer times out. When the timer times out, call the function (e.g., read_shared_memory) to read the data from the shared memory into the buffer. Then, you can process the data in the buffer, and finally call the function (e.g., write_shared_memory) to write the processed data to the shared memory. To ensure that the timer continues to run in the next cycle, you need to first set the timer parameter to FALSE to reset the timer, and then set it to TRUE again to restart the timer.

[0076] In an embodiment of the present application, for a compiled PLC program, relevant environment deployment is required to run. Exemplarily, the PLC program can be downloaded to the host machine and deployed to the container, and the shared memory can be mounted into the container. When the container is started, the shared memory area of ​​the host machine needs to be mounted (e.g., mount) to the file system of the container. The PLC program running in the container needs to access the shared memory. The shared memory object can be opened and mapped in the container through the POSIX shared memory interface, which mainly involves the following contents:

[0077] 1. Open the shared memory object: Use the shm_open system call to open the shared memory object. Open the shared memory with the same shared memory name as the host machine.

[0078] 2. Map shared memory: Map the shared memory object to the virtual address space of the process and obtain a pointer to the shared memory area.

[0079] 3. Read and write shared memory: Use pointers to read and / or write data to shared memory; the data read operation is to read the contents of the shared memory through the shared memory pointer, such as reading a string or other data; the data write operation is to write data to the shared memory through the shared memory pointer, such as updating a string or writing a new data structure.

[0080] In the embodiments of the present application, Figure 4As shown, the first virtual PLC and the second virtual PLC can read and write to the shared memory. Specifically, the first virtual PLC and the second virtual PLC read and write to the shared memory regularly. The interoperation framework is as follows Figure 5 The following takes the first virtual PLC and the second virtual PLC as examples to specifically illustrate the implementation of shared memory reading and writing.

[0081] In an embodiment of the present application, the first virtual PLC and the second virtual PLC share a shared memory; wherein,

[0082] The first PLC program of the first virtual PLC is configured with a first timer, and the second PLC program of the second virtual PLC is configured with a second timer;

[0083] The first PLC program is used to execute the first industrial control task, the second PLC program is used to execute the second industrial control task, and the first industrial control task and the second industrial control task are executed sequentially;

[0084] The time of the first timer is the task cycle of the first industrial control task;

[0085] The time of the second timer is greater than or equal to the total time of executing the first industrial control task and writing the generated task data into the shared memory.

[0086] In the embodiments of the present application, Figure 6 As shown, the multi-task operation device uses PLC programs of different virtual PLCs to access the shared memory according to the execution order of the industrial control tasks, and performs data reading operations and / or data writing operations on the shared memory, including:

[0087] Run a first PLC program on the first virtual PLC, execute a first industrial control task and start a first timer;

[0088] When the first timer times out, the first PLC program is used to perform a data write operation on the shared memory, and the task data generated by executing the first industrial control task is written into the shared memory;

[0089] Run the second PLC program on the second virtual PLC to start the second timer;

[0090] When the second timer times out, the second PLC program is used to perform a data read operation on the shared memory, the task data is read from the shared memory, and the second industrial control task is executed based on the task data.

[0091] It should be noted that in the embodiments of the present application, see Figure 6 ,Since industrial control tasks are usually periodic, such as the first industrial control task and the second control task are periodic, the timer can be reset accordingly to perform a cyclic operation.

[0092] In an embodiment of the present application, the multi-tasking operation device can also close and unmap the shared memory. For example, when the industrial control task no longer needs the shared memory, it should be unmapped through the munmap() function and the reference to the shared memory should be closed through the shm_unlink() function.

[0093] The technical solution provided in the embodiment of the present application allows each industrial control task to directly access a shared data structure through shared memory, and based on the periodicity of industrial control tasks, there is no need for a locking mechanism to ensure the mutual exclusivity of operations when accessing shared memory, thereby achieving high certainty and high real-time guarantees for the collaboration of industrial control tasks.

[0094] The technical solution provided in the embodiment of the present application has the following advantages compared with physical distributed collaboration and virtualized distributed collaboration:

[0095] 1. Improve task execution efficiency: Designed based on the periodic execution characteristics of industrial control tasks, it does not require a lock mechanism to ensure data consistency in shared memory, thereby reducing performance loss and complexity caused by lock competition and reducing development and maintenance costs.

[0096] 2. Improve the real-time performance of task processing: Allow each industrial control task to directly access the shared data structure without going through complex network protocols and communication processes, thus avoiding the delay caused by network communication, making communication and data exchange between tasks more direct and efficient. And because industrial control tasks read and write memory regularly, the time for data reading and writing is more predictable and stable, which can provide high certainty and high real-time system guarantees for real-time control systems.

[0097] An embodiment of the present application provides a multi-tasking operation device. Figure 7 A schematic diagram of a multi-task operation device provided in an embodiment of the present application Figure 1 .like Figure 7 As shown, in an embodiment of the present application, the multi-task operation device includes:

[0098] A creation module 201 is used to create a shared memory between different virtual programmable logic controllers PLC;

[0099] An operation module 202 is used to access the shared memory by using PLC programs of different virtual PLCs according to the execution order of industrial control tasks, and to perform a data read operation and / or a data write operation on the shared memory;

[0100] Among them, the PLC programs of different virtual PLCs are used to execute different industrial control tasks.

[0101] In one embodiment of the present application, the creation module 201 is used to call the system interface to create the shared memory; and set a name, access rights, and memory size for the shared memory.

[0102] In one embodiment of the present application, the creation module 201 is also used to define an external function interface in a PLC programming environment; the external function interface is used for PLC programs of different virtual PLCs to call to access the shared memory.

[0103] In one embodiment of the present application, the creation module 201 is also used to write a dynamic link library, which is used to provide functions for accessing the shared memory; wherein, the PLC programs of different virtual PLCs perform data reading operations and / or data writing operations on the shared memory by calling the functions in the dynamic link library.

[0104] In one embodiment of the present application, the creation module 201 is also used to configure timers in the PLC programs of different virtual PLCs respectively; wherein each timer is used to enable the corresponding PLC program to access the shared memory in a regular manner according to the execution order of the industrial control tasks implemented.

[0105] In one embodiment of the present application, the first virtual PLC and the second virtual PLC share the shared memory; wherein,

[0106] The first PLC program of the first virtual PLC is configured with a first timer, and the second PLC program of the second virtual PLC is configured with a second timer;

[0107] The first PLC program is used to execute a first industrial control task, the second PLC program is used to execute a second industrial control task, and the first industrial control task and the second industrial control task are executed sequentially;

[0108] The time of the first timer is the task cycle of the first industrial control task;

[0109] The time of the second timer is greater than or equal to the total time of executing the first industrial control task and writing the generated task data into the shared memory.

[0110] In one embodiment of the present application, the operation module 202 is used to run the first PLC program on the first virtual PLC, execute the first industrial control task and start the first timer; when the first timer times out, use the first PLC program to perform a data write operation on the shared memory, and write the task data generated by executing the first industrial control task into the shared memory; run the second PLC program on the second virtual PLC to start the second timer; when the second timer times out, use the second PLC program to perform a data read operation on the shared memory, read the task data from the shared memory, and execute the second industrial control task based on the task data.

[0111] Figure 8 A schematic diagram of a multi-task operation device provided in an embodiment of the present application Figure 2 .like Figure 8 As shown, in the embodiment of the present application, the multi-task operation device includes: a processor 301, a memory 302 and a communication bus 303;

[0112] The communication bus 303 is used to realize the communication connection between the processor 301 and the memory 302;

[0113] The processor 301 is used to execute one or more computer programs stored in the memory 302 to implement the above multi-tasking operation method.

[0114] An embodiment of the present application provides a computer program product, including a computer program, which implements the above-mentioned multi-tasking operation method when executed.

[0115] The embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and the computer program implements the above-mentioned multi-task operation method when executed by a processor. The computer-readable storage medium can be a volatile memory (volatile memory), such as a random access memory (Random-Access Memory, RAM); or a non-volatile memory (non-volatile memory), such as a read-only memory (Read-Only Memory, ROM), a flash memory (flash memory), a hard disk (Hard Disk Drive, HDD) or a solid-state drive (Solid-State Drive, SSD); or it can be a respective device including one or any combination of the above memories, such as a mobile phone, a computer, a tablet device, a personal digital assistant, etc.

[0116] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of hardware embodiments, software embodiments, or embodiments in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.

[0117] The present application is described with reference to implementation 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 box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes 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 generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process in the flowchart. 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.

[0118] 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 operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which is implemented in the implementation flow diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

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

[0120] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by any technician familiar with the technical field within the technical scope disclosed in the utility application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A multi-tasking operation method, characterized in that: include: Create shared memory between different virtual programmable logic controllers PLC; Using PLC programs of different virtual PLCs, accessing the shared memory in the order of industrial control task execution, and performing data reading operations and / or data writing operations on the shared memory; Among them, the PLC programs of different virtual PLCs are used to execute different industrial control tasks.

2. The method according to claim 1, characterized in that The step of creating a shared memory between different virtual programmable logic controllers (PLCs) includes: Calling a system interface to create the shared memory; Set a name, access rights, and memory size for the shared memory.

3. The method according to claim 1, characterized in that The method further comprises: In a PLC programming environment, an external function interface is defined; the external function interface is used for being called by PLC programs of different virtual PLCs to access the shared memory.

4. The method according to claim 1, characterized in that: The method further comprises: Writing a dynamic link library, wherein the dynamic link library is used to provide a function for accessing the shared memory; Wherein, the PLC programs of different virtual PLCs perform data reading operations and / or data writing operations on the shared memory by calling functions in the dynamic link library.

5. The method according to claim 1, characterized in that Before the PLC programs using different virtual PLCs access the shared memory in the order of industrial control task execution, the method further comprises: Configure timers separately in the PLC programs of different virtual PLCs; Wherein, each timer is used to enable the corresponding PLC program to access the shared memory regularly according to the execution order of the industrial control task to be implemented.

6. The method according to claim 5, characterized in that The first virtual PLC and the second virtual PLC share the shared memory; wherein, The first PLC program of the first virtual PLC is configured with a first timer, and the second PLC program of the second virtual PLC is configured with a second timer; The first PLC program is used to execute a first industrial control task, the second PLC program is used to execute a second industrial control task, and the first industrial control task and the second industrial control task are executed sequentially; The time of the first timer is the task cycle of the first industrial control task; The time of the second timer is greater than or equal to the total time of executing the first industrial control task and writing the generated task data into the shared memory.

7. The method according to claim 6, characterized in that The PLC programs using different virtual PLCs access the shared memory according to the execution order of the industrial control tasks, and perform data reading operations and / or data writing operations on the shared memory, including: Run the first PLC program on the first virtual PLC, execute the first industrial control task and start the first timer; When the first timer times out, using the first PLC program to perform a data write operation on the shared memory, and writing the task data generated by executing the first industrial control task into the shared memory; Run the second PLC program on the second virtual PLC to start the second timer; When the second timer times out, the second PLC program is used to perform a data read operation on the shared memory, the task data is read from the shared memory, and the second industrial control task is executed based on the task data.

8. A multi-tasking operation device, characterized in that: include: Create a module for creating shared memory between different virtual programmable logic controllers PLC; An operation module, used to access the shared memory by using PLC programs of different virtual PLCs according to the execution order of industrial control tasks, and to perform a data reading operation and / or a data writing operation on the shared memory; Among them, the PLC programs of different virtual PLCs are used to execute different industrial control tasks.

9. A multi-tasking operation device, characterized in that: include: processor, memory, and communications bus; The communication bus is used to realize the communication connection between the processor and the memory; The processor is used to execute one or more computer programs stored in the memory to implement the multi-tasking operation method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the multi-tasking operation method according to any one of claims 1 to 7 is implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed, the multi-tasking operation method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Method for cross-referencing deterministic data through multiple tasks of PLC

    CN120256131A

  • Multi-task operation method and apparatus, storage medium and computer program product

    WO2026061298A1