Qt-based EtherCAT master station system and multi-task scheduling method

By adopting Qt-based development method and multi-task scheduling method in the EtherCAT master system, the problems of high complexity, cumbersome scheduling and inconvenient interface development in traditional system development are solved, and an efficient, flexible and easy-to-maintenance industrial control system is realized. , meets the real-time, stability and user experience needs of modern industrial control systems.

CN119449893AActive Publication Date: 2025-02-14QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +2

Patent Information

Application Number
CN202411568604.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-05
Publication Date
2025-02-14
Estimated Expiration
2044-11-05

AI Technical Summary

Technical Problem

The development of traditional EtherCAT main site system has problems such as high system complexity, cumbersome task scheduling and inconvenient interface development, which is difficult to meet the requirements of modern industrial control systems for real-time, stability and user experience.

Method used

Using the Qt-based EtherCAT master station system, combining the cross-platform features of the Qt framework and rich graphical interface library, combined with the real-time performance of the EtherCAT protocol, a master station system that is efficient, flexible and easy to maintain is proposed, and a multi-task scheduling is proposed. Method: Ensure the operation stability of the highest priority task through multi-threading task, priority setting, event-driven, asynchronous operation and queue management.

Benefits of technology

It improves the development efficiency and system performance of the EtherCAT master system, meets the requirements of modern industrial control systems for real-time, stability and user experience, and realizes the system's efficiency, flexibility and easy maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119449893A_ABST
    Figure CN119449893A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of program control systems, and particularly relates to a Qt-based EtherCAT master station system and a multi-task scheduling method. The system comprises a man-machine interaction module, a task scheduling management module, an EtherCAT master station protocol stack function module, an XML slave station configuration file analysis module, a network port communication module and a serial port communication module. The man-machine interaction module comprises service real-time display and control, EtherCAT communication data online debugging, service basic configuration and modular debugging and system authentication; the task scheduling management module comprises a system working state management module, a complex business data processing module and a task scheduling module; the EtherCAT master station protocol stack function module comprises real-time data processing of a controlled object, business control logic management of a controlled slave station, an EtherCAT master station initialization process and business processing process interface implementation of the controlled object. The development efficiency and the system performance of the EtherCAT master station system are remarkably improved, and the requirements of a modern industrial control system for real-time performance, stability and user experience are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of program control systems, and more specifically, relates to a Qt-based EtherCAT master station system and a multi-task scheduling method. Background Art

[0002] In modern industrial automation systems, it is crucial to achieve efficient, stable and real-time control. As a high-performance real-time Ethernet communication protocol, EtherCAT (Ethernet for Control Automation Technology) is widely used in industrial automation control systems such as robot control, automated production lines, test and measurement equipment, etc. due to its low latency, high synchronization performance and high-speed data transmission capabilities.

[0003] At the same time, with the improvement of human-machine interface (HMI) and user experience requirements, it is particularly important to develop efficient and user-friendly user interfaces. Qt is a widely used cross-platform C++ application development framework. Due to its rich graphical interface library and flexible development tools, it is widely used in interface development for desktop applications, embedded systems and mobile devices.

[0004] Traditional EtherCAT master system development usually involves a combination of multiple technologies and tools, such as real-time operating system (RTOS) and dedicated hardware platform to achieve multi-task scheduling and control. However, this development method has the following problems:

[0005] 1. High system complexity: It requires the use of multiple development environments and tools, resulting in complex system architecture and high development and maintenance costs.

[0006] 2. Task scheduling is cumbersome: How to effectively schedule multiple tasks and manage resources while ensuring real-time performance is a major challenge.

[0007] 3. Inconvenient interface development: In traditional real-time system development, interface development is often a separate link, lacking close integration with the control system, resulting in low development efficiency.

[0008] Chinese patent document CN112486112A discloses an EtherCAT master station control system and a control method thereof, the method comprising: a master station controller of the EtherCAT master station control system, comprising: an EtherCAT master control system and an industrial control subsystem; the EtherCAT master control system is used to send control data of a slave station drive controller to the industrial control subsystem; the industrial control subsystem is used to receive and cache the control data sent by the EtherCAT master control system, and send the cached control data to the slave station drive controller; wherein the slave station drive controller receives the control data sent by the industrial control subsystem, and parses out corresponding control signals according to the control data to control the operation of the drive device module.

[0009] In view of this, the present invention proposes a Qt-based EtherCAT master station system and a multi-task scheduling method, which utilizes the cross-platform characteristics of the Qt framework and a rich graphical interface library, combined with the real-time performance of the EtherCAT protocol, to build an efficient, flexible and easy-to-maintain master station system. Summary of the invention

[0010] The present invention aims to overcome at least one defect of the above-mentioned prior art and provide an EtherCAT master station system based on Qt;

[0011] The present invention also discloses a multi-task scheduling method for an EtherCAT master station system based on Qt, so as to improve the development efficiency and system performance of the EtherCAT master station system and meet the requirements of modern industrial control systems for real-time performance, stability and user experience.

[0012] The detailed technical scheme of the present invention is as follows:

[0013] A Qt-based EtherCAT master station system, the system comprising a human-computer interaction module, a task scheduling management module, an EtherCAT master station protocol stack function module, an XML slave station configuration file parsing module, an Internet port communication module and a serial port communication module;

[0014] The human-computer interaction module includes: a business real-time display and control module, an EtherCAT communication data online debugging module, a business basic configuration and modular debugging module and a system authentication module;

[0015] The task scheduling management module refers to the module in the EtherCAT master system that is responsible for the management of the entire business process, the processing of complex data and task scheduling, including: a system working status management module, a complex business data processing module and a task scheduling module;

[0016] The EtherCAT master station protocol stack functional modules include but are not limited to: a real-time data processing module for the controlled object, a business control logic management module for the controlled slave station, an EtherCAT master station initialization flow module and a business processing process interface implementation module for the controlled object;

[0017] The XML slave configuration file parsing module is used to parse the slave configuration file in XML format, and use the parsed data for the EtherCAT communication data online debugging module in the above-mentioned human-computer interaction module;

[0018] The network port communication module is used to expand the network port communication function according to business needs. The system sets TCP long connection communication by default, and free data protocol can be added for data communication according to business needs;

[0019] The serial communication module is used to expand the serial communication function according to business needs. The system defaults to Modbus protocol communication, and other communication protocols, such as 86 protocol, can be added according to business needs.

[0020] Preferably, according to the present invention, the business real-time display and control module includes but is not limited to: real-time display data required by the business and real-time control functions required by the business;

[0021] The EtherCAT communication data online debugging module includes but is not limited to: PDO data reading and writing and SDO data reading and writing;

[0022] The business basic configuration and modular debugging module includes a basic configuration part and a modular debugging part;

[0023] The system authentication module is used to limit user access rights; the final business user only has access to the business real-time display and control module, and other human-computer interaction interfaces are disabled; only business personnel with administrator rights, such as system administrators or business maintenance personnel, are eligible to use the business real-time display and control module, the EtherCAT communication data online debugging module and the business basic configuration and modular debugging module at the same time.

[0024] Preferably, according to the present invention, the working status management module of the system refers to recording each working status of the business, and sending the real-time working status to the human-computer interaction module in the form of a signal; the processing module of the complex business data refers to calculating and storing the data participating in the calculation in the business process, and the data participating in the calculation includes but is not limited to: the configuration data in the business basic configuration and modular debugging module, and the PDO data in the real-time data processing module of the controlled object; the task scheduling module refers to the scheduling execution of the business process.

[0025] Preferably, according to the present invention, the master station protocol stack is implemented by transplantation based on the open source SOEM master station protocol stack source code.

[0026] Preferably, the real-time data processing module of the controlled object refers to reading and storing PDO data in real time in EtherCAT communication, and formatting the data or performing complex calculations on the data according to the use requirements of the controlled object. If the data that needs to be called in real time in the business task is data for complex calculations based on PDO data, it is transmitted to the task scheduling management module through the signal and slot mechanism in Qt for data processing, and then returned for calling;

[0027] The business control logic management of the controlled slave station refers to that in the EtherCAT master station system, the master station regularly sends and receives PDO data and performs business logic processing on the data; the regular sending and receiving functions are implemented by a precision timer, and the business logic processing and control are performed in the precision timer interrupt;

[0028] The EtherCAT master station initialization process includes: networking configuration, data storage area mapping, clock initialization, and EtherCAT state switching;

[0029] The business processing interface implementation of the controlled object refers to the implementation of the business logic processing function of the controlled object.

[0030] Preferably, according to the present invention, the networking configuration refers to connecting the EtherCAT network port; the data storage area mapping refers to local storage area mapping of PDO data; the clock initialization refers to selecting and initializing a suitable EtherCAT clock working mode according to actual business application requirements; the working modes of the EtherCAT clock include free mode, SM synchronization mode and DC synchronization mode; the free mode means that the timing period of each slave station is different, and each executes its own program; the SM synchronization mode means that each slave station task is triggered to execute when it receives the master station data frame; the DC synchronization mode is a high-precision time synchronization mode.

[0031] A multi-task scheduling method for an EtherCAT master station system based on Qt, the method comprising a task multi-thread division and priority setting method and a method for ensuring stable operation of the highest priority task.

[0032] Preferably, according to the present invention, the task multithreading division and priority setting method comprises the following steps:

[0033] S1. Multiple work tasks are assigned to multiple threads according to business needs. The thread assignment rules are as follows: thread 1 is a real-time control task; thread 2 is a business logic management task; thread 3 is a human-computer interaction task;

[0034] S2, assigning threads to tasks in each module: thread1 includes tasks in the EtherCAT master protocol stack function module; thread2 includes tasks in the task scheduling management module, TCP network port communication module and Modbus serial port communication module; thread3 includes tasks in the human-computer interaction module;

[0035] S3. According to the working priority of the actual tasks, the priorities of thread1, thread2 and thread3 are set: the process data communication task is high-frequency real-time communication and is set to the highest priority task, and the process data communication task is implemented in the 1ms precision timer interrupt; based on the Qt language rules, thread1 has the highest priority requirement and is set to TimeCriticalPriority, and is executed by high-frequency timer interrupt wake-up; since the thread3 task is in the human-computer interaction module, based on the Qt language rules, the default thread3 is NormalPriority; since the task priority related to the business logic management of thread2 is higher than the human-computer interaction task of thread3, and lower than the EtherCAT real-time control task of thread1, thread2 is set to HighestPriority or HighPriority; in summary: thread1-TimeCriticalPriority>thread2-HighestPriority / HighPriority>thread3-NormalPriority.

[0036] Preferably, according to the present invention, the method for ensuring stable operation of the highest priority task includes the following:

[0037] S1, event-driven is used as the trigger condition of the business process. Specifically, the business process of task scheduling management of thread2 uses the signal and slot mechanism to interact with the high-priority thread1 to control the smooth execution of the entire business process; the human-computer interaction task of thread3 with the lowest priority also uses the signal and slot mechanism to interact with thread2 for data. Among them, if the data in thread1 wants to be transferred to thread3, it must be forwarded through thread2;

[0038] S2. Use asynchronous operation to process complex data. Asynchronous operation means transferring all complex operations involved in high-priority thread 1 to thread 2 with lower priority for execution and storing data. Thread 1 only reads and uses the data processed in thread 2 without performing any operations. This ensures high-real-time communication processing of thread 1 and avoids program crash caused by simultaneous modification of data.

[0039] S3. Use queues to manage tasks to be executed. When executing business processes in the high-frequency timer interrupt of thread1, put a series of operations similar to task b in the queue and set execution conditions. Put the queue in the high-frequency timer interrupt and trigger execution with task a according to the timing sequence conditions, so that tasks a and task b are executed in timing sequence.

[0040] Compared with the prior art, the present invention has the following beneficial effects:

[0041] (1) Compared with the traditional EtherCAT master station system development method, the present invention has the following technical advantages: a unified development platform based on Qt, an efficient multi-task scheduling method, an integrated graphical user interface and cross-platform support.

[0042] (2) The application software developed based on Qt in the present invention has the advantages of being cross-platform and easy to port. For some application systems with low real-time requirements, such as sorting distributed control systems, it can be deployed and used under the Windows operating system; for application systems with high real-time requirements, such as robot control systems and automated production lines, it can be deployed and used under operating systems such as RT-Linux, QNX, VxWorks or Windows Embedded series.

[0043] (3) The present invention adopts a combination of event-driven, asynchronous operation and queue to achieve the highest priority task running stability; the event-driven adopts the signal and slot mechanism to realize task scheduling between threads, thereby avoiding the execution of long-term tasks in the main thread, and does not interfere with the execution of high-frequency events; the asynchronous operation places complex calculations in lower priority threads for processing and storage, and high priority threads call them, thereby avoiding data being modified at the same time and causing program crashes; the use of queues realizes that multiple tasks operating on the same variable area at the same time are placed in the queue for conditional timing execution, avoiding conflicts.

[0044] (4) Taking the express sorting control system as an application case, the EtherCAT master station system described in the present invention is deployed on a non-real-time Windows platform. In the SM working mode, that is, the working mode triggered when the slave receives a periodic data frame, it is verified by experiments that when the master sends periodic data at 1ms, the time to receive feedback from the slave is between 1-2ms. Therefore, for distributed applications with a slave task cycle of more than 2ms, the EtherCAT master station system deployed on the Windows platform can be used. That is, if the system is deployed under a real-time operating system, the real-time performance is higher. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 It is a schematic diagram of the express sorting main station system and functional modules in an embodiment of the present invention;

[0046] Figure 2 This is a schematic diagram of task thread allocation of the express sorting master station system in an embodiment of the present invention;

[0047] Figure 3 It is the main human-computer interaction interface of the express sorting main station system in the embodiment of the present invention;

[0048] Figure 4 It is the main human-computer interaction interface of the express sorting main station system in the embodiment of the present invention;

[0049] Figure 5 It is the debugging interface of the human-computer interaction encoder of the express sorting master station system in the embodiment of the present invention;

[0050] Figure 6 It is the basic setting interface of human-computer interaction of the express sorting main station system in the embodiment of the present invention;

[0051] Figure 7 It is a line graph of performance test experimental data in an embodiment of the present invention. DETAILED DESCRIPTION

[0052] The present disclosure is further described below in conjunction with the accompanying drawings and embodiments.

[0053] Embodiment 1,

[0054] like Figure 1 As shown, this embodiment provides a Qt-based EtherCAT master system, which at least includes:

[0055] M1: Human-computer interaction module; M2: Task scheduling management module; M3: EtherCAT master station protocol stack function module; M4: XML slave station configuration file parsing module; M5: Network port communication module; M6: Serial port communication module;

[0056] M1: Human-computer interaction module

[0057] The human-computer interaction module includes: a business real-time display and control module, an EtherCAT communication data online debugging module, a business basic configuration and modular debugging module and a system authentication module;

[0058] The business real-time display and control module includes but is not limited to: real-time display data required by the business and real-time control functions required by the business; the real-time display data required by the business includes but is not limited to: production process data, business process data, error alarm data, status display; the real-time control functions required by the business include but are not limited to: EtherCAT master station scanning and connecting slave stations, power-on control, power-off control, network port socket connection, serial port connection;

[0059] The EtherCAT communication data online debugging module includes but is not limited to: PDO data reading and writing and SDO data reading and writing; the PDO data reading and writing refers to the online reading and writing of process data in the real-time transmission process between the master station and the slave station, such as sensor data, execution status, etc.; the SDO data reading and writing refers to a communication object of a client / server model between the master station and the slave station, which is used to achieve low-latency and reliable data transmission, such as configuration parameters, device status information, etc.;

[0060] The business basic configuration and modular debugging module includes a basic configuration part and a modular debugging part. The basic configuration refers to the business parameters that need to be configured in the business application, which are mostly power-off saving data; the modular debugging refers to the business functions that need to be independently tested in the business application, which is usually used to verify and correct whether the configured parameters are appropriate;

[0061] The system authentication module is used to limit user access rights. The final business user only has access to the business real-time display and control module, and other human-computer interaction interfaces are disabled; only business personnel with administrator rights, such as system administrators or business maintenance personnel, are eligible to use the business real-time display and control module, the EtherCAT communication data online debugging module and the business basic configuration and modular debugging module at the same time;

[0062] M2: Task scheduling management module

[0063] The task scheduling management module refers to a module in the EtherCAT master system that is responsible for the management of the entire business process, the processing of complex data and task scheduling, including: system working status management, complex business data processing and task scheduling; the system working status management refers to the recording of each working status of the business, and sending the real-time working status to the above-mentioned human-computer interaction interface in the form of sending signals; the processing of complex business data refers to the calculation and storage of data that need to be calculated in the business process in this module, and the data involved in the calculation include but are not limited to: the configuration data in the business basic configuration and modular debugging module, and the PDO data in the real-time data processing module of the controlled object; the task scheduling refers to the scheduling execution of the business process;

[0064] M3: EtherCAT master protocol stack function module

[0065] The EtherCAT master station protocol stack functional module refers to the communication between the EtherCAT master station and the slave station in the EtherCAT master station system through the master station protocol stack; the master station protocol stack is transplanted and implemented based on the open source SOEM master station protocol stack source code; the EtherCAT master station protocol stack functional module includes but is not limited to: real-time data processing of the controlled object, business control logic management of the controlled slave station, EtherCAT master station initialization process and business processing process interface implementation of the controlled object, etc.;

[0066] The real-time data processing module of the controlled object refers to reading and storing PDO data in real time in EtherCAT communication, and formatting the data or performing complex calculations on the data according to the usage requirements of the controlled object, such as combining the stored single-byte data into a meaningful four-byte variable according to the configuration format; for example, the data that needs to be called in real time in the business task is data for complex calculations based on PDO data, which is transmitted to the task scheduling management module through the signal and slot mechanism in Qt for data processing, and then returned for calling;

[0067] The business control logic management of the controlled slave station refers to the EtherCAT master station system, the master station regularly sends and receives PDO data and performs business logic processing on the data, usually the timing time is within 10ms, generally 1ms clock cycle; the scheduled sending and receiving functions are implemented by a precision timer, and the business logic processing and control are performed in the precision timer interrupt;

[0068] The EtherCAT master station initialization process includes: networking configuration, data storage area mapping, clock initialization, and EtherCAT state switching; the networking configuration refers to connecting the EtherCAT network port; the data storage area mapping refers to mapping the PDO data to the local storage area; the clock initialization refers to selecting and initializing the appropriate EtherCAT clock working mode according to the actual application requirements of the business; the working modes of the EtherCAT clock include free mode, SM synchronization mode, and DC synchronization mode; the free mode means that each slave station has a different timing cycle and executes its own program; the SM synchronization mode means that each slave station task is triggered to execute when receiving the master station data frame; the DC synchronization mode is a high-precision time synchronization mode;

[0069] The business processing interface implementation of the controlled object refers to the implementation of the business logic processing function of the controlled object, such as the motor turning left 90 degrees;

[0070] M4: XML slave configuration file parsing module

[0071] The XML slave configuration file parsing module refers to parsing the slave configuration file in XML format, and using the parsed data for the EtherCAT communication data online debugging module in the above-mentioned human-computer interaction module; the slave configuration file mainly includes manufacturer information and slave description information; the manufacturer information mainly includes manufacturer name and manufacturer ID; the slave description information is the configuration of the basic information of the slave device and the relevant variables of data communication; the basic information of the slave device includes the identification, name and interface type of the slave device; the relevant variables of data communication include the index, name, type, etc. of process data;

[0072] M5: Network port communication module

[0073] The network port communication module refers to the ability to expand network port communication functions according to business needs. The system defaults to TCP long connection communication, and free data protocols can be added for data communication according to business needs;

[0074] M6: Serial communication module

[0075] The serial communication module refers to the ability to expand serial communication functions according to business needs. The system defaults to Modbus protocol communication, and other communication protocols, such as 86 protocol, can be added according to business needs.

[0076] Embodiment 2,

[0077] This embodiment provides a multi-task scheduling method for an EtherCAT master station system, the method at least comprising: a task multi-thread division and priority setting method and a method for ensuring stable operation of the highest priority task;

[0078] The task multithreading division and priority setting method includes:

[0079] Step 1: Assign multiple work tasks to multiple threads according to business needs. The thread assignment rules are as follows: thread 1 is the real-time control task; thread 2 is the business logic management task; thread 3 is the human-computer interaction task;

[0080] Step 2: Assign threads to tasks in the business. The thread tasks included in thread1 are the above-mentioned EtherCAT master station protocol stack functions; the thread tasks included in thread2 are task scheduling management module, TCP network port communication module and Modbus serial port communication module; the thread tasks included in thread3 are human-computer interaction modules;

[0081] Step 3: Set the priority of the above three threads according to the working priority of the actual task; since the process data communication task in the EtherCAT master system is high-frequency real-time communication, it must be the highest priority task, and the process data communication task is implemented in the 1ms precision timer interrupt. Based on the Qt language rules, thread1 should be set to TimeCriticalPriority and use high-frequency timer interrupt to wake up and execute; since thread3 thread task is a human-computer interaction module, based on the Qt language rules, the default is NormalPriority; since the task priority related to the business logic management of thread2 is higher than the human-computer interaction task of thread3, and lower than the EtherCAT real-time control task of thread1, thread2 is set to HighestPriority or HighPriority; In summary: thread1-TimeCriticalPriority>

[0082] thread2-HighestPriority / HighPriority>thread3-NormalPriority;

[0083] The method for ensuring the stable operation of the highest priority task includes:

[0084] Method 1: Use event-driven as the trigger condition for the business process. In more detail, the business process of task scheduling management of thread 2 uses the signal and slot mechanism to interact with the high-priority thread 1 to control the smooth execution of the entire business process; and the human-computer interaction task of thread 3, which has the lowest priority among the three threads, also uses the signal and slot mechanism to interact with thread 2 for data. Among them, if the data in thread 1 wants to be transferred to the data in thread 3, it must also be forwarded through thread 2;

[0085] Method 2: Use asynchronous operation to process complex data. Asynchronous operation means transferring all complex operations involved in high-real-time thread Thread1 to thread Thread2 with lower priority to execute and store data. Thread1 only reads and uses the processed data without operating it. This ensures high-real-time communication processing of Thread1 and avoids program crash caused by simultaneous modification of data.

[0086] Method 3: Use a queue to manage tasks to be executed. When executing a business process in the high-frequency timer interrupt of thread1, there is a situation: task a in the timer interrupt is operating a variable area, and other tasks b that are not in the timer interrupt also need to operate the variable area. If task b is in the process of operating the variable area, a timer interrupt suddenly interrupts task b and executes task a to operate the same variable area. When task a is completed and returns to task b, task b cannot execute the task normally due to the change in the variable area, resulting in an error. The solution to this extreme situation is that task a and task b can be executed in a time sequence without causing a conflict. The present invention proposes a method of placing a series of operations similar to task b in a queue and setting execution conditions, and placing the queue in the timer interrupt to trigger execution with task a according to the time sequence conditions.

[0087] Embodiment 3,

[0088] The following describes the master station system structure, task scheduling and human-computer interaction of the present invention when the method of the present invention is applied to the express sorting system in combination with Example 3 and the accompanying drawings, which are described in detail as follows:

[0089] like Figure 1It is a schematic diagram of the main station system for express sorting and its functional modules. Among them, an EtherCAT main station system for express sorting is deployed on the industrial control computer 2, with 1 DIO slave station, 1 encoder slave station and N motor drive slave stations mounted. N is determined according to actual needs, and 1 < N < 256. The functional modules connected to the main station system include: an Ethernet communication module and a serial communication module. Among them, the Ethernet module is connected to the industrial control computer 1 and the industrial camera, and is responsible for the function of package photographing and processing. The serial communication module includes serial port 1 and serial port 2. Serial port 1 is connected to the frequency converter to control the operation of the conveyor belt. Serial port 2 is connected to the DC motor to control the operation of the bag pulling section.

[0090] According to the application requirements of the express main station system, the work tasks of the express sorting main station system can be divided into the following aspects:

[0091] S1: Reading the frequency of the frequency converter;

[0092] S2: Reading the speed of the DC motor;

[0093] S3: EtherCAT master timer interrupt task;

[0094] S4: EtherCAT master collecting optoelectronic signals;

[0095] S5: EtherCAT master collecting encoder values;

[0096] S6: The EtherCAT master sets the control bit to make the motor slave station swing;

[0097] S7: The EtherCAT master controls the industrial motor to take pictures;

[0098] S8: After the motor slave station finishes swinging, the EtherCAT master periodically resets the control bit;

[0099] S9: Calculating the conveyor belt speed;

[0100] S10: Calculating the package position;

[0101] S11: Human-computer interaction;

[0102] Such as Figure 2This is a diagram of task thread allocation for the express sorting main station system. The tasks of S1-S11 can be divided into three threads: thread1, thread2 and thread3 as shown in the figure. The thread priority of thread1 is set to TimeCriticalPriority, and it uses high-frequency timer interrupt to wake up and execute, with the highest priority; thread2 is set to HighestPriority, with the second highest priority; thread3 has the default priority of NormalPriority, with the lowest priority; during the execution of the express sorting main station system program, it is executed in descending order of priority.

[0103] like Figure 3-6 This is a human-computer interaction diagram of the express sorting main station system. Figure 3 The main user interface is mainly used by express delivery sorting front-line sorting personnel, and is open to all personnel; the main interface mainly includes three control buttons: system online button, power button and shutdown button, and the others are package data, operation data, status data, business process data and alarm data display interface; Figure 4 It is a PDO / SDO debugging interface, which can debug the PDO and SDO data of the motor drive slave configured in XML online; Figure 5 It is the encoder debugging interface, which can debug the PDO data of the encoder slave configured in XML online; Figure 6 It is the basic setting interface, which mainly includes the modular function parameter setting and debugging involved in the express sorting system, slave station parameter setting, relevant parameter setting involved in the express sorting scene, encoder parameter setting, etc. Figure 4 , 5 6. For developers, system maintenance personnel and equipment integrators to use for encryption. The password login entry is on the "About" interface.

[0104] Embodiment 4,

[0105] The following describes the master station system structure, task scheduling and human-computer interaction of the present invention when the method of the present invention is applied to the express sorting system in combination with Example 4 and the accompanying drawings, which are described in detail as follows:

[0106] The express sorting master station system of the present invention is deployed in the Windows 11Pro non-real-time operating system to perform performance testing; because the express sorting system is a distributed real-time control system, but the synchronization requirements of each slave station are not high, so EtherCAT is set to work in SM working mode, that is, the working mode triggered when the slave station receives a periodic data frame. The test steps are as follows:

[0107] 1) The EtherCAT PDO communication cycle of the master system is set to 1ms, and in the 1ms timing interrupt, DO15 is set to 1 and sent to slave 2, and the sending time is recorded as t1;

[0108] 2) Slave 2 receives data and assigns the value of DO15 to DI15;

[0109] 3) After the master receives DI15 as 1, it records the receiving time t2, clears DO15, and calculates the time difference Δt from sending to receiving.

[0110] Δt=t2-t1

[0111] 4) Repeat steps 1-3 to obtain 100 sets of data;

[0112] 5) Set the EtherCAT PDO communication cycle in step 1 to 2ms and 3ms and test 100 sets of data respectively.

[0113] Figure 7 It is a line graph of experimental data, where the x-axis represents the number of collected data, and the y-axis represents the time difference Δt, in ms. After experimental verification, the average time from EtherCAT sending to receiving is between 1-2ms, which meets the application requirements of the express sorting system.

[0114] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the technical solution of the present invention, and are not intended to limit the specific implementation methods of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the claims of the present invention shall be included in the protection scope of the claims of the present invention.

Claims

1. A Qt-based EtherCAT master system, characterized in that: The system includes a human-computer interaction module, a task scheduling management module, an EtherCAT master station protocol stack function module, an XML slave station configuration file parsing module, an Internet port communication module and a serial port communication module; The human-computer interaction module includes: a business real-time display and control module, an EtherCAT communication data online debugging module, a business basic configuration and modular debugging module and a system authentication module; The task scheduling management module includes: a system working status management module, a complex business data processing module and a task scheduling module; The EtherCAT master station protocol stack functional modules include but are not limited to: a real-time data processing module for the controlled object, a business control logic management module for the controlled slave station, an EtherCAT master station initialization flow module and a business processing process interface implementation module for the controlled object; The XML slave configuration file parsing module is used to parse the slave configuration file in XML format, and use the parsed data for the EtherCAT communication data online debugging module in the above-mentioned human-computer interaction module; The network port communication module is used to expand the network port communication function according to business needs; The serial port communication module is used to expand the serial port communication function according to business requirements.

2. The Qt-based EtherCAT master station system according to claim 1, characterized in that: The business real-time display and control module includes but is not limited to: real-time display data required by the business and real-time control functions required by the business; The EtherCAT communication data online debugging module includes but is not limited to: PDO data reading and writing and SDO data reading and writing; The business basic configuration and modular debugging module includes a basic configuration part and a modular debugging part; The system authentication module is used to limit user access rights.

3. The Qt-based EtherCAT master station system according to claim 1, characterized in that: The working status management module of the system refers to recording each working status of the business and sending the real-time working status to the human-computer interaction module in the form of sending signals; the processing module of the complex business data refers to calculating and storing the data involved in the calculation in the business process, and the data involved in the calculation is not limited to: the configuration data in the basic configuration and modular debugging module of the business, and the PDO data in the real-time data processing module of the controlled object; The task scheduling module refers to the scheduling and execution of business processes.

4. The Qt-based EtherCAT master station system according to claim 1, characterized in that: The master station protocol stack is implemented by transplantation based on the open source SOEM master station protocol stack source code.

5. The Qt-based EtherCAT master station system according to claim 1, characterized in that: The real-time data processing module of the controlled object refers to reading and storing PDO data in real time in EtherCAT communication, and formatting the data or performing complex calculations on the data according to the usage requirements of the controlled object. If the data that needs to be called in real time in the business task is data for complex calculations based on PDO data, it is transmitted to the task scheduling management module through the signal and slot mechanism in Qt for data processing, and then returned for calling; The business control logic management of the controlled slave station refers to that in the EtherCAT master station system, the master station regularly sends and receives PDO data and performs business logic processing on the data; the regular sending and receiving functions are implemented by a precision timer, and the business logic processing and control are performed in the precision timer interrupt; The EtherCAT master station initialization process includes: networking configuration, data storage area mapping, clock initialization, and EtherCAT state switching; The business processing interface implementation of the controlled object refers to the implementation of the business logic processing function of the controlled object.

6. The Qt-based EtherCAT master station system according to claim 1, characterized in that: The networking configuration refers to connecting the EtherCAT network port; the data storage area mapping refers to mapping the PDO data to the local storage area; the clock initialization refers to selecting and initializing the appropriate EtherCAT clock working mode according to the actual application requirements of the business; the working modes of the EtherCAT clock include free mode, SM synchronization mode and DC synchronization mode; the free mode means that the timing cycle of each slave station is different, and each executes its own program; the SM synchronization mode means that each slave station task is triggered to execute when receiving the master station data frame; the DC synchronization mode is a high-precision time synchronization mode.

7. A multi-task scheduling method for an EtherCAT master system based on Qt, characterized in that: The method includes a task multi-thread division and priority setting method and a method for ensuring the stable operation of the highest priority task.

8. The multi-task scheduling method of the EtherCAT master system based on Qt according to claim 7, characterized in that: The task multithreading division and priority setting method comprises the following steps: S1. Multiple work tasks are assigned to multiple threads according to business needs. The thread assignment rules are as follows: thread 1 is a real-time control task; thread 2 is a business logic management task; thread 3 is a human-computer interaction task; S2, assigning threads to tasks in each module: thread1 includes tasks in the EtherCAT master protocol stack function module; thread2 includes tasks in the task scheduling management module, TCP network port communication module and Modbus serial port communication module; thread3 includes tasks in the human-computer interaction module; S3. According to the working priority of the actual task, the priorities of thread1, thread2 and thread3 are set: the process data communication task is high-frequency real-time communication, which is set as the highest priority task. The process data communication task is implemented in the 1ms precision timer interrupt; based on the Qt language rules, thread1 is set to TimeCriticalPriority, and high-frequency timer interrupt is used to wake up the execution; based on the Qt language rules, thread3 is NormalPriority by default; thread2 is set to HighestPriority or HighPriority; in summary: thread1-TimeCriticalPriority> thread2-HighestPriority / HighPriority>thread3-NormalPriority.

9. The multi-task scheduling method of the EtherCAT master system based on Qt according to claim 8, characterized in that: The method for ensuring stable operation of the highest priority task includes the following: S1, event-driven is used as the trigger condition of the business process. Specifically, the business process of task scheduling management of thread2 uses the signal and slot mechanism to interact with the high-priority thread1; the human-computer interaction task of thread3 with the lowest priority also uses the signal and slot mechanism to interact with thread2 for data. Among them, if the data in thread1 wants to be transferred to thread3, it must be forwarded through thread2; S2. Use asynchronous operation to process complex data. The asynchronous operation means transferring all complex operations involved in the high-priority thread Thread1 to the lower-priority thread Thread2 for execution and then storing the data. Thread1 only reads and uses the data processed in Thread2 without performing any operations. S3. Use queues to manage tasks to be executed. When executing business processes in the high-frequency timer interrupt of thread1, put a series of operations similar to task b in the queue and set execution conditions. Put the queue in the high-frequency timer interrupt and trigger execution with task a according to the timing sequence conditions, so that tasks a and task b are executed in timing sequence.

Citation Information

Patent Citations

  • EtherCAT master station control system and control method thereof

    CN112486112A

  • Real-time EtherCAT master station system

    CN105429836A

  • Open type multi-execution-end control system and method based on TwinCAT software

    CN118260009A

  • System and method for real-time robotic control

    US20200001471A1

  • Distributed communication and control system using concurrent multi-channel master unit

    US20240340361A1

Cited By

  • EtherNet / IP modular information identification method and equipment

    CN120263660A