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

By creating shared memory between virtual PLCs and accessing it in the order of tasks, and configuring timers, the problem of delay in multi-task collaboration of PLCs in the existing technology is solved, and efficient and real-time collaborative execution of industrial control tasks is realized.

WO2026061298A1PCT designated stage Publication Date: 2026-03-26CHINA MOBILE COMM LTD RES INST +1
View PDF 6 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-09-10
Publication Date
2026-03-26

AI Technical Summary

Technical Problem

Existing PLC multi-task collaboration solutions suffer from latency, making it difficult to meet the real-time requirements of industrial control, and increasing the complexity of management and maintenance.

Method used

By creating shared memory between virtual PLCs and using PLC programs to perform data reading and writing operations according to the execution order of industrial control tasks, and configuring timers to ensure timed access to tasks, locking mechanisms are avoided and task collaboration efficiency is improved.

Benefits of technology

It enables collaborative execution of industrial control tasks with high determinism and high real-time performance, reduces performance loss caused by network communication latency and lock contention, and improves task execution efficiency and real-time performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025120360_26032026_PF_FP_ABST
    Figure CN2025120360_26032026_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the present application are a multi-task operation method and apparatus, a storage medium and a computer program product. The method comprises: creating a shared memory between different virtual programmable logic controllers (PLCs); and using PLC programs of the different virtual PLCs to access the shared memory according to an industrial control task execution order, and executing a data read operation and / or a data write operation on the shared memory, wherein the PLC programs of the different virtual PLCs are used for executing different industrial control tasks.
Need to check novelty before this filing date? Find Prior Art

Description

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

[0001] Cross-reference to related applications

[0002] The present application is based on the Chinese patent application No. 202411312491.3, filed on September 19, 2024, entitled "Multi-task operation method and device, storage medium and computer program product", and claims priority to the Chinese patent application No. 202411312491.3, the entire contents of which are hereby incorporated by reference in its entirety. TECHNICAL FIELD

[0003] The present application relates to the field of electronic communication, and in particular to a multi-task operation method and device, storage medium and computer program product. BACKGROUND

[0004] Industrial control task is the core link of industrial production. With the cross and integration of control science and computing, information, communication and other disciplines, control theory develops from classic feedback control, modern control to data-driven intelligent control, and control system evolves from single-point control, networked control to cloud control based on distribution.

[0005] Currently, there are mainly two kinds of distributed multi-task cooperative processing technical solutions for industrial control tasks: multi-task cooperation of distributed physical nodes, as shown in FIG. 1, in the task execution process, each programmable logic controller (PLC) executes specific control logic and action, such as device start-stop, speed regulation, etc., and the PLCs exchange device status and production data in real time through industrial Ethernet or special communication protocol, to realize functions such as state updating and task data synchronization. The PLC can be deployed on a general hardware device in a virtualized manner, and is not limited to the deployment mode of hard PLC or soft PLC; multi-task cooperation of distributed virtual nodes, as shown in FIG. 2, in the same physical node, the PLC is virtualized through container or virtual machine technology, each virtual PLC runs on a shared hardware platform, and communicates and cooperates through a virtual network isolated by container internal network or virtual local area network (VLAN). The overall business result is mapped to the physical network port through address, and further transmitted to the next processing node through switches based on communication protocols such as industrial bus and Ethernet.

[0006] For the multi-task cooperation scheme 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 can affect control tasks with high real-time requirements. For the multi-task system scheme 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 normal operation of communication, and network communication in a virtualized environment can introduce a certain delay, which can affect applications with high real-time requirements, especially when frequent communication or large data transmission is required between containers or virtual machines.

[0007] For the above reasons, the existing PLC multi-task cooperation scheme has a certain delay and is difficult to meet the industrial control requirements with relatively high real-time requirements, and the work efficiency of multi-task cooperation is low. SUMMARY

[0008] The application provides a multi-task operation method, device, storage medium and computer program product, which improves the overall efficiency of industrial control task cooperation execution and can meet the requirements of industrial control business scenarios with relatively high real-time requirements.

[0009] The technical scheme of the application is implemented as follows:

[0010] The application provides a multi-task operation method, comprising:

[0011] creating a shared memory between different virtual programmable logic controllers (PLCs);

[0012] accessing the shared memory according to an industrial control task execution sequence using PLC programs of different virtual PLCs, and performing data reading and / or data writing operations on the shared memory;

[0013] wherein the PLC programs of different virtual PLCs are used to execute different industrial control tasks.

[0014] In the above method, the shared memory between different virtual programmable logic controllers (PLCs) is created, comprising:

[0015] calling a system interface to create the shared memory;

[0016] setting a name, access rights, and memory size for the shared memory.

[0017] In the above method, further comprising:

[0018] defining an external function interface in a PLC programming environment; the external function interface is used to call the PLC programs of different virtual PLCs to access the shared memory.

[0019] In the above method, further comprising:

[0020] A dynamic link library is written, which is used to provide a function for accessing the shared memory;

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

[0022] In the above method, before the PLC programs of different virtual PLCs access the shared memory according to the execution sequence of industrial control tasks, the method further comprises:

[0023] A timer is configured in each PLC program of different virtual PLCs respectively;

[0024] Wherein, each timer is used to make the PLC program to which it belongs to access the shared memory according to the execution sequence of the industrial control task it implements.

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

[0026] 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;

[0027] The first PLC program is used to execute a first industrial control task, and 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 in sequence;

[0028] The time of the first timer is the task period of the first industrial control task;

[0029] 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 task data generated by the first industrial control task into the shared memory.

[0030] In the above method, the PLC programs of different virtual PLCs access the shared memory according to the execution sequence of industrial control tasks, and perform data reading operation and / or data writing operation on the shared memory, comprising:

[0031] Running the first PLC program on the first virtual PLC, executing the first industrial control task and starting the first timer;

[0032] In the case that the first timer expires, the first PLC program is used to perform data writing operation on the shared memory, and the task data generated by executing the first industrial control task is written into the shared memory.

[0033] running the second PLC program on the second virtual PLC to start the second timer;

[0034] in a case where the second timer is timed out, performing a data reading operation on the shared memory by using the second PLC program, reading the task data from the shared memory, and executing the second industrial control task based on the task data.

[0035] The application provides a multi-task operation device, comprising:

[0036] a creating module configured to create a shared memory between different virtual programmable logic controllers (PLCs);

[0037] an operating module configured to access the shared memory according to an industrial control task execution sequence by using PLC programs of different virtual PLCs, and perform a data reading operation and / or a data writing operation on the shared memory;

[0038] wherein the PLC programs of different virtual PLCs are used to execute different industrial control tasks.

[0039] The application provides a multi-task operation device, comprising a processor, a memory and a communication bus;

[0040] the communication bus is configured to realize a communication connection between the processor and the memory;

[0041] the processor is configured to execute one or more computer programs stored in the memory to realize the multi-task operation method.

[0042] The application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the multi-task operation method.

[0043] The application provides a computer program product, which comprises a computer program, and the computer program is executed to realize the multi-task operation method.

[0044] The application provides a multi-task operation method and device, a storage medium and a computer program product. The method comprises the following steps: creating a shared memory between different virtual programmable logic controllers (PLCs); and performing data reading and / or data writing operations on the shared memory according to an industrial control task execution sequence by using PLC programs of the different virtual PLCs, wherein the PLC programs of the different virtual PLCs are used to execute different industrial control tasks. The technical solution provided by the application introduces a PLC sequence access mechanism of the shared memory, thereby improving the overall efficiency of the cooperative execution of the industrial control tasks and meeting the requirements of an industrial control business scenario with relatively high real-time requirements. BRIEF DESCRIPTION OF DRAWINGS

[0045] Fig. 1 is a schematic diagram of a multi-task cooperation framework of a distributed physical node in the prior art;

[0046] Fig. 2 is a schematic diagram of a multi-task cooperation framework of a distributed virtual node in the prior art;

[0047] Fig. 3 is a schematic diagram of a multi-task operation method provided by an embodiment of the application;

[0048] Fig. 4 is a schematic diagram of an exemplary multi-task interoperation interaction provided by an embodiment of the application;

[0049] Fig. 5 is a schematic diagram of an exemplary multi-task cooperation framework provided by an embodiment of the application;

[0050] Fig. 6 is a schematic diagram of an exemplary data reading and writing interaction provided by an embodiment of the application;

[0051] Fig. 7 is a schematic diagram of a multi-task operation device provided by an embodiment of the application;

[0052] Fig. 8 is a schematic diagram of a multi-task operation device provided by an embodiment of the application. DETAILED DESCRIPTION

[0053] In order to make the objectives, technical solutions and advantages of the application clearer, the application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the application and should not be used to limit the application.

[0054] The technical solutions of the application and how the technical solutions solve the above technical problems will be described in detail below through embodiments and in combination with the accompanying drawings. The following embodiments can be combined with each other, and the same or similar concepts or processes can not be described again in some embodiments.

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

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

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

[0058] S101, creating shared memory between different virtual programmable logic controllers (PLCs).

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

[0060] It should be noted that in the embodiment of the present application, the multi-task operation device can create a commonly used memory, that is, shared memory, for a plurality of virtual PLCs, and the number of virtual PLCs involved can be set according to actual configuration and application scenarios, which is not limited in the embodiment of the present application.

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

[0062] It should be noted that in the embodiment of the present application, Linux-RT can be used as an underlying real-time operating system, and a container can be used as a bearing base of a virtual PLC.

[0063] For example, in the embodiment of the present application, the system interface can be a portable operating system interface (POSIX), and the creation of shared memory can be completed by using a POSIX shared memory interface. Specifically, the following contents are involved:

[0064] 1. Creating shared memory: a shared memory is created by calling a system interface, and the name and access permission of the shared memory are specified. In Linux-RT, a shared memory region can be created by using a function of shm_open(), and the shared memory region is mapped by using a function of mmap();

[0065] 2. Setting the memory size of the shared memory: the memory size of the shared memory is adjusted to meet the application requirements, and a function of ftruncate() can be used to set the memory size of the shared memory.

[0066] S102, accessing the shared memory according to an industrial control task execution sequence by using the PLC programs of different virtual PLCs, and performing a data reading operation and / or a data writing operation on the shared memory; wherein the PLC programs of different virtual PLCs are used to execute different industrial control tasks.

[0067] In the embodiments of the present application, the multi-task operating apparatus can access the shared memory according to an industrial control task execution sequence by using the PLC programs of different virtual PLCs, and perform a data reading operation and / or a data writing operation on the shared memory in the case of creating the shared memory.

[0068] It should be noted that, in the embodiments of the present application, the PLC program accesses the shared memory, and a corresponding interface needs to be called, based on which the multi-task operating apparatus can further perform the following steps: defining an external function interface in a PLC programming environment; the external function interface is used to be called by the PLC programs of different virtual PLCs to access the shared memory.

[0069] It should be noted that, in the embodiments of the present application, the PLC program performs a data reading operation and / or a data writing operation on the shared memory, and a corresponding function needs to be called, based on which the multi-task operating apparatus can further perform the following steps: compiling a dynamic link library, the dynamic link library is used to provide functions for accessing the shared memory; wherein the PLC programs of different virtual PLCs perform a data reading operation and / or a data writing operation on the shared memory by calling the functions in the dynamic link library.

[0070] 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, and the industrial control tasks are usually periodic and have a certain execution sequence, for example, for industrial control tasks in sequence, the execution of a later industrial control task needs to use task data generated by a former industrial control task, in this case, the shared memory can be written with the task data generated by the former industrial control task and read by the later industrial control task, based on which the PLC programs of different virtual PLCs can access the shared memory according to the industrial control task execution sequence, so as to perform a corresponding data reading operation and / or a data writing operation, thereby meeting the actual task execution requirements.

[0071] FIG. 4 is an exemplary multi-task interoperation interaction diagram provided by the embodiments of the present application, and the following details the related implementation process of deploying PLC programs on PLCs and accessing the shared memory according to an industrial control task execution sequence by using the PLC programs of different virtual PLCs, and performing a data reading operation and / or a data writing operation on the shared memory based on FIG. 4.

[0072] In the embodiments of the present application, the PLC program can be developed through the development application platform, and based on this, before the multi-task operation device accesses the shared memory according to the execution sequence of the industrial control task by using the PLC programs of different virtual PLCs, the following steps can be performed: configuring a timer in each of the PLC programs of different virtual PLCs; wherein each timer is used to make the PLC program to which the timer belongs to access the shared memory in a timing manner according to the execution sequence of the implemented industrial control task.

[0073] It should be noted that in the embodiments of the present application, in the PLC program, the timing access to the shared memory can be implemented by configuring a timer, that is, the time when the PLC program accesses the shared memory is constrained by the timer, and the time setting of the timer can be determined based on the execution sequence of the industrial control task, so that the PLC programs of different virtual PLCs can access the shared memory in a timing manner according to the sequence.

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

[0075] 1. Define external function interface and variable: define a pointer to an external function in the PLC program, and define a timer for timing access.

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

[0077] 3. Implement timer control logic: use the timer to control the timing access to the shared memory. For example, set the timer period to 5ms-10ms, and perform data reading operation and / or data writing operation on the shared memory each time the timer expires. When the timer expires, call a function (for example: read_shared_memory) to read data from the shared memory to a buffer. Then, the data in the buffer can be processed, and finally, a function (for example: write_shared_memory) is called to write the processed data to the shared memory. In order to ensure that the timer continues to run in the next period, the timer parameter needs to be set to FALSE to reset the timer, and then set to TRUE to restart the timer.

[0078] In the embodiments of the present application, for the compiled PLC program, related environment deployment is needed to run. For example, the PLC program can be downloaded to the host computer and deployed to the container, the shared memory can be mounted to the container, and when the container is started, the shared memory area of the host computer needs to be mounted (for example: 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:

[0079] 1. Open the shared memory object: use the shm_open system call to open the shared memory object. Open the shared memory by the same name as the host machine.

[0080] 2. Map the shared memory: map the shared memory object to the process's virtual address space, obtaining a pointer to the shared memory region.

[0081] 3. Read and write shared memory: use the pointer to perform data read operations and / or data write operations on the shared memory; wherein the data read operation is to read the content in 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.

[0082] In an embodiment of the present application, as shown in FIG. 4, the first virtual PLC and the second virtual PLC can perform read and write operations on the shared memory. Specifically, the first virtual PLC and the second virtual PLC perform timed read and write operations on the shared memory, and the interoperation framework is shown in FIG. 5. The following takes the first virtual PLC and the second virtual PLC as examples to specifically explain the shared memory read and write implementation.

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

[0084] 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;

[0085] The first PLC program is used to execute the first industrial control task, and 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 in sequence;

[0086] The time of the first timer is the task period of the first industrial control task;

[0087] 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.

[0088] In an embodiment of the present application, as shown in FIG. 6, the multi-task operation device uses the PLC programs of different virtual PLCs to access the shared memory according to the industrial control task execution sequence, and performs data read operations and / or data write operations on the shared memory, including:

[0089] Running the first PLC program on the first virtual PLC, executing the first industrial control task and starting the first timer;

[0090] In a case where the first timer expires, a data write operation is performed on the shared memory by using the first PLC program, and task data generated by executing the first industrial control task is written into the shared memory;

[0091] The second PLC program is run on the second virtual PLC, and the second timer is started;

[0092] In a case where the second timer expires, a data read operation is performed on the shared memory by using the second PLC program, and task data is read from the shared memory, and the second industrial control task is executed based on the task data.

[0093] It should be noted that, in the embodiments of the present application, referring to FIG. 6, since the industrial control tasks are usually periodic, such as the first industrial control task and the second control task are periodic, the timers can be reset correspondingly for cyclic operation.

[0094] In the embodiments of the present application, the multi-task operation device can also close and unmap the shared memory. For example, when the industrial control task no longer needs the shared memory, the mapping should be un-mapped by using the munmap() function, and the reference of the shared memory should be closed by using the shm_unlink() function.

[0095] The technical scheme provided in the embodiments of the present application allows each industrial control task to directly access the shared data structure through the shared memory, and based on the periodicity of the industrial control task, the lock mechanism is not needed to guarantee the operation mutual exclusivity when accessing the shared memory, thereby realizing high determinacy and high real-time guarantee of the industrial control task cooperation.

[0096] The technical scheme provided in the embodiments of the present application has the following advantages compared with the physical distributed cooperation and the virtualized distributed cooperation:

[0097] 1. Improve task execution efficiency: based on the periodic execution characteristics of the industrial control task, the design does not need to use the lock mechanism to guarantee the data consistency of the shared memory, thereby reducing the performance loss and complexity caused by lock competition, and reducing the development and maintenance cost.

[0098] 2. Improve task processing real-time performance: each industrial control task is allowed to directly access the shared data structure, without going through a complex network protocol and communication process, thereby avoiding the delay caused by network communication, making the communication and data exchange between tasks more direct and efficient. And since the industrial control task reads and writes the memory at a fixed time, the data read and write time is more predictable and stable, which can provide high determinacy and high real-time performance guarantee for the real-time control system.

[0099] The embodiment of the present application provides a multi-task operation device. Figure 7 is a structural schematic diagram one of a multi-task operation device provided by the embodiment of the present application. As shown in Figure 7, in the embodiment of the present application, the multi-task operation device comprises:

[0100] The creating module 201 is configured to create a shared memory between different virtual programmable logic controllers (PLCs);

[0101] The operation module 202 is configured to access the shared memory according to an execution sequence of industrial control tasks by using PLC programs of different virtual PLCs, and perform data reading operation and / or data writing operation on the shared memory;

[0102] The PLC programs of different virtual PLCs are used to execute different industrial control tasks.

[0103] In an embodiment of the present application, the creating module 201 is configured to call a system interface to create the shared memory; and set a name, an access permission and a memory size for the shared memory.

[0104] In an embodiment of the present application, the creating module 201 is further configured to define an external function interface in a PLC programming environment; and the external function interface is used to be called by PLC programs of different virtual PLCs to access the shared memory.

[0105] In an embodiment of the present application, the creating module 201 is further configured to compile a dynamic link library, and the dynamic link library is used to provide functions for accessing the shared memory; wherein the PLC programs of different virtual PLCs perform data reading operation and / or data writing operation on the shared memory by calling the functions in the dynamic link library.

[0106] In an embodiment of the present application, the creating module 201 is further configured to configure a timer in each of the PLC programs of different virtual PLCs; wherein each timer is used to make the PLC program to which the timer belongs to access the shared memory in a time sequence according to an execution sequence of an industrial control task implemented by the PLC program.

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

[0108] 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;

[0109] 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 in sequence.

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

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

[0112] In an embodiment of the present application, the operation module 202 is configured to run the first PLC program on the first virtual PLC, execute the first industrial control task, and start the first timer; in the case that the first timer expires, perform a data write operation on the shared memory by using the first PLC program, and write task data generated by executing the first industrial control task into the shared memory; run the second PLC program on the second virtual PLC, and start the second timer; in the case that the second timer expires, perform a data read operation on the shared memory by using the second PLC program, read the task data from the shared memory, and execute the second industrial control task based on the task data.

[0113] Fig. 8 is a structural schematic diagram of a multi-task operation device according to an embodiment of the present application. As shown in Fig. 8, in an embodiment of the present application, the multi-task operation device comprises a processor 301, a memory 302, and a communication bus 303;

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

[0115] The processor 301 is configured to execute one or more computer programs stored in the memory 302, so as to realize the multi-task operation method.

[0116] An embodiment of the present application provides a computer program product, comprising a computer program, and the computer program is executed to realize the multi-task operation method.

[0117] The embodiment of the present application provides a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the multi-task operation method. The computer readable storage medium can be a volatile memory, such as a random access memory (RAM), or a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD). The computer readable storage medium can also be a device including one or any combination of the above memories, such as a mobile phone, a computer, a tablet device, a personal digital assistant, and the like.

[0118] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take 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.) containing computer-usable program code.

[0119] The present application is described with reference to the implementation flowcharts and / or block diagrams of the method, device (system), and computer program product according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams and the combination of the flows and / or blocks 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 devices to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices produce a device that implements the functions specified in one or more flows of the flowcharts and / or one or more blocks of the block diagrams.

[0120] These computer program instructions can also be stored in a computer readable memory that can guide the computer or other programmable data processing devices to work in a specific way, so that the instructions stored in the computer readable memory produce a product including instruction devices that implement the functions specified in one or more flows of the flowcharts and / or one or more blocks of the block diagrams.

[0121] These computer program instructions can also be loaded into a computer or other programmable data processing devices, so that a series of operational steps are performed on the computer or other programmable data processing devices to generate a computer implemented process, so that the instructions executed on the computer or other programmable data processing devices provide steps for implementing the functions specified in one or more flows of the flow diagram and / or one or more blocks of the block diagram.

[0122] The above description is merely a specific implementation of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed by the present application, which should be covered within the scope of protection of the present application. Therefore, the scope of protection of the present application should be subject to the scope of protection of the claims.

Claims

1. A method for multi-task operation, comprising: creating a shared memory between different virtual programmable logic controllers (PLCs) ; accessing the shared memory by PLC programs of the different virtual PLCs according to an execution sequence of industrial control tasks, and performing data read operation and / or data write operation on the shared memory; wherein the PLC programs of the different virtual PLCs are used to perform different industrial control tasks.

2. The method of claim 1, wherein, The creating of the shared memory between the different virtual PLCs comprises: invoking a system interface to create the shared memory; setting a name, an access right, and a memory size for the shared memory.

3. The method of claim 1, wherein, The method further comprises: defining an external function interface in a PLC programming environment, the external function interface being used for the PLC programs of the different virtual PLCs to invoke to access the shared memory.

4. The method of claim 1, wherein, The method further comprises: writing a dynamic link library, the dynamic link library being used to provide functions for accessing the shared memory; wherein the PLC programs of the different virtual PLCs perform data read operation and / or data write operation on the shared memory by invoking the functions in the dynamic link library.

5. The method of claim 1, wherein, Before the accessing of the shared memory by the PLC programs of the different virtual PLCs according to the execution sequence of the industrial control tasks, the method further comprises: configuring a timer in each of the PLC programs of the different virtual PLCs; wherein each timer is used to make the PLC program to which the timer belongs to access the shared memory in a time sequence of the industrial control tasks implemented by the PLC program.

6. The method of claim 5, wherein, The first virtual PLC and the second virtual PLC share the shared memory; wherein, a first timer is configured for a first PLC program of the first virtual PLC, and a second timer is configured for a second PLC program of the second virtual PLC; the first PLC program is used to perform a first industrial control task, and the second PLC program is used to perform a second industrial control task, the first industrial control task and the second industrial control task being executed in sequence; a time of the first timer is a task cycle of the first industrial control task; a time of the second timer is greater than or equal to a total time for the first industrial control task to be executed and for task data generated by the first industrial control task to be written into the shared memory.

7. The method of claim 6, wherein, The accessing of the shared memory by the PLC programs of the different virtual PLCs according to the execution sequence of the industrial control tasks, and the performing of data read operation and / or data write operation on the shared memory, comprises: running the first PLC program on the first virtual PLC to execute the first industrial control task and to start the first timer; in a case that the first timer is timed out, performing data write operation on the shared memory by the first PLC program to write the task data generated by the execution of the first industrial control task into the shared memory; running the second PLC program on the second virtual PLC to start the second timer; in a case that the second timer is timed out, performing data read operation on the shared memory by the second PLC program to read the task data from the shared memory, and executing the second industrial control task based on the task data.

8. A multi-task operating device, comprising: a creating module configured to create a shared memory between different virtual programmable logic controllers (PLCs); an operating module configured to access the shared memory according to an industrial control task execution sequence by using PLC programs of the different virtual PLCs, and perform data reading operation and / or data writing operation on the shared memory; wherein the PLC programs of the different virtual PLCs are used to perform different industrial control tasks.

9. A multi-tasking operating device comprising: a processor, a memory and a communication bus; the communication bus is configured to realize communication connection between the processor and the memory; the processor is configured to execute one or more computer programs stored in the memory to realize the multi-task operating method according to any one of claims 1-7.

10. A computer readable storage medium having stored thereon a computer program, which, when executed by a processor, realizes the multi-task operating method according to any one of claims 1-7.

11. A computer program product comprising a computer program, which, when executed by a processor, realizes the multi-task operating method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Data sharing method applied among multiple virtual controllers

    CN106774277A

  • Method and device for realizing redundant virtual PLC, equipment and storage medium

    CN113434341A

  • Memory sharing management method and system

    CN117112268A

  • Virtual PLC calling method and device, storage medium and electronic equipment

    CN117376142A

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

    CN119310921A