Programmable controller based on logic separation and data processing method thereof

By adopting a programmable controller design based on logic separation in PLC, separating communication cores and logic cores, and using mechanisms such as hardware locks and inter-core interrupts, the problem of excessive CPU resource occupancy caused by irregular user programs in traditional PLCs is solved, and communication stability and I/O response performance are improved.

CN120233735APending Publication Date: 2025-07-01CHENGDU SHUZI AUTOMATION TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510380478.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-28
Publication Date
2025-07-01

AI Technical Summary

Technical Problem

The irregularity and uncertainty of user programs of traditional PLCs may lead to excessive CPU resource occupancy, affecting the normal execution of communication tasks, and causing equipment to be disconnected.

Method used

The programmable controller based on logic separation is adopted. Through the separation design of communication cores and logic cores, communication tasks and I/O business logic are handled separately, and mechanisms such as hardware locks and inter-core interrupts are used to improve the efficiency and stability of data processing.

Benefits of technology

It improves the stability and reliability of the programmable controller to external communication, reduces the jitter of I/O tasks, and enhances the stability of internal communication in the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120233735A_ABST
    Figure CN120233735A_ABST
Patent Text Reader

Abstract

The invention discloses a data processing method of a programmable controller based on logic separation, which comprises the following steps: a communication core sends a data updating request to a logic core, and the data type is an IO type and a control type; when the data type is an IO type, judging whether the state of the hardware lock is an open state or a closed state; if so, executing data reading or data writing according to the data operation type; if the state is closed, the updating is skipped to the next period for updating; when the data type is a control type, defining the data of the control type as high-priority data, and waiting for response after the communication core sends a data request event through inter-core interruption; a logic core high-priority task is awakened, a response task is executed according to a request event type, response data is copied to a shared data area, and a response completion event is sent through inter-core interruption; and the communication core reads the response data. According to the method, the stability and reliability of external communication of the programmable controller are improved, and meanwhile, the I / O response performance of equipment is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of industrial automation technology, and particularly relates to a programmable logic controller based on logical separation and its data processing method. Background Art

[0002] The traditional PLC software architecture usually adopts the structure of a main program and subprograms. The main program contains instructions for control applications, while the subprograms are used to encapsulate relatively independent code for functional implementation to achieve modular design. The CPU executes the instructions in the main program sequentially, once per scan cycle, starts the execution of the subprogram by calling an instruction (CALL), and returns to the main program using a return instruction (RET) after the subprogram execution is completed.

[0003] In addition to the execution of the user program, the PLC is usually also responsible for maintaining one or more industrial communication protocols. Generally, the communication tasks are bound to the user program, but are divided into multiple rtos tasks or threads. Due to the non-standard and uncertain nature of the user program, it may cause the user program (I / O logic) to occupy too much CPU resources, resulting in the communication tasks being unable to execute normally and the device going offline. Summary of the Invention

[0004] The purpose of the present invention is to provide a programmable logic controller based on logical separation and its data processing method, which improves the stability and reliability of external communication of the programmable logic controller, and at the same time improves the I / O response performance of the device.

[0005] The present invention is achieved through the following technical solutions:

[0006] In a first aspect, a data processing method for a programmable logic controller based on logical separation provided by an embodiment of the present invention includes the following steps:

[0007] The communication core sends a data update request to the logic core, and the data types are IO type and control type;

[0008] When the data type is the IO type, determine whether the status of the hardware lock is open or closed;

[0009] If it is in the open state, read or write data according to the data operation type;

[0010] If it is in the closed state, skip the update and wait for the next cycle for update;

[0011] When the data type is the control type, define the control type data as high-priority data, and the communication core waits for a response after sending a data request event through an inter-core interrupt;

[0012] The high-priority task of the logical core is awakened, the response task is executed according to the request event type, and the response data is copied to the shared data area, and the response completion event is sent through the inter-core interrupt;

[0013] The communication core reads the response data.

[0014] Further, the specific method for writing data includes:

[0015] Update the data in the shared area and set the corresponding data type update flag;

[0016] After the data update is completed, an update event is sent to the logical core through the inter-core interrupt method.

[0017] Further, the method further includes: The logical core communicates with the extended I / O module through the dual backplane bus redundant channel.

[0018] Further, the specific method for the logical core to communicate with the extended I / O module through the backplane bus redundant channel includes:

[0019] The logical core sets the default channel to transmit data;

[0020] If the data transmission on the default channel is successful, the current channel switch is executed;

[0021] If the data transmission on the default channel fails or the heartbeat times out, the current channel switch is executed, and the number of times the default channel transmission fails is recorded;

[0022] Judge whether the number of transmission failures reaches the preset threshold;

[0023] If so, perform a fault recovery operation on the default channel;

[0024] If not, execute the current channel switch.

[0025] Further, when the data type is the control type, the communication core is used as the client and the logical core is used as the server.

[0026] Further, the priority of the response task is higher than that of all user I / O logical tasks.

[0027] In a second aspect, a programmable controller based on logical separation provided by an embodiment of the present invention includes a communication core and a logical core. The communication core is used to send a data update request to the logical core, and the data types are IO type and control type. When the data type is the IO type, it is judged whether the state of the hardware lock is the open state or the closed state. If it is the open state, read data or write data is executed according to the data operation type. If it is the closed state, the update is skipped and waited until the next cycle for update. When the data type is the control type, the control type data is defined as high-priority data, and the communication core waits for a response after sending a data request event through the inter-core interrupt;

[0028] The high-priority task of the logic core is awakened, executes the response task according to the request event type, copies the response data to the shared data area, and sends a response completion event through an inter-core interrupt;

[0029] The communication core reads the response data.

[0030] Furthermore, the communication core includes a data writing module, which is used to update the data in the shared area, set the corresponding data type update flag, and send an update event to the logic core through an inter-core interrupt after the data update is completed.

[0031] Furthermore, it also includes a redundant channel, which is used to implement data communication between the logic core and the extended I / O module.

[0032] Furthermore, when the data type is a control type, the communication core is used as the client and the logic core is used as the server.

[0033] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0034] (1) Improve the external communication response speed: The communication core is dedicated to the maintenance of various communication tasks. After receiving a remote data request, it immediately makes a response according to the protocol requirements. The response delay is stable and will not be affected by user programs with high uncertainty.

[0035] (2) Reduce the jitter of I / O tasks: Avoid the delay generated during communication from being transmitted to user I / O tasks and causing task jitter.

[0036] (3) Improve the internal communication stability of the system: Based on redundant dual-channel communication, ensure the reliability of the extended I / O module. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the following will briefly introduce the drawings required in the embodiments. It should be understood that the following drawings only show some embodiments of the present invention, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings. In the drawings:

[0038] Figure 1 It is a flowchart of a processing method of a programmable controller based on logic separation provided by the first embodiment of the present invention;

[0039] Figure 2 It is a flowchart of communication through a dual-backplane bus redundant channel in the first embodiment of the present invention;

[0040] Figure 3 A structural schematic diagram of a programmable controller based on logical separation provided by another embodiment of the present invention. Detailed implementation manners

[0041] To make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the embodiments and the accompanying drawings. The illustrative embodiments and descriptions thereof of the present invention are only used to explain the present invention and are not intended to limit the present invention.

[0042] Embodiment 1

[0043] As Figure 1 shown, a data processing method of a programmable controller based on logical separation provided by the first embodiment of the present invention includes the following steps:

[0044] The communication core sends a data update request to the logic core. The data is divided into IO type and control type. When the data type is IO type, it is judged whether the state of the hardware lock is open or closed;

[0045] If it is in the open state, read data or write data is performed according to the data operation type;

[0046] If it is in the closed state, the update is skipped and waited until the next cycle for update;

[0047] When the data type is control type, the control type data is defined as high-priority data. After the communication core sends a data request event through an inter-core interrupt, it waits for a response;

[0048] The high-priority task of the logic core is awakened, the response task is executed according to the request event type, and the response data is copied to the shared data area, and a response completion event is sent through an inter-core interrupt;

[0049] The communication core reads the response data.

[0050] The communication core has an independent data buffer, and external data requests do not distinguish types. The communication core usually performs periodic data updates and immediately returns the requested data after receiving a remote data request sent by other devices. The IO type and control type data are only for dividing the data exchanged between the communication core and the logic core.

[0051] Among them, the specific method of writing data includes:

[0052] Update the data in the shared area and set the corresponding data type update flag;

[0053] After the data update is completed, an update event is sent to the logic core through an inter-core interrupt method.

[0054] In this embodiment, logical separation is adopted: mainly decoupling the communication logic and the I / O service logic, and then introducing the multi-core collaborative processing technology. The two service logics are placed on independent physical cores respectively. The communication logic is placed on the communication core, and the I / O service logic is placed on the logic core. Fundamentally, the strong time-dependent relationship between the two is eliminated, thereby improving the stability of the controller communication module and the execution module. Adopting logical separation improves the determinacy of device communication latency: the industrial communication protocol stack is supported by the computing power provided by an independent CPU. When receiving a data response request, it can complete the response within a determined time without significant delay, ensuring that the devices on the network are stably online and preventing communication interruptions with devices due to complex and time-consuming control logic operations, providing a solid foundation for the automation and intelligence of the entire industrial system.

[0055] Adopt a unique data exchange method: The data between the communication core (Core A) and the logic core (Core B) is efficiently synchronized through a combination of shared memory, inter-core interrupt, and hardware lock, without causing dependencies in inter-core logic. The communication core sends a data update request to the logic core, judges the data type according to the request, and adopts different processing methods according to whether the data type is of the IO type or the control type.

[0056] (1) IO type data: A large amount of data frequently accessed by both cores is placed in the shared memory area, effectively reducing the latency caused by frequent memory copying. To achieve shared data synchronization between cores, a hardware lock is introduced to mutually exclusive protect the shared memory. Before Core A or Core B prepares to update the data in the shared memory, it needs to obtain the status of the hardware lock. If the hardware lock is in the closed state, the update is skipped and waited until the next cycle for update; if the hardware lock is in the open state, read or write data according to the operation type. If it is read data, the corresponding data type (Type A) data is read. If it is write data, the data in the shared area is updated, and the update flag of the corresponding data type (Type A) is set. After the data update is completed, the other core is notified to read the updated data (Type A) through the fastest way of inter-core interrupt. The data types without updates are ignored to improve efficiency. After receiving the update event, the logic core searches for the update flags of all data types, judges whether it is the Type A update flag. If so, it is set, and the logic core updates the data Type A; if not, it is reset, and returns to execute the step of the communication core receiving the data request.

[0057] (2) Control class data: Designed with a C / S architecture, Core A serves as the client and Core B serves as the server. The control class data is defined as high-priority data. Core A sends specific request events through inter-core interrupts and then waits for responses. Core B starts high-priority tasks. The high-priority tasks immediately respond upon receiving the request events, copy the response data to the shared data area, and then send a response completion event through inter-core interrupts. The response task priority in Core B is higher than all user I / O logic tasks. At the same time, both requests and responses are carried out in an interrupt manner, effectively avoiding control timeouts or even failures.

[0058] Adopting a unique data exchange method improves the working efficiency of the controller: The traditional inter-core synchronization methods are single, directly using message queues or shared memory, which are significantly weaker in terms of timeliness and synchronization efficiency. By adopting a unique inter-core data exchange method (combining inter-core interrupts, shared memory, and hardware locks), the inter-core dependencies are reduced, and the synchronization of various data between the two cores after the separation of business logic is efficiently completed.

[0059] As Figure 2 shown, a data processing method for a programmable controller based on logical separation provided by an embodiment of the present invention further includes: The logical core communicates with the extended I / O module through a dual-backplane bus redundant channel, specifically including:

[0060] The logical core sets the default channel to transmit data;

[0061] If the data transmission on the default channel is successful, the current channel switch is executed;

[0062] If the data transmission on the default channel fails or the heartbeat times out, the current channel switch is executed, and the number of times the data transmission on the default channel fails is recorded;

[0063] It is judged whether the number of times of transmission failure reaches a preset threshold;

[0064] If so, a fault recovery operation is performed on the default channel;

[0065] If not, the current channel switch is executed.

[0066] Specifically, the controller defaults to using Channel A for communication. If the data transmission on Channel A is successful, then the transmission channel is switched to Channel B to complete the next transmission, realizing dynamic load balancing. If the data transmission on Channel A fails or the heartbeat times out, then the transmission is switched to Channel B, and the number of times the data transmission on Channel A fails is recorded. When the number of times the data transmission on Channel A fails reaches the pre-trial threshold, a fault recovery operation is performed on Channel A. If the number of times of failure does not reach the preset threshold, the transmission is switched to Channel B. If the default channel is Channel B, the same method is adopted and will not be elaborated here.

[0067] The communication between the logic core and the extended I / O module through the redundant channels of the dual backplane bus improves the effectiveness of the local control of the controller. The local I / O dual-channel abnormal switching mechanism ensures that the failure of a certain channel will not cause the control of the entire controller to fail, reduces the downtime, and significantly improves the fault tolerance of the industrial system; the dual-channel normal switching mechanism reduces the load of a single bus and improves the tolerance for a large amount of burst data transmission.

[0068] The data processing method of the programmable controller based on logic separation provided by the embodiments of the present invention has the following benefits:

[0069] 1. Improve the external communication response speed: The communication core is responsible for maintaining various communication tasks and immediately responds according to the protocol requirements after receiving a remote data request. The response delay is stable and will not be affected by the user program with high uncertainty.

[0070] 2. Reduce the I / O task jitter: Avoid the delay generated during the communication from being transmitted to the user I / O task and causing task jitter.

[0071] 3. Improve the internal communication stability of the system: The communication based on the redundant dual channels ensures the reliability of the extended I / O module.

[0072] As Figure 3 shown, a programmable controller based on logic separation provided by the embodiments of the present invention includes a communication core and a logic core. The communication core sends a data update request to the logic core, and the data types are IO type and control type. When the data is of IO type, it is judged whether the state of the hardware lock is open or closed. If it is in the open state, read data or write data is executed according to the data operation type. If it is in the closed state, the update is skipped and waited until the next cycle for update. When the data is of control type, the control type data is defined as high-priority data. After the communication core sends a data request event through the inter-core interrupt, it waits for a response;

[0073] The high-priority task of the logic core is awakened, the response task is executed according to the request event type, and the response data is copied to the shared data area, and a response completion event is sent through the inter-core interrupt;

[0074] The communication core reads the response data.

[0075] The communication core includes a write data module, which is used to update the data in the shared area, set the corresponding data type update flag, and send an update event to the logic core through the inter-core interrupt after the data update is completed.

[0076] The programmable controller based on logical separation in the embodiment of the present invention further includes a redundant channel, which is used to realize data communication between the logic core and the expansion I / O module. The data type is the control type, with the communication core as the client and the logic core as the server.

[0077] In this embodiment, for the programmable controller hardware, a microprocessor with a dual-core architecture based on ARM Cortex-M7 + Cortex-M4 is used as the main control chip. For the communication protocol selection, four common industrial communication protocols are supported, including Modbus RTU / TCP, CANOpen, and EtherCAT. For the controller standard, the IEC61131-3 standard is supported.

[0078] For the software architecture design: First step, according to the IEC61131-3 specification, define the data structures of the corresponding communication and I / O logic; Second step, define the inter-core data interaction interface and the interaction method to ensure independence and no dependencies; Third step: Implement the runtime that complies with the IEC61131-3 standard. Run the Modbus R / T, CANOpen, and EhterCAT communication protocol stacks on the M7 side, and run the I / O logic on the M4 side; Fourth step: Implement the process data interaction between the dual-channel backplane bus and the expansion I / O on the M4 side.

[0079] For the test verification: Configure the above 4 communication protocols through the IDE software that communicates with the PLC on the computer, and create a new POU program to perform a large number of analog and digital quantity calculation operations, pull the M4 load to 100%, and then test the response performance of the 4 communications.

[0080] A programmable controller based on logical separation provided by the embodiment of the present invention has the following benefits:

[0081] 1. Improve the external communication response speed: The communication core is responsible for maintaining various communication tasks, and immediately makes a response according to the protocol requirements after receiving a remote data request. The response delay is stable and will not be affected by the user program with high uncertainty.

[0082] 2. Reduce the user task jitter: Avoid the response timeout and delay generated during the communication from being transmitted to the user task and causing task jitter.

[0083] 3. Improve the internal communication stability of the system: Based on the redundant dual-channel communication, the reliability of the communication between the programmable controller and the expansion I / O module is improved.

[0084] The specific embodiments described above have further elaborated on the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only the specific embodiments of the present invention and is not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A data processing method of a programmable controller based on logic separation, characterized in that: The following steps are involved: The communication core sends a data update request to the logic core, and the data type is IO type and control type; When the data type is IO type, determine whether the state of the hardware lock is open or closed; If it is in the open state, read data or write data according to the data operation type; If it is closed, skip the update and wait until the next cycle to update; When the data type is control type, the control type data is defined as high priority data, and the communication core waits for a response after sending a data request event through an inter-core interrupt; The high-priority task of the logical core is awakened, and the response task is executed according to the request event type, and the response data is copied to the shared data area, and the response completion event is sent through the inter-core interrupt; The communication core reads the response data.

2. The data processing method based on a programmable controller with logic separation as claimed in claim 1, characterized in that: The specific method of writing data includes: Update the data in the shared area and set the corresponding data type update flag; After the data update is completed, the update event is sent to the logical core through the inter-core interrupt method.

3. The data processing method based on a programmable controller with logic separation as claimed in claim 1, characterized in that: The method further includes: the logic core and the extended I / O module communicate with each other through a dual backplane bus redundant channel.

4. The data processing method of a programmable controller based on logic separation as claimed in claim 3, characterized in that: The specific method for communicating between the logic core and the extended I / O module through the backplane bus redundant channel includes: The logic core sets the default channel to transmit data; If the default channel data is sent successfully, the current channel is switched; If the default channel fails to send or the heartbeat times out, the current channel will be switched and the number of default channel failures will be recorded; Determine whether the number of failed transmissions reaches a preset threshold; If yes, perform the failover operation on the default channel; If not, the current channel is switched.

5. The data processing method based on a programmable controller with logic separation as claimed in claim 1, characterized in that: The data type is a control type, with the communication core as the client and the logic core as the server.

6. The data processing method based on a programmable controller with logic separation as claimed in claim 1, characterized in that: The response task has a higher priority than all user I / O logic tasks.

7. A programmable controller based on logic separation, characterized in that: It includes a communication core and a logic core, wherein the communication core sends a data update request to the logic core, and the data type is an IO type and a control type; when the data type is an IO type, it is determined whether the state of the hardware lock is an open state or a closed state, and if it is an open state, it performs reading or writing data according to the data operation type, and if it is a closed state, it skips the update and waits for the next cycle to update, and when the data type is a control type, the control type data is defined as high priority data, and the communication core waits for a response after sending a data request event through an inter-core interrupt; The high priority task of the logic core is awakened, and the response task is executed according to the request event type, and the response data is copied to the shared data area, and the response completion event is sent through the inter-core interrupt; The communication core reads the response data.

8. The programmable controller based on logic separation as claimed in claim 7, characterized in that: The communication core includes a data writing module, which is used to update the data in the shared area and set the corresponding data type update flag. After the data update is completed, an update event is sent to the logic core through an inter-core interrupt.

9. The programmable controller based on logic separation as claimed in claim 7, characterized in that: It also includes a redundant channel, which is used to implement data communication between the logic core and the expansion I / O module.

10. The programmable controller based on logic separation as claimed in claim 7, characterized in that: The data type is a control type, with the communication core as the client and the logic core as the server.

Citation Information

Cited By

  • Agricultural machine open type multi-core controller and resource virtualization mapping method thereof

    CN122362973A