High time accuracy sequential instruction output method for loosely coupled soft PLC

By employing master-slave communication and interrupt communication methods in loosely coupled soft PLCs, the problem of uncertain instruction execution time intervals in loosely coupled soft PLCs is solved, achieving sequential instruction output with high time accuracy, which is suitable for various large-scale distributed control systems.

CN117311251BActive Publication Date: 2026-06-09NORTHWEST INST OF NUCLEAR TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NORTHWEST INST OF NUCLEAR TECH
Filing Date
2023-09-05
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

In large-scale distributed control systems, existing loosely coupled soft PLCs exhibit excessively large fluctuations in the time interval between the execution of two adjacent instructions, causing the output terminals to fail to execute specific instructions precisely according to the predetermined time sequence.

Method used

It adopts a loosely coupled soft PLC design mode, with master-slave communication between the CPU module and the I/O module, and interrupt communication between the communication process and the control logic process. Combined with complex communication protocols such as Modbus, EtherCAT or CAN, it can achieve high-time-precision sequential instruction output.

Benefits of technology

It improves the sequential instruction output accuracy of loosely coupled soft PLCs, reduces timing jitter, enhances real-time performance and scalability, lowers costs, and is suitable for various large-scale distributed control systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117311251B_ABST
    Figure CN117311251B_ABST
Patent Text Reader

Abstract

The application discloses a high time precision sequential instruction output method of a loosely coupled soft PLC, and aims at solving the problem that the time interval of two adjacent instructions is too large, and the output terminals distributed in each control node cannot accurately execute specific instructions according to a predetermined time sequence in many large distributed control systems. The method comprises the following steps: 1, a control logic process in a CPU module adopts a loop execution mode, and each loop is executed in sequence; 2, after each output terminal receives an output state of an I / O image area, an interrupt communication mode is adopted to trigger an interrupt service program of a communication process of the CPU module, and the communication process is responsible for realizing master-slave communication between the CPU module and each I / O module of a backboard; and 3, each output module of the soft PLC and the CPU module also adopt the interrupt communication mode to realize final output of control instructions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to programmable logic controllers (PLCs), and more specifically to a method for outputting sequential instructions with high time precision in a loosely coupled soft PLC. Background Technology

[0002] Programmable logic controllers (PLCs) are widely used in industries such as machinery, petroleum, wind power, hydropower, defense, and transportation, playing a crucial role in industrial automation. PLCs can be divided into hardware PLCs and software PLCs. Hardware PLCs typically consist of a CPU, memory, and I / O system. During operation, the CPU operates in a single-threaded mode, periodically performing self-diagnosis, communication, input sampling, user program execution, and I / O refresh. Software PLCs generally adopt a design pattern of a general-purpose processor + a general-purpose embedded real-time operating system. Utilizing the multi-tasking control capabilities provided by the operating system, they quickly process I / O data, thereby realizing the various functions of a hardware PLC. Compared to hardware PLCs, software PLCs adopt a more open architecture, have stronger network communication capabilities, more complete control functions, and stronger I / O expansion capabilities, making them a key development direction for future PLC controllers. However, due to the inherent uncertainty in the multi-tasking scheduling process of the real-time operating system in software PLCs, the real-time performance and execution accuracy of control instructions are slightly inferior to those of hardware PLCs.

[0003] In many large-scale distributed control systems (such as wind power, hydropower, transportation, motion control systems, etc.), it is often required that the output terminals distributed at each control node can accurately execute specific instructions according to a predetermined time sequence, and the fluctuation range of the execution time interval between two adjacent instructions should be as small as possible, but existing methods cannot meet the requirements. Summary of the Invention

[0004] The purpose of this invention is to provide a high-time-precision sequential instruction output method for loosely coupled soft PLCs, in order to solve the technical problem that in many large-scale distributed control systems, the time interval between the execution of two adjacent instructions fluctuates too much, causing the output terminals distributed at various control nodes to be unable to execute specific instructions accurately according to a predetermined time sequence.

[0005] To achieve the above objectives, this invention provides a high-time-precision sequential instruction output method for loosely coupled soft PLCs. The CPU module in the soft PLC includes a control logic process and a communication process. The CPU module communicates with each I / O module on the backplane using a master-slave communication method. The CPU module's communication process acts as the master station, and each I / O module acts as a slave station. Its unique feature lies in the following steps:

[0006] Step 1: The control logic process in the CPU module adopts a loop execution mode, and the following steps are executed sequentially within each loop:

[0007] 1.1 Input sampling process: Scan the status and data of each input module on site and store them in the I / O image area;

[0008] 1.2 Control program execution process: Sequentially parse each instruction in the user program and store the calculation results in the I / O image area;

[0009] 1.3 Output refresh process: The output status of the I / O image area is transmitted to each output terminal;

[0010] Step 2: After each output terminal receives the output status of the I / O image area, it triggers the CPU module's communication process to execute the interrupt service routine using interrupt communication. The communication process is responsible for implementing master-slave communication between the CPU module and each I / O module on the backplane. The execution process of the communication process each time is as follows:

[0011] 2.1 Configure communication master and slave information: Based on the network topology of the soft PLC, assign an independent ID to each I / O module and establish the communication protocol between the communication master and the communication slave; the communication slave includes multiple output modules;

[0012] 2.2 The communication master station is responsible for packaging control commands, communication data, and communication addresses into communication data packets according to the aforementioned communication protocol;

[0013] 2.3 The communication master station distributes the packaged communication data packets to the corresponding IDs of each I / O module via the backplane bus;

[0014] Step 3: The output modules of the soft PLC and the CPU module also use interrupt communication to achieve the final output of control instructions. The execution process is as follows:

[0015] 3.1 Each output module of the soft PLC monitors in real time whether there are communication data packets distributed to the corresponding ID on the backplane bus;

[0016] 3.2 When the output module receives a communication data packet, it splits and parses the communication data packet according to the communication protocol, separating the control command, communication data and communication address;

[0017] 3.3 The output module writes the parsed and acquired communication data to the corresponding communication address and completes the isolated output of control commands.

[0018] Furthermore, the soft PLC adopts a design pattern of general-purpose processor + general-purpose embedded real-time operating system, and its logic control function supports the parallel execution of multiple tasks.

[0019] Furthermore, the processor of the soft PLC is either single-core or multi-core.

[0020] Furthermore, in step 2.1, the communication protocol is Modbus, EtherCAT, or CAN, etc.

[0021] Furthermore, the CPU module and the I / O module are loosely coupled.

[0022] Furthermore, socket communication is used between the communication process responsible for communication between the controller and the host computer and the communication process responsible for internal communication within the controller, as well as between the communication process responsible for communication between the controller and the host computer and the control logic process responsible for executing the user program.

[0023] The beneficial effects of this invention are:

[0024] 1. The high-time-precision sequential instruction output method for loosely coupled soft PLCs proposed in this invention, without changing the hardware architecture of the PLC control system, effectively improves the sequential instruction output accuracy of various types of loosely coupled soft PLCs by using interrupt communication between the communication process of the CPU module and the control logic process, as well as between the communication process (communication master station) and each I / O module (communication slave station). It features high real-time performance, strong portability, and low cost.

[0025] 2. This invention effectively avoids the impact of the uncertainty of the internal communication process of the CPU module and the polling cycle time of the I / O module (communication slave station) on the accuracy of sequential instruction output. This method has no restrictions or constraints on the number and scale of I / O modules and the type of internal communication protocol of the PLC system, and has good scalability.

[0026] 3. This invention utilizes the interrupt mechanism of the CPU module and each I / O module within the soft PLC to effectively improve the timing certainty of inter-process communication within the CPU and master-slave communication between the CPU module and the I / O module, achieving high-time-precision output of sequential instructions. It does not require modification of the existing PLC control system hardware structure, has low modification costs, strong system compatibility, and is suitable for various loosely coupled soft PLC control systems.

[0027] 4. Compared with hardware PLCs that use dedicated SoCs and real-time running software, software PLCs have better product versatility and compatibility, lower production costs, and shorter development cycles.

[0028] 5. In this invention, the logic control task of the CPU module and the underlying communication task of the controller are handled by two separate processes. In commercially available soft PLCs of this type, the communication process and the logic control process generally achieve inter-process communication through shared memory. Assuming the polling cycle of the communication process is ΔT, the time jitter of the output of two sequential instructions with a time interval of δS is -ΔT to +ΔT. The actual output interval of two adjacent instructions is δS-ΔT to δS+ΔT. In this invention, the communication process and the logic control process adopt an interrupt communication method. For two output instructions with adjacent fixed time intervals, the interrupt delay time of each instruction within the communication process is approximately the same. Therefore, the time jitter of the two instructions is approximately 0, which effectively improves the certainty of the sequential instruction output time interval.

[0029] 6. In order to improve the scalability of the soft PLC, the I / O module and the CPU module adopt a loosely coupled connection method. The communication process of the CPU and each I / O module adopts a relatively complex communication protocol (such as Modbus, EtherCAT or CAN bus, etc.), which supports a master-slave communication mode. There are no restrictions or constraints on the number, scale and type of I / O modules, and it can be applied to various types of large-scale distributed control systems.

[0030] 7. Existing communication slave stations of various soft PLCs generally adopt a periodic polling mode, scanning and parsing data packets on the bus according to a fixed period ΔP. For two sequential instructions with an internal PLC time interval of δS, the jitter range of instruction output time caused by the slave station's periodic polling is -ΔP to +ΔP. The actual output interval range of two adjacent instructions is δS-ΔP to δS+ΔP. In this invention, the communication master station and each communication slave station adopt an interrupt communication mode. When the communication slave station detects a data packet sent to it on the bus, it immediately executes the interrupt service routine. For two adjacent output instructions with a fixed time interval, the interrupt delay time of each instruction within the communication slave station is approximately the same. Therefore, the time jitter of the two instructions is approximately 0, further improving the certainty of the sequential instruction output time interval. Attached Figure Description

[0031] Figure 1 This is a schematic diagram of the hardware structure of a loosely coupled soft PLC control system;

[0032] Figure 2 This is a schematic diagram of the software architecture of a loosely coupled soft PLC control system;

[0033] Figure 3 This is a schematic diagram of the optimization algorithm for a loosely coupled soft PLC control system. Detailed Implementation

[0034] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0035] See Figure 1 The loosely coupled soft PLC hardware structure is handled by the team responsible for configuration monitoring and programming development. Figure 1 The system consists of a host computer for logic development tasks and a PLC controller responsible for controlling program execution and driving field actuators. The PLC controller employs a design pattern of a general-purpose processor and a general-purpose embedded real-time operating system. (See [link to relevant documentation]). Figure 2 The PLC's CPU module utilizes the multi-tasking control capabilities provided by the operating system to break down control tasks into multiple processes for parallel execution, mainly including:

[0036] (1) Responsible for the communication process between the controller and the host computer;

[0037] (2) Responsible for the communication process within the controller;

[0038] (3) The control logic process responsible for the execution of user programs;

[0039] The real-time requirements between processes (1) and (2) and between processes (1) and (3) are not high, so socket communication is used. In order to improve the accuracy of the control system instruction output, interrupt communication is used between processes (2) and (3) in this example. At the same time, interrupt communication is also used between the CPU module and the I / O module of the PLC.

[0040] The communication method between the CPU module and the I / O module is master-slave communication, supporting one master and multiple slaves. The communication process (2) of the CPU module is responsible for implementing the communication function of the master station, and each I / O module is responsible for implementing the communication function of the slave station. The specific steps are as follows:

[0041] Step 1: See Figure 3 The control logic process in the CPU module adopts a loop execution mode, and the following steps are executed sequentially within each loop:

[0042] (1) Input sampling process: Scan the status and data of each input module on site and store them in the I / O image area;

[0043] (2) Control program execution process: sequentially parse each instruction in the user program and store the calculation results in the data register or I / O image area;

[0044] (3) Output refresh process: The output status of the I / O image area is transmitted to each output terminal;

[0045] Step 2: See Figure 3 When the control logic process of the CPU module completes the output refresh process, it uses interrupt communication to trigger the communication process of the CPU module to execute the interrupt service routine. The communication process is responsible for implementing master-slave communication between the CPU module and other I / O modules on the backplane. The execution process of the communication process is as follows:

[0046] (1) Configure communication master station and communication slave station information: According to the network topology of PLC, assign an independent ID to each I / O module communication slave station, and establish the communication protocol between the communication master station and the communication slave station (such as Modbus, EtherCAT or CAN, etc.);

[0047] (2) In accordance with the prescribed communication protocol, the communication master station is responsible for packaging control commands, communication data, and communication addresses into data packets;

[0048] (3) The communication master station distributes the packaged communication data packets to each I / O module through the backplane bus;

[0049] Step 3: See Figure 3 The PLC's output module, like the CPU module, uses interrupt communication to achieve the final output of instructions. The execution process is as follows:

[0050] (1) Each output module (communication slave) of the PLC can monitor in real time whether there are communication data packets distributed to the corresponding ID on the backplane bus;

[0051] (2) When the output module receives a communication data packet sent to itself, it splits and parses the data packet according to the communication protocol to separate the control command, communication data and communication address;

[0052] (3) The output module writes the parsed communication data to the corresponding communication address and completes the isolated output of control instructions.

[0053] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present invention should be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for high-time-precision sequential instruction output in a loosely coupled soft PLC, wherein the CPU module of the soft PLC includes a control logic process and a communication process, the communication process including a communication process between the controller and a host computer and an internal communication process within the controller; the CPU module and each I / O module on the backplane use a master-slave communication method, the CPU module's communication process is the communication master station, and each I / O module is the communication slave station; characterized by comprising the following steps: Step 1: The control logic process in the CPU module adopts a loop execution mode, and the following steps are executed sequentially within each loop: 1.1 Input sampling process: Scan the status and data of each input module on site and store them in the I / O image area; 1.2 Control program execution process: Sequentially parse each instruction in the user program and store the calculation results in the I / O image area; 1.3 Output refresh process: The output status of the I / O image area is transmitted to each output terminal; Step 2: After each output terminal receives the output status of the I / O image area, it triggers the CPU module's communication process to execute the interrupt service routine using interrupt communication. The communication process is responsible for implementing master-slave communication between the CPU module and each I / O module on the backplane. The execution process of the communication process each time is as follows: 2.1 Configure communication master and slave information: Based on the network topology of the soft PLC, assign an independent ID to each I / O module and establish the communication protocol between the communication master and the communication slave; the communication slave includes multiple output modules; 2.2 The communication master station is responsible for packaging control commands, communication data, and communication addresses into communication data packets according to the aforementioned communication protocol; 2.3 The communication master station distributes the packaged communication data packets to the corresponding IDs of each I / O module via the backplane bus; Step 3: The output modules of the soft PLC and the CPU module also use interrupt communication to achieve the final output of control instructions. The execution process is as follows: 3.1 Each output module of the soft PLC monitors in real time whether there are communication data packets distributed to the corresponding ID on the backplane bus; 3.2 When the output module receives a communication data packet, it splits and parses the communication data packet according to the communication protocol, separating the control command, communication data and communication address; 3.3 The output module writes the parsed and acquired communication data to the corresponding communication address and completes the isolated output of control commands; Socket communication is used between the communication process responsible for communication between the controller and the host computer and the communication process responsible for internal communication within the controller, as well as between the communication process responsible for communication between the controller and the host computer and the control logic process responsible for executing the user program; interrupt-enabled communication is used between the control logic process responsible for executing the user program and the communication process responsible for internal communication within the controller.

2. The high-time-precision sequential instruction output method of loosely coupled soft PLC according to claim 1, characterized in that: the soft PLC adopts a design mode of general-purpose processor + general-purpose embedded real-time operating system, and its logic control function supports multi-task parallel execution.

3. The high-time-precision sequential instruction output method for loosely coupled soft PLC according to claim 1 or 2, characterized in that: The processor of the soft PLC can be single-core or multi-core.

4. The high-time-precision sequential instruction output method for loosely coupled soft PLC according to claim 3, characterized in that: In step 2.1, the communication protocol is Modbus, EtherCAT, or CAN bus.

5. The high-time-precision sequential instruction output method for loosely coupled soft PLC according to claim 3, characterized in that: The CPU module and the I / O module are loosely coupled.