PLC instruction real-time communication system, method, device and equipment in virtual environment

By designing a PLC instruction real-time communication system in the virtual environment, including instruction caching, resource binding, forwarding and transmission path optimization modules, the problem of low PLC instruction communication efficiency in the virtual environment is solved, and hard real-time and strong real-time are achieved. Communication needs.

CN118732600AActive Publication Date: 2024-10-01MILITARY SECRECY QUALIFICATION EXAMINATION & CERTIFICATION CENT +1
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202410774796.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-17
Publication Date
2024-10-01
Estimated Expiration
2044-06-17

AI Technical Summary

Technical Problem

The efficiency of soft PLC in the virtual environment is unpredictable when executing control algorithms, resulting in reduced PLC instruction communication efficiency and difficulty in meeting the needs of hard real-time and strong real-time scenarios.

Method used

A real-time communication system for PLC instructions in a virtual environment is designed, including an instruction cache module, a resource binding module, an instruction forwarding module and a transmission path optimization module. By configuring a real-time operating system in the virtual machine and binding the virtual machine to the host machine Resource mapping, optimizing the instruction transmission path to improve communication efficiency.

Benefits of technology

It effectively improves the communication efficiency of PLC instructions in the virtual environment, meets the needs of hard real-time and strong real-time scenarios, and ensures efficient processing and transmission of PLC instructions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118732600A_ABST
    Figure CN118732600A_ABST
Patent Text Reader

Abstract

The invention provides a PLC instruction real-time communication system, method, device and equipment in a virtual environment, and the system comprises an instruction caching module which is used for storing a generated virtual PLC instruction into a real-time operation space, when the virtual PLC instruction meets the instruction sending condition, the virtual PLC instruction stored in the real-time operation space is sent to the instruction forwarding module; the system comprises an instruction caching module used for caching a virtual PLC instruction, a resource binding module used for binding a resource mapping relationship between a virtual machine corresponding to a virtual operating system and a host machine, and an instruction forwarding module used for receiving the virtual PLC instruction sent by the instruction caching module and forwarding the virtual PLC instruction to a transmission path optimization module based on a data transmission resource of the host machine; and the transmission path optimization module is used for receiving the virtual PLC instruction forwarded by the instruction forwarding module and optimizing an instruction transmission path. Therefore, the communication efficiency of the PLC instruction in the virtual environment is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of real-time communication technology, and in particular, to a system, method, apparatus and device for real-time communication of PLC instructions in a virtual environment. Background Art

[0002] PLC (Programmable Logic Controller) can be used for sequential control and logic control. As the demand for control applications increases, PLC manufacturers have gradually added more practical functions, such as PID control and analog conversion.

[0003] Industrial control safety scenarios are mostly hard real-time scenarios and strong real-time scenarios, so the soft PLC in the virtual environment must not only meet the requirements of soft real-time scenarios, but also meet the requirements of hard real-time scenarios and strong real-time scenarios. Usually, PLC real-time control is performed within a fixed cycle. From the perspective of traditional control, the execution efficiency of the control algorithm executed by the soft PLC in the virtual environment is unpredictable, thus reducing the communication efficiency of the PLC instructions. Summary of the invention

[0004] The embodiments described herein provide a system, method, apparatus and device for real-time communication of PLC instructions in a virtual environment, which overcome the above-mentioned problems.

[0005] In a first aspect, according to the content of the present disclosure, a PLC instruction real-time communication system in a virtual environment is provided, comprising: an instruction cache module, a resource binding module, an instruction forwarding module and a transmission path optimization module;

[0006] The instruction cache module is used to store the generated virtual PLC instruction in the real-time operation space, and send the virtual PLC instruction stored in the real-time operation space to the instruction forwarding module when the virtual PLC instruction meets the instruction sending condition, and the real-time operation space is obtained by dividing the virtual operating system;

[0007] The resource binding module is used to bind the resource mapping relationship between the virtual machine corresponding to the virtual operating system and the host machine, so that the instruction forwarding module forwards the virtual PLC instruction based on the data transmission resources of the host machine;

[0008] The instruction forwarding module is used to receive the virtual PLC instruction sent by the instruction cache module, and forward the virtual PLC instruction to the transmission path optimization module based on the data transmission resources of the host machine;

[0009] The transmission path optimization module is used to receive the virtual PLC instruction forwarded by the instruction forwarding module, and optimize the instruction transmission path to transmit the virtual PLC instruction to the industrial control device based on the instruction transmission path.

[0010] In a second aspect, according to the content of the present disclosure, a method for real-time communication of PLC instructions in a virtual environment is provided, comprising:

[0011] The generated virtual PLC instructions are stored in a real-time operation space, where the real-time operation space is obtained by dividing the virtual operating system;

[0012] Optimize instruction transmission path;

[0013] The virtual PLC instruction is read from the real-time operation space, and the virtual PLC instruction is transmitted to the industrial control device based on the instruction transmission path.

[0014] In a third aspect, according to the content of the present disclosure, a device for real-time communication of PLC instructions in a virtual environment is provided, comprising:

[0015] A storage module, used for storing the generated virtual PLC instructions in a real-time operation space, wherein the real-time operation space is obtained by dividing the virtual operating system;

[0016] An optimization module, used to optimize the instruction transmission path;

[0017] A transmission module is used to read the virtual PLC instruction from the real-time operation space and transmit the virtual PLC instruction to the industrial control device based on the instruction transmission path.

[0018] In a fourth aspect, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of the real-time communication method of PLC instructions in a virtual environment in any of the above embodiments are implemented.

[0019] In a fifth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the real-time communication method of PLC instructions in a virtual environment are implemented as in any of the above embodiments.

[0020] The real-time communication system of PLC instructions in a virtual environment provided by the embodiment of the present application includes: an instruction cache module, a resource binding module, an instruction forwarding module and a transmission path optimization module; the instruction cache module is used to store the generated virtual PLC instructions in the real-time operation space, and send the virtual PLC instructions stored in the real-time operation space to the instruction forwarding module when the virtual PLC instructions meet the instruction sending conditions, and the real-time operation space is obtained by dividing the virtual operating system; the resource binding module is used to bind the resource mapping relationship between the virtual machine and the host machine corresponding to the virtual operating system, so that the instruction forwarding module forwards the virtual PLC instructions based on the data transmission resources of the host machine; the instruction forwarding module is used to receive the virtual PLC instructions sent by the instruction cache module, and forward the virtual PLC instructions to the transmission path optimization module based on the data transmission resources of the host machine; the transmission path optimization module is used to receive the virtual PLC instructions forwarded by the instruction forwarding module, and optimize the instruction transmission path, so as to transmit the virtual PLC instructions to the industrial control equipment based on the instruction transmission path. In this way, by configuring the real-time operating system in the virtual machine, it is convenient to process the PLC instructions, and by binding the resource mapping between the virtual machine and the host machine, the virtual machine and the host machine realize the one-to-one correspondence of resources, which effectively improves the communication efficiency of the PLC instructions in the virtual environment.

[0021] The above description is only an overview of the technical solution of the embodiment of the present application. In order to more clearly understand the technical means of the embodiment of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly described below. It should be noted that the drawings described below only relate to some embodiments of the present disclosure, but are not intended to limit the present disclosure, wherein:

[0023] Figure 1 It is a structural schematic diagram of a PLC instruction real-time communication system in a virtual environment provided by the present disclosure.

[0024] Figure 2A It is a schematic diagram of the framework of a soft PLC provided by the present invention.

[0025] Figure 2B This is a RTAI / Linux dual-kernel architecture design diagram provided by the present invention.

[0026] Figure 3 It is a flow chart of a real-time communication method of PLC instructions in a virtual environment provided by the present disclosure.

[0027] Figure 4It is a structural schematic diagram of a PLC instruction real-time communication device in a virtual environment provided by the present disclosure.

[0028] Figure 5 It is a structural schematic diagram of a computer device provided by the present disclosure.

[0029] It should be noted that the elements in the drawings are schematic and not drawn to scale. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work also fall within the scope of protection of the present disclosure.

[0031] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by a person skilled in the art to which the subject matter of the present disclosure belongs. It will be further understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the specification and the relevant art, and will not be interpreted in an idealized or overly formal form unless otherwise explicitly defined herein. As used herein, a statement that two or more parts are "connected" or "coupled" together shall mean that the parts are joined together directly or through one or more intermediate components.

[0032] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase "embodiments" in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0033] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists, A and B exist at the same time, and B exists. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship. Terms such as "first" and "second" are only used to distinguish one component (or a part of a component) from another component (or another part of a component).

[0034] In the description of the present application, unless otherwise specified, "plurality" means more than two (including two), and similarly, "multiple groups" means more than two groups (including two).

[0035] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0036] Figure 1 is a structural diagram of a PLC instruction real-time communication system in a virtual environment provided by an embodiment of the present disclosure, such as Figure 1 As shown, the PLC instruction real-time communication system 10 in the virtual environment includes: an instruction cache module 110 , a resource binding module 120 , an instruction forwarding module 130 and a transmission path optimization module 140 .

[0037] The instruction cache module 110 is used to store the generated virtual PLC instructions in the real-time operation space, and send the virtual PLC instructions stored in the real-time operation space to the instruction forwarding module 130 when the virtual PLC instructions meet the instruction sending conditions. The real-time operation space is obtained by dividing the virtual operating system.

[0038] The instruction cache module 110 implements the soft PLC function by dividing a real-time operating system (ie, real-time operating space) on the Windows operating system to complete logical functions such as input processing, program execution, and output processing.

[0039] like Figure 2A As shown, the windows development system includes configuration software 2101, human-machine interface 2102, communication interface 2103, windows hardware expansion interface 2104, and communicates with the soft PLC CPU 2106 in the real-time running system through the PLC communication interface 2105, and the soft PLC CPU 2106 is connected to the real-time hardware expansion interface 2107.

[0040] In this embodiment, the soft PLC integrates the switch quantity control, analog quantity control, mathematical operation, numerical processing, network communication, PID (Proportional Integral Derivative) adjustment and other functions of the computer and PLC, and provides a powerful instruction set, fast and accurate scanning cycle, reliable operation and an open structure that can connect to various I / O (Input / output) systems and networks through a multi-task control kernel. This makes the software PLC provide the same functions as the hard PLC, while providing various advantages of the PC (Personal Computer) environment.

[0041] Virtual PLC is the function of traditional PLC encapsulated in software. The realization of virtual PLC system function is based on traditional PLC, so they have similar working principles. After the user edits the program, the soft PLC system will cyclically scan the program edited by the user and store the scanned data in the buffer area. When the output command is executed, the data will be output. Since virtual PLC has the functional characteristics of traditional PLC and inherits various advantages of PC, it has high-speed data processing capability and powerful network communication capability.

[0042] The virtual PLC instruction is a control instruction compiled by the virtual PLC based on the control requirements, and the virtual PLC instruction is added to the real-time operation space and waits for sending.

[0043] In this embodiment, the instruction cache module 110 is used to divide a real-time running space (for example, a process with the highest execution priority) on the Windows operating system in the virtual machine, which can ensure efficient communication of virtual PLC instructions at the software control level.

[0044] The resource binding module 120 is used to bind the resource mapping relationship between the virtual machine corresponding to the virtual operating system and the host machine, so that the instruction forwarding module 130 forwards the virtual PLC instruction based on the data transmission resources of the host machine.

[0045] Among them, the resource binding module 120 binds the virtual machine CPU and the host machine physical CPU to each other based on the Openstack NUMA virtual machine CPU (Central Processing Unit) binding technology, and designs large page memory and other methods to improve the efficiency of the virtual machine to ensure the normal operation of the RTAI-Linux real-time operating system.

[0046] The OpenstackNUMA virtual machine CPU binding design includes: viewing the NUMA topology of the current physical server; viewing the idle status of the logical CPU; enabling NUMATopologyFilter; creating NovaFlavor; configuring the virtual machine NUMA topology; configuring the virtual machine CPU binding policy; starting the test virtual machine; viewing the CPU binding status of the virtual machine.

[0047] The instruction forwarding module 130 is used to receive the virtual PLC instruction sent by the instruction cache module 110, and forward the virtual PLC instruction to the transmission path optimization module 140 based on the data transmission resources of the host machine.

[0048] Among them, the virtual machine uses the RTAI-Linux real-time operating system to ensure that the internal process of the virtual machine meets the hard real-time requirements. The RTAI-Linux real-time operating system transmits the PLC virtual instructions to the virtual bridge in the host operating system, and the virtual bridge is responsible for forwarding the virtual instructions.

[0049] The instruction forwarding module 130 enables the operating system in the virtual machine to achieve hard real-time performance when receiving and forwarding virtual PLC instructions.

[0050] The instruction forwarding module 130 adopts RTAI / Linux dual-core structure design, and the design structure is as follows Figure 2B shown. Figure 2B It includes: Linux user space 2201, kernel space 2202, Linux task 2203, Linux task 2204, real-time task 2205, real-time task 2206, Linux domain 2207, RTAI domain 2208, scheduling service 2209, domain initialization 2210, interrupt 2211, ADEOS (Adaptive Domain Environment for Operating System) 2212, and hardware platform 2213.

[0051] RTAI design principle: RTAI manages the Linux kernel as its subtask by suspending the Linux kernel. RTAI has the basic characteristics of a real-time operating system, and has made some extensions on this basis and added some new functions. At present, the hardware platforms supported by RTAI include: MIPS, PowerPC, X86, CRIS, ARM and M68K processors. The hardware abstraction resource layer is used to obtain the underlying hardware related information and requests, and pass them to the upper kernel. In the dual-core architecture, Linux functions can be completely mapped to the RTAI kernel through the system redirection function, so most of the tasks that previously needed to be completed in the Linux space can be completed in the RTAI space. The biggest benefit of this method is that the amount of changes to the native system is minimized, which is convenient for porting between different systems. RTAI is a microkernel with real-time processing performance, with preemptive kernels, and real-time properties such as microsecond-level time timing. As a fully preemptive kernel, when a high-priority task arrives, it can immediately initiate preemption without waiting for the next clock interrupt. Since the RTAI kernel runs the Linux system as a low-priority task, the prerequisite for the Linux system to obtain CPU control is that there are no urgent tasks in the RTAI kernel.

[0052] In some embodiments, the instruction forwarding module 130 includes: a task processing unit, a real-time scheduling unit, a message queue, and a first-in first-out unit. The task processing unit is used to receive the virtual PLC instruction sent by the instruction cache module 110; the real-time scheduling unit is used to perform task scheduling on the virtual PLC instruction and send the virtual PLC instruction to the message queue based on the scheduling result; the message queue is used to store the virtual PLC instruction at the target location based on the sending time of the virtual PLC instruction; the first-in first-out unit is used to forward the virtual PLC instruction to the transmission path optimization module 140 based on the data transmission resources of the host machine when the current message sending location is detected to be the target location.

[0053] Among them, the task processing unit implements the hardware abstraction layer and completes the acquisition and transmission of hardware information; the real-time scheduling unit completes the scheduling and distribution of external tasks; the message queue can store multiple real-time tasks; the first-in-first-out unit uses a first-in-first-out method to receive and output messages in the pipeline.

[0054] In some embodiments, the instruction forwarding module 130 further includes: a memory sharing unit connected to the message queue; a memory sharing unit for storing virtual control instructions in the message queue and sharing the stored virtual control instructions in the message queue in response to a process asynchronous access request.

[0055] Among them, the memory sharing unit is responsible for the asynchronous access of each process to the shared memory area, so as to meet the data access requirements of different asynchronous processes.

[0056] In some embodiments, the instruction forwarding module 130 also includes: a queue management unit, which is connected to the message queue; the queue management unit is used to perform security rule constraints on the virtual control instructions stored in the message queue based on the security group rules corresponding to the virtual operating system to obtain virtual control instructions that meet the security rule constraints, and send the virtual control instructions that meet the security rule constraints to the message queue; the message queue is also used to update the stored virtual control instructions based on the virtual control instructions that meet the security rule constraints.

[0057] The system security rules are screened securely by the queue management unit, so that the message queue can perform security constraints on the virtual control instructions stored therein, thereby effectively ensuring the secure transmission of the virtual control instructions.

[0058] In addition, the instruction forwarding module 130 may also include: a function mapping unit, a hard real-time thread unit and a tool unit. The function mapping unit is used to map Linux user space and kernel space functions to RTAI user space; the hard real-time thread unit is responsible for completing the management of each hard real-time thread; and the tool unit is used to manage the tools required for task execution.

[0059] The specific implementation mechanism of the instruction forwarding module 130 is as follows.

[0060] In terms of interrupt management, the original Linux management method uses the interrupt switch function to directly use assembly language to complete the operation of hardware switch interrupt; while the RTAI task core module provides an interrupt flag specifically for interrupt management, and completes the hardware switch interrupt behavior by setting int_flag to 0 or 1.

[0061] In terms of clock timing function, periodic timing is used. Two timing modes are designed, one-shot time and periodic time, which can handle single-cycle tasks and cyclic tasks respectively. The processor time stamp (Time Stamp Counter, TSC) replaces the original timing method to perform high-precision timing. A machine instruction RTSC (such as Read Time Stamp Counter) is used to read the timestamp number and save it in the EDX:EAX register pair.

[0062] A custom hardware abstraction layer is created between the hardware layer and the kernel, and a set of system interfaces are generated, through which the two interact. This reduces the amount of code that needs to be modified in the Linux kernel. A real-time kernel of its own is also added. The two kernels can cooperate with each other, which can meet the high responsiveness of real-time tasks and prevent non-real-time tasks from being in a waiting state.

[0063] In some embodiments, the real-time scheduling unit is specifically used to:

[0064] Obtain the domain space type to which the virtual PLC instruction belongs, the domain space type including: a first system operation class and a second system operation class; perform task scheduling on the virtual PLC instruction based on the priority level of the domain space type to which the virtual PLC instruction belongs, and task scheduling is used to describe the storage order of the virtual PLC instruction determined based on the priority level of the domain space type to which the virtual PLC instruction belongs.

[0065] The first system operation class may be a Linux kernel class, and the second system operation class may be an RTAI kernel class. Specifically, it may be predefined that the priority of the second system operation class is higher than the priority of the first system operation class, so as to realize real-time scheduling of tasks with different priorities.

[0066] In addition, this embodiment designs a hardware abstraction layer to store and transmit important parameters of system functions and hardware interrupt related information, and designs a structure data structure to track and collect all data information related to kernel functions, including: internal interrupts, external interrupts, function calls, and high-precision clock timing information. The specific design method is as follows.

[0067] The hardware abstraction layer manages the order in which different domains access shared resources by using event pipeline technology, and sets an unchangeable priority for each domain, which is set when the system is initialized.

[0068] When an event arrives, it is arranged in order according to the priority of the domain, and the front domain obtains the right to process the event before the back domain. When an event is passed to a domain, the domain can choose to accept, give up or terminate. The default state of the domain is to accept; but when the domain chooses to give up, the event will be passed along the pipeline to the next domain; if the event is terminated, it means that the current domain is the last domain and the event stops being passed. When the event is completed, the system calls a special hardware resource abstraction layer service to hand over the CPU to the next domain. The system will check whether each domain is in sleep state in turn. If so, the domain with the lowest priority will start to execute the idle event. The idle task will not be terminated until the next event arrives. The data structure describing the domain state and the domain entry function constitute an interface, and the hardware abstraction layer completes access to the domain through this interface.

[0069] RTAI user space design: RTAI user space design has a complete set of APIs that can map programming in RTAI user space to Linux user space. Real-time applications developed in the RTAI environment can not only call the resources provided by the Linux system, but also enjoy the security protection mechanism of the Linux kernel.

[0070] The real-time scheduling unit and the function mapping unit provide support for the implementation of this mapping mechanism. The real-time scheduling unit can schedule tasks under Linux as well as tasks in the RTAI kernel, while the function mapping unit can only schedule tasks in the RTAI user space.

[0071] RTAI / LINUX integration method design: The integration of RTAI and LINUX environment includes three parts: interrupt control integration, fine-grained clock integration, and memory management integration.

[0072] The integration of interrupt control is mainly aimed at the integration of interrupt virtualizer. The specific design scheme is as follows: the interrupt virtualizer, as the interaction layer between the upper operating system and the lower hardware layer, controls all hardware interrupts. The interrupt response time is an important factor affecting real-time performance. Therefore, interrupt pipeline distribution and soft interrupt simulation are designed as two interrupt control mechanisms of the RTAI kernel. In the hardware abstraction layer, an optimized protection scheme is designed for interrupts, and a non-interrupt area is set for each domain. It is used to block the pipeline segment of any domain. When an interrupt arrives, it is found that the pipeline of the current domain is blocked and will not continue to be passed to the low-priority domain. The interrupts are stored in the interrupt log in the order of arrival. When the domain is executed, the waiting interrupt request is read from the interrupt log through synchronization operation and executed. In this way, the protection critical area is preempted by the sudden interrupt to prevent errors. The interrupt virtualizer is introduced. A series of commands in the upper systems that were originally completed directly by operating the hardware are completely processed by the virtualizer after reaching the virtual layer. For the lower layer, the received interrupt is placed in the interrupt pipeline, and the interrupt is distributed and transmitted along the interrupt pipeline in sequence through a suitable interrupt distribution strategy.

[0073] The design is based on fine-grained clock integration, including timer integration, which refines the time granularity of the Linux system from milliseconds to microseconds, thereby enhancing the real-time performance of the system. On the basis of the original timing, the timer adds periodic and non-periodic modes to achieve accurate timing of tasks. The RTAI kernel designs the following two timing modes: Periodic mode and One-shot mode. Periodic mode: Applicable to periodic tasks, the time setting is completed when the task is initialized, and then it enters the cyclic timing mode. Every time the timer completes a cycle, the CPU performs a detection. One-shot mode: Applicable to non-periodic tasks, the timing starting point is the earliest arrival deadline of the timer. Once the timer arrives, the real-time kernel immediately processes the task. Accurate clock timing and timer initial time setting are the two key points of the current one-shot mode. Use a programmable counting timer to simulate the time tag counter (TSC) to achieve accurate timing; set the initial value of the timer by calling the management interface function of the real-time clock to solve the problem of setting the initial value of the single-cycle timer.

[0074] Memory management integration: Memory management integration needs to be combined with the memory management mechanism of the relevant hardware platform. The relevant management mechanisms include cache locking, dynamic memory, shared memory, etc. Dynamic allocation and recovery strategy is an important memory management method of the real-time kernel. Users use the memory management interface provided by the kernel to perform dynamic memory management of the real-time kernel. It solves many problems caused by the original actual kernel management mechanism of the Linux kernel. After dividing the real-time tasks and user space tasks, the two are allowed to share the same part of the memory. In the specific implementation, the content of the same address space is allowed to allow all real-time processes to have access rights. The overhead of switching memory protection levels can be avoided by adopting a unified kernel address space, and this method can effectively reduce the difficulty of real-time kernel development.

[0075] The transmission path optimization module 140 is used to receive the virtual PLC instruction forwarded by the instruction forwarding module 130 and optimize the instruction transmission path to transmit the virtual PLC instruction to the industrial control device based on the instruction transmission path.

[0076] In some embodiments, the transmission path optimization module 140 includes: an instruction transfer interface, a bridge and a switch controller; the instruction transfer interface is used to receive the virtual PLC instructions forwarded by the instruction forwarding module and send the virtual PLC instructions to the bridge; the bridge is used to send the virtual PLC instructions to the switch controller through the DPDK PMD component; the switch controller is used to optimize the instruction transmission path and transmit the virtual PLC instructions to the industrial control equipment based on the instruction transmission path.

[0077] For example, the virtual network of the computing node is designed to use the br-int bridge to implement each tenant network, and the br-eth bridge to implement the data path between tenant networks. Use the dpdkr interface (i.e., instruction transfer interface) as the interface for mounting the network card to br-eth, and select the vhost-user interface as the interface program between the virtual machine and br-int. The dpdkr interface sends the data packets sent to the eth1 network card to br-eth through shared memory. br-eth directly hands the data packets to the Openvswitch controller (i.e., switch controller) through the DPDKPMD module for flow table matching and routing, thus avoiding memory copying and CPU interrupt processing from the network card to br-eth.

[0078] Using the vhost-user interface, data packets from br-int to the virtual machine will be stored in the shared memory. When Qemu needs to read these data packets, it can read them directly by mapping the address, reducing the number of data packet copies and the number of CPU interrupts.

[0079] The real-time communication system for PLC instructions in a virtual environment in this embodiment includes: an instruction cache module, a resource binding module, an instruction forwarding module and a transmission path optimization module; the instruction cache module is used to store the generated virtual PLC instructions in the real-time operation space, and send the virtual PLC instructions stored in the real-time operation space to the instruction forwarding module when the virtual PLC instructions meet the instruction sending conditions, and the real-time operation space is obtained by dividing the virtual operating system; the resource binding module is used to bind the resource mapping relationship between the virtual machine and the host machine corresponding to the virtual operating system, so that the instruction forwarding module forwards the virtual PLC instructions based on the data transmission resources of the host machine; the instruction forwarding module is used to receive the virtual PLC instructions sent by the instruction cache module, and forward the virtual PLC instructions to the transmission path optimization module based on the data transmission resources of the host machine; the transmission path optimization module is used to receive the virtual PLC instructions forwarded by the instruction forwarding module, and optimize the instruction transmission path, so as to transmit the virtual PLC instructions to the industrial control equipment based on the instruction transmission path. In this way, by configuring the real-time operating system in the virtual machine, it is convenient to process the PLC instructions, and by binding the resource mapping between the virtual machine and the host machine, the virtual machine and the host machine realize the one-to-one correspondence of resources, which effectively improves the communication efficiency of the PLC instructions in the virtual environment.

[0080] In some embodiments, it also includes: a rule update module; the rule update module is used to respond to a user rule operation request and perform at least one of the following rule processing operations on the security group rules corresponding to the virtual operating system: security group rule addition, security group rule deletion, security group rule search and security group rule modification.

[0081] When users operate security group rules, the agent can add, delete, modify, and check security group rules. For example, add a rule to enter a virtual machine. By modifying the implementation of the security group, the function of the security group can be retained while optimizing the network performance of the computing node.

[0082] In addition, use the Openflow flow table in Openvswitch as the implementation of the security group. In the neutron.conf file, change the firewall_driver in the SECURITYGROUP section to use OVSFirewallDriver, and install the ovs_dpdk_firewall.py file in the computing node.

[0083] Design the security group function flow through Openflow based on ovs_dpdk_firewall.py: Establish a basic security group: After creating a security group, two basic security group rules will be generated. First, block data packets entering the virtual machine from the outside. Second, allow all data packets from the virtual machine to the outside. When there is a DHCP (Dynamic Host Configuration Protocol) service in the tenant, add a rule to allow DHCP flow so that the virtual machines in the tenant can obtain IP (Internet Protocol) addresses through DHCP. Set up the agent side to implement operations such as adding, deleting, modifying and checking security groups. For example, obtain the port information where the security group is located.

[0084] Optimized design of OpenStack network nodes: br-int is used to isolate each tenant network in the network node design, and br-ex is used to realize the interconnection between the OpenStack network and the external network. The qrouter namespace is used to realize each tenant's own virtual router. The interfaces of br-eth and br-ex connecting the network card are optimized to dpdkr interface programs, so that the data packets do not pass through the kernel-state Netfilter / Iptables, reducing the number of memory copies and user-state / kernel-state switching when the data packets go from the network card to the virtual switches br-eth and br-ex, and optimizing the network performance of the OpenStack network node.

[0085] The DPDK settings are as follows:

[0086] The server uses an x86 architecture 64-bit processor, the operating system uses the Linux 64-bit operating system, and uses GCC (GNU Compiler Collection) as the compiler.

[0087] defconfig_x86_64-native-linuxapp-gcc configuration file. There are also common configuration items for Linux operating systems in the common_linuxapp configuration file.

[0088] Change CONFIG_RTE_BUILD_COMBINE_LIBS in common_linuxapp to y so that DPDK uses only a single library file, thereby ensuring the implementation of IVSHMEM technology and avoiding multiple memory copies of data packets from the physical network card to the network card of the virtual machine.

[0089] Change CONFIG_RTE_EAL_IGB_UIO in common_linuxapp to y. This configuration item ensures that DPDK interface devices can be used in openvswitch.

[0090] Since this article uses the Intel Corporation 82599ES10-Gigabit network card, keep CON FIG_RTE_LIBRTE_IXGBE_PMD = y, and configure the PMD drivers of other physical network cards such as CONFIG_RTE_LIBRTE_EM_PMD, CONFIG_RTE_LIBRTE_IGB_PMD, CONFIG_RTE_LIBRTE_I40E_PMD, CONFIG_RTE_LIBRTE_FM10K_PMD in common_linuxapp to n to reduce the impact that other physical network card drivers may bring.

[0091] Configure CONFIG_RTE_LIBRTE_IXGBE_DEBUG_INIT, CONFIG_RTE_LIBRTE_IXGBE_DEBUG_RX, CONFIG_RTE_LIBRTE_IXGBE_DEBUG_TX, CONFIG_RTE_LIBRTE_IXGBE_DEBUG_TX_FREE, and CONFIG_RTE_LIBRTE_IXGBE_DEBUG_DRIVER in common_linuxapp to n to maximize the performance of the network card.

[0092] Ensure that CONFIG_RTE_LIBRTE_VHOST_USER is configured to y in common_linuxapp to ensure that the system can use the vhost-user interface.

[0093] After modifying the above configuration items, compile and run DPDK, and use the mount-thugetlbfsnone / mnt / huge / command to mount the huge page memory, and then DPDK is installed. After installing DPDK, add the DPDK option to the Openvswitch startup command and bind the CPU logical core reserved in the previous kernel configuration to the Openvswitch process.

[0094] Adjust the server's network performance to maximum performance, and set the BIOS: Turn off all power saving modes in the BIOS to avoid affecting the network forwarding performance when the system switches to power saving mode. Select the maximum performance configuration in the CPU power management and performance management options to give full play to the CPU's performance and maximize the forwarding performance of the system and virtualization software. Since Turbo Boost is designed to automatically overclock Intel processors to save energy and power, this option should also be turned off in the BIOS. In order to maximize CPU performance, set the CPU frequency to the highest supported frequency and do not use the Auto option.

[0095] Configure huge page memory technology and CPU affinity, and configure the Linux kernel as follows: Reserve a portion of 1G huge page memory in the Linux kernel for virtualization software, and add the configuration item default_hugepagesz=1Ghugepagesz=1G hugepages=8 in the kernel startup file. Reserve a portion of CPU logical cores for virtualization software, so add the configuration item isolcpus=2,3,4,5,6,7,8 in the kernel startup file, and use these CPU logical cores when binding the CPU later.

[0096] In summary, this embodiment uses the RTAI-Linux real-time operating system in the virtual machine to ensure that the internal process of the virtual machine meets the hard real-time requirements. A virtualization platform is built based on OPENSTACK technology, and the OPENSTACK network architecture is modified to design a soft-hard network to better ensure the communication quality between soft PLC instructions and physical industrial control equipment. After evaluating the factors that cause performance bottlenecks in each node of the NUMA platform in the virtual machine environment, the NUMA platform is optimized from the perspective of vcpu scheduling in the virtual machine environment, including VCPU isolation method and physical CPU binding method, to maximize the running speed of the soft PLC, thereby realizing real-time communication of PLC instructions in the virtual environment.

[0097] Figure 3 A flowchart of a method for real-time communication of PLC instructions in a virtual environment provided by this embodiment, the method for real-time communication of PLC instructions in a virtual environment includes:

[0098] S310: Store the generated virtual PLC instructions in the real-time operation space.

[0099] The real-time operation space is obtained by dividing the virtual operating system. By dividing a real-time operation system (i.e., real-time operation space) on the Windows operating system to complete logical functions such as input processing, program execution, and output processing, the soft PLC function is realized.

[0100] S320, optimize the instruction transmission path.

[0101] Among them, by optimizing the OpenStack network components, the data path for virtual instruction forwarding is rebuilt to speed up forwarding efficiency.

[0102] S330, reading a virtual PLC instruction from the real-time operation space, and transmitting the virtual PLC instruction to the industrial control device based on the instruction transmission path.

[0103] Therefore, by configuring a real-time operating system in a virtual machine, it is convenient to process PLC instructions and effectively improve the communication efficiency of PLC instructions in a virtual environment.

[0104] In some embodiments, it may also include: in response to a user rule operation request, performing at least one of the following rule processing operations on the security group rules corresponding to the virtual operating system: security group rule addition, security group rule deletion, security group rule search, and security group rule modification.

[0105] Figure 4 This is a schematic diagram of the structure of a real-time communication device for PLC instructions in a virtual environment provided by this embodiment. The real-time communication device for PLC instructions in a virtual environment includes: a storage module 410, an optimization module 420 and a transmission module 430.

[0106] The storage module 410 is used to store the generated virtual PLC instructions in the real-time operation space, where the real-time operation space is obtained by dividing the virtual operating system.

[0107] The optimization module 420 is used to optimize the instruction transmission path.

[0108] The transmission module 430 is used to read the virtual PLC instructions from the real-time operation space and transmit the virtual PLC instructions to the industrial control device based on the instruction transmission path.

[0109] The real-time communication device for PLC instructions in a virtual environment provided by the present disclosure can execute the above method embodiments. Its specific implementation principles and technical effects can be found in the above method embodiments, and the present disclosure will not repeat them here.

[0110] The present application also provides a computer device. Figure 5 , Figure 5 This is a basic structural block diagram of the computer device in this embodiment.

[0111] The computer device includes a memory 510 and a processor 520 that are connected to each other through a system bus. It should be noted that the figure only shows a computer device with a memory 510 and a processor 520, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.

[0112] Computer devices can be computing devices such as desktop computers, notebooks, PDAs, and cloud servers. Computer devices can interact with users through keyboards, mice, remote controls, touch pads, or voice control devices.

[0113] The memory 510 includes at least one type of readable storage medium, and the readable storage medium includes a non-volatile memory or a volatile memory, for example, a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc., and the RAM may include a static RAM or a dynamic RAM. In some embodiments, the memory 510 may be an internal storage unit of a computer device, for example, a hard disk or a memory of the computer device. In other embodiments, the memory 510 may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, or a flash card (FlashCard) equipped on the computer device. Of course, the memory 510 may also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory 510 is generally used to store the operating system and various application software installed on the computer device, such as the program code of the above method. In addition, the memory 510 may also be used to temporarily store various data that have been output or are to be output.

[0114] The processor 520 is generally used to perform the overall operation of the computer device. In this embodiment, the memory 510 is used to store program codes or instructions, the program code includes computer operation instructions, and the processor 520 is used to execute the program codes or instructions stored in the memory 510 or process data, such as running the program code of the above method.

[0115] In this article, the bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus system can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0116] Another embodiment of the present application also provides a computer-readable medium, which may be a computer-readable signal medium or a computer-readable medium. A processor in a computer reads a computer-readable program code stored in the computer-readable medium, so that the processor can execute the functional actions specified in each step or a combination of steps in the above method; and generate a device for implementing the functional actions specified in each block or a combination of blocks in the block diagram.

[0117] Computer-readable media include but are not limited to electronic, magnetic, optical, electromagnetic, infrared memory or semiconductor systems, devices or apparatuses, or any appropriate combination of the foregoing, the memory is used to store program codes or instructions, the program codes include computer operating instructions, and the processor is used to execute the program codes or instructions of the above methods stored in the memory.

[0118] For the definitions of memory and processor, please refer to the description of the aforementioned computer device embodiment and will not be repeated here.

[0119] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0120] Each functional unit or module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0121] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.

[0122] In the claims, any reference symbols placed between brackets shall not be construed as limiting the claims. The word "comprising" described in the present application does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application can be implemented with the aid of hardware comprising several different elements and with the aid of a suitably programmed computer. In a unit claim that lists a number of devices, several units of these devices may be embodied by the same hardware item. The use of first, second, and third, etc. does not indicate any order, and these words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.

[0123] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A real-time communication system for PLC instructions in a virtual environment, It is characterized in that include: Instruction cache module, resource binding module, instruction forwarding module and transmission path optimization module; The instruction cache module is used to store the generated virtual PLC instruction in the real-time operation space, and send the virtual PLC instruction stored in the real-time operation space to the instruction forwarding module when the virtual PLC instruction meets the instruction sending condition, and the real-time operation space is obtained by dividing the virtual operating system; The resource binding module is used to bind the resource mapping relationship between the virtual machine corresponding to the virtual operating system and the host machine, so that the instruction forwarding module forwards the virtual PLC instruction based on the data transmission resources of the host machine; The instruction forwarding module is used to receive the virtual PLC instruction sent by the instruction cache module, and forward the virtual PLC instruction to the transmission path optimization module based on the data transmission resources of the host machine; The transmission path optimization module is used to receive the virtual PLC instruction forwarded by the instruction forwarding module, and optimize the instruction transmission path to transmit the virtual PLC instruction to the industrial control device based on the instruction transmission path.

2. The system according to claim 1, It is characterized in that The instruction forwarding module includes: a task processing unit, a real-time scheduling unit, a message queue and a first-in first-out unit; The task processing unit is used to receive the virtual PLC instruction sent by the instruction cache module; The real-time scheduling unit is used to perform task scheduling on the virtual PLC instruction and send the virtual PLC instruction to the message queue based on the scheduling result; The message queue is used to store the virtual PLC instruction at a target location based on the sending time of the virtual PLC instruction; The first-in first-out unit is used to forward the virtual PLC instruction to the transmission path optimization module based on the data transmission resources of the host machine when detecting that the current message sending position is the target position.

3. The system according to claim 2, It is characterized in that The real-time scheduling unit is specifically used for: Acquire the domain space type to which the virtual PLC instruction belongs, where the domain space type includes: a first system operation class and a second system operation class; Based on the priority level of the domain space type to which the virtual PLC instruction belongs, the virtual PLC instruction is task scheduled, and the task scheduling is used to describe the storage order of the virtual PLC instructions determined based on the priority level of the domain space type to which the virtual PLC instruction belongs.

4. The system according to claim 1, It is characterized in that The transmission path optimization module includes: an instruction transfer interface, a network bridge and a switch controller; The instruction transfer interface is used to receive the virtual PLC instruction forwarded by the instruction forwarding module and send the virtual PLC instruction to the bridge; The network bridge is used to send the virtual PLC instruction to the switch controller through the DPDK PMD component; The switch controller is used to optimize the instruction transmission path and transmit the virtual PLC instruction to the industrial control device based on the instruction transmission path.

5. The system according to claim 1, It is characterized in that Also includes: a rule update module; The rule updating module is used to perform at least one of the following rule processing operations on the security group rule corresponding to the virtual operating system in response to a user rule operation request: Add security group rules, delete security group rules, search security group rules, and modify security group rules.

6. The system according to claim 2, It is characterized in that The instruction forwarding module further includes: a memory sharing unit, the memory sharing unit being connected to the message queue; The memory sharing unit is used to store the virtual control instructions in the message queue and share the stored virtual control instructions in the message queue in response to a process asynchronous access request.

7. The system according to claim 6, It is characterized in that The instruction forwarding module further includes: a queue management unit, the queue management unit being connected to the message queue; The queue management unit is used to perform security rule constraints on the virtual control instructions stored in the message queue based on the security group rules corresponding to the virtual operating system to obtain virtual control instructions that meet the security rule constraints, and send the virtual control instructions that meet the security rule constraints to the message queue; The message queue is further used to update the stored virtual control instructions based on the virtual control instructions that meet the security rule constraints.

8. A real-time communication method for PLC instructions in a virtual environment, It is characterized in that include: The generated virtual PLC instructions are stored in a real-time operation space, where the real-time operation space is obtained by dividing the virtual operating system; Optimize instruction transmission path; The virtual PLC instruction is read from the real-time operation space, and the virtual PLC instruction is transmitted to the industrial control device based on the instruction transmission path.

9. A real-time communication device for PLC instructions in a virtual environment, It is characterized in that include: A storage module, used for storing the generated virtual PLC instructions in a real-time operation space, wherein the real-time operation space is obtained by dividing the virtual operating system; An optimization module, used to optimize the instruction transmission path; A transmission module is used to read the virtual PLC instruction from the real-time operation space and transmit the virtual PLC instruction to the industrial control device based on the instruction transmission path.

10. A computer device, It is characterized in that The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the method for real-time communication of PLC instructions in a virtual environment as claimed in claim 8 is implemented.

Citation Information

Patent Citations

  • Monitoring and reconstruction methods of software-defined PLC (Programmable Logic Controller) and devices

    CN109240197A

  • Method and apparatus for forwarding data of virtual switching device, and computer device

    CN109379269A

  • Data forwarding method of virtual switch based on hybrid virtual network bridge and device thereof

    CN112769716A

  • Real-time scheduling method based on soft PLC

    CN114755991A

  • Virtualization system operation method and device, equipment and medium

    CN115344352A