Flexible component model for motion control system

Through the execution management module and real-time communication module of the flexible component model, the problems of high coupling degree and insufficient system flexibility of traditional motion control systems under complex production requirements are solved, and the functional units are decoupled and componentized are realized, and development efficiency and system stability are improved.

CN120406337APending Publication Date: 2025-08-01HUAZHONG UNIV OF SCI & TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510472004.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-15
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

When traditional motion control systems face complex and diversified production needs, they have problems such as high application coupling, lack of system flexibility and high repetition of development work, making it difficult to decouple and unified componentization of functional units, affecting development efficiency and system stability.

Method used

It provides a flexible component model, including execution management module, task implementation module and real-time communication module. Through unified interface and state machine management, it realizes decoupling of task scheduling and communication, supports real-time communication within and between processes, and provides a consistent basic interface and management mechanism.

Benefits of technology

The decoupling and componentization of functional units is realized, the flexibility and scalability of the system is improved, the development process is simplified, the development efficiency is improved, and the system stability is ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120406337A_ABST
    Figure CN120406337A_ABST
Patent Text Reader

Abstract

The invention relates to a flexible component model for a motion control system, and the model comprises an execution management module which achieves the effective decoupling of task scheduling and execution operation, and carries out the management and scheduling of an associated thread for a task; the task implementation module defines a task state machine and a hook function interface and is responsible for management and execution of a complete life cycle of the task; and the real-time communication module is used for providing an efficient and flexible port connection model and supporting a real-time communication function of an intra-process scene and an inter-process scene. The flexible component model is provided for the flexible reconfigurable requirement of automatic production, and the flexible component model is suitable for collaborative development of more complex application scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of flexible automation of industrial systems, and particularly relates to a flexible component model for a motion control system. Background Art

[0002] In recent years, with the continuous advancement of industrial automation, flexibility, and openness, traditional motion control systems have been difficult to meet the increasingly complex and diverse production requirements. A complete system composed of multiple functional units cooperating with each other is restricted by its rigid characteristics, and it is difficult for developers to adjust the composition and cooperation methods of tasks according to the actual scenario. The specific manifestations are as follows:

[0003] (1) High application coupling degree. A complete manufacturing system is composed of multiple functional units collaborating. However, in actual development, due to technical level or workload considerations, developers often neglect the decoupling between functional units, resulting in a closed application architecture that is difficult to expand.

[0004] (2) Lack of system flexibility. Although some project engineering combines the componentization idea and develops each unit according to function division to achieve a certain degree of decoupling effect; however, the development methods of each unit are different, the interface definitions are not unified, and the interaction methods between units lack consistency. Most of them require additional manual processing to establish connection relationships and are difficult to freely combine, and do not achieve true unified componentization.

[0005] (3) High repetition of development work. In system development, in addition to the application logic of tasks, a considerable part of the workload lies in management and scheduling operations related to tasks, such as thread resource allocation, synchronization and mutual exclusion management, etc. This not only easily leads to loopholes and affects task stability, but also raises the development threshold and hinders development efficiency. Summary of the Invention

[0006] The purpose of the present invention is to provide a flexible component model for a motion control system, enabling all functional units of the system to be developed based on the same model, thereby having consistent basic interfaces, management mechanisms, and communication modules, allowing each component object to be freely combined like standardized building blocks; when facing the diversity of production tasks, the manufacturing system has better flexibility, expandability, and reconfigurability.

[0007] To achieve the above purpose,

[0008] An embodiment of the present application provides a flexible component model for a motion control system, including:

[0009] An execution management module that effectively decouples task scheduling and execution operations and undertakes the management and scheduling of associated threads for tasks;

[0010] Task implementation module, which defines a task state machine and hook function interfaces, and is responsible for the management and execution of the complete life cycle of tasks;

[0011] Real-time communication module, which provides an efficient and flexible port connection model and supports real-time communication functions in both intra-process and inter-process scenarios.

[0012] The execution management module includes:

[0013] Task manager, which encapsulates operations related to operating system threads and undertakes the management of underlying resources during task execution; after a component object is created, it is naturally assigned a thread to run independently, and according to information such as the task period, priority, and scheduling policy specified by the user, it automatically completes the configuration and management of the thread;

[0014] Task executor, which provides a set of unified operation interface specifications for the entire process from the start to the end of a task.

[0015] The task implementation module includes:

[0016] State machine, which defines the various states of the task life cycle, as well as the corresponding state transition methods, transition conditions, and transition processes;

[0017] Hook function interface, which serves as the carrier of the task implementation logic and is incorporated into the state machine management. Users develop the application logic of the task through the hook function interface and call it during state transition to implement the execution of the actual task functions;

[0018] Local method library, which provides specific methods for the application functions of the current component.

[0019] The real-time communication module includes:

[0020] Port model, which is a unified interface for data communication inside and outside the component. According to the flow direction of the communication data, it is divided into an output port and an input port, which are responsible for writing and reading data respectively;

[0021] Transmission unit, which is responsible for the specific transmission process of communication data and supports different implementation mechanisms according to different communication scenarios;

[0022] Connection endpoint, which is the medium for data transmission and is responsible for the interaction between the port and the transmission unit of the data along the communication direction.

[0023] The port model includes:

[0024] Output port, where the component to which it belongs acts as a data producer, and defines the write() method to write data into the transmission unit of the real-time communication module for use by other components;

[0025] The input port, where the component acts as a data consumer, defines a read() method to read data from the transmission unit of the real-time communication module for consumption.

[0026] The transmission unit supports different transmission mechanisms for different communication scenarios, including:

[0027] When communicating between components within a process, a FIFO queue is used as the transmission implementation for communication data;

[0028] When communicating between components across processes, shared memory is used as the transmission implementation for communication data.

[0029] Compared with the prior art, the beneficial effects of the present invention are:

[0030] 1. The system development is implemented based on a component model, which is beneficial to the decoupling and componentization of functions; and all components have consistent basic interfaces, facilitating collaborative management. At the same time, the component network relationship can be flexibly adjusted to meet diverse production requirements.

[0031] 2. A unified real-time communication interface is provided, which not only realizes the efficient data communication function in different scenarios, but also standardizes the communication method within the component system, improving the flexibility and scalability of the component system.

[0032] 3. The underlying resource management and scheduling operations are encapsulated for task development, and a state machine management model is provided. Developers only need to focus on the implementation of the application logic without worrying about task management and execution issues, improving development efficiency and ensuring system stability. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0034] Figure 1 The system structure diagram of the flexible component model of the present invention is shown;

[0035] Figure 2 The functional flowchart of the execution management module designed by the present invention is shown;

[0036] Figure 3 The relationship diagram of the task manager and the executor designed by the present invention is shown;

[0037] Figure 4 The state machine flowchart designed by the present invention is shown;

[0038] Figure 5 The figure shows a schematic diagram of the port communication model designed by the present invention;

[0039] Figure 6 The figure shows a schematic diagram of the method for the flexible component of the control system provided by the embodiment of the present invention. Detailed implementation manners

[0040] In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0041] It should be noted that the descriptions involving "first", "second", etc. in the present invention are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include at least one of such features. In addition, the technical solutions between various embodiments may be combined with each other, but it must be based on the fact that those of ordinary skill in the art can implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the protection scope required by the present invention.

[0042] As Figure 1 shown, the embodiment of the present application provides a flexible component model for a motion control system, including:

[0043] An execution management module that effectively decouples task scheduling and execution operations and manages and schedules the associated threads for the task;

[0044] A task implementation module that defines a task state machine and a hook function interface and is responsible for the management and execution of the complete life cycle of the task;

[0045] A real-time communication module that provides an efficient and flexible port connection model and supports real-time communication functions in both in-process and inter-process scenarios.

[0046] (1) Component model

[0047] 1) Execution management module

[0048] The execution management module effectively decouples the scheduling management and actual execution of tasks and includes two units: a task manager and a task executor.

[0049] The task manager provides a control and management interface for all stages of the task workflow, and controls the start, stop, and scheduling operations according to periodic attributes based on a unified specification. It interfaces with the thread resources of the operating system downward, encapsulates thread management operations, specifically including functions such as thread creation, configuration, scheduling, and termination, to relieve relevant development burdens on task developers. When creating a new task object, only task attributes such as period, priority, scheduling policy, CPU affinity, etc. need to be specified, and then they can be passed into the system standard interface correspondingly to complete the creation of task threads.

[0050] Regarding task scheduling, the system performs automatic scheduling according to the period settings of threads, and its process is as Figure 2 shown.

[0051] For aperiodic tasks, the Trigger() method will only be executed once after receiving a trigger signal, and a semaphore is set to wait for external triggers;

[0052] For periodic tasks, the Execute() method is called cyclically according to the set period value, and then the periodic logic of the task is executed; after each execution, it enters a waiting state until the next period arrives; if a timeout occurs during a certain execution, the number of times is accumulated in the Overrun flag bit, and when the set threshold is reached, the task loop is stopped urgently to warn the developer to troubleshoot the problem.

[0053] The task executor provides a set of unified operation interface specifications, defining the specific operation interfaces for each working stage of the task from start to end. The relationship between the task manager and the task executor is as Figure 3 shown. The task manager assumes the role of a manager and only manages the behavior of tasks according to the status of the threads to which the tasks belong. It does not directly involve task execution, but through the task executor, and then calls the actual method interfaces of the tasks to complete specific operations, realizing the decoupling of scheduling management and actual execution.

[0054] 2) State machine and hook function interface

[0055] The component model defines a set of state machine architectures to provide clear state divisions and transition rules for tasks at each stage of the life cycle. The specific state definitions are shown in Table 1.

[0056] Table 1 Task state machine definition and description

[0057] Status Description Init Construction process of component object Configurable Configuration state, perform task initialization configuration operation Operational Ready state, can be but not running Running Running state, (loop) call execution function Exception Runtime exception, handle and recover Fatal Fatal error, terminate task and clean up

[0058] Regarding the complete mechanism of the state machine is as Figure 4As shown. When the component object is constructed, it is in the Init state. After completion, it automatically switches to Configurable. In this state, some configuration work is carried out according to the application logic of the task, such as adding communication ports, configuring port connections, etc.; then it enters the Operational state, indicating that the task initialization is all completed and there are no errors, and the execution is ready; the user can choose to enter the Running state at any time to start the execution logic of the task, and through the cycle setting, it can be arranged whether the task is executed cyclically or only once and then waits for triggering; when it is desired to temporarily stop during normal execution, it can be rolled back to the Operational state and can be resumed at any time. If an exception occurs during execution, it enters the Exception state and calls the configured handling function for recovery; if there are problems such as program errors that cannot be repaired, the task execution will be terminated in time and it enters the Fatal state, waiting for the developer to troubleshoot and restart.

[0059] When performing state switching, a relatively complete check mechanism is configured. The specific process is as follows: 1. Check whether the current state meets the corresponding switching conditions; 2. If it meets, call back the paired hook function to execute the application logic; if it does not meet, output the log to troubleshoot the problem; 3. Judge the execution result of the hook function. If it is successful, update the state flag; if an exception occurs, stop in time and enter the Exception state for processing.

[0060] The hook function interface is a unified interface for users to implement the actual application logic of the task. It is arranged in the above state machine management and is called during state switching to complete the actual functional operations of the task. When users face the development requirements of tasks with different functions, they only need to fill in the logical code in the hook function corresponding to the component to obtain a complete task workflow managed by the state machine, realizing the "plug and play" of the application logic, and supporting the efficient development and flexible customization of components.

[0061] 3) Real-time communication module

[0062] (a) Port model

[0063] The "port" is a unified interface for the component to communicate with the outside. Designing a unified data port model and communication model makes the communication between components more standardized and easier to manage.

[0064] Ports are divided into two types according to the flow relationship of specific data relative to components. For a certain communication data, the component on the data generation side needs to flow outwards, so the port at this time is defined as the output port OutputPort; while for the component on the data consumption side, the communication data flows in from the outside and is then used, so the port is defined as the input port InputPort at this time. When two components need to communicate, combined with the application logic of the data, an OutputPort object and an InputPort object are constructed for the two components respectively. Both ports provide a connect() method for establishing a communication connection with the other party. The communication model based on ports is as Figure 5 shown.

[0065] (b) Communication model

[0066] The communication model mainly consists of an output port, an input port, connection endpoints, and a transmission unit.

[0067] As the medium for data to enter and exit the component, the two ports provide unified write() and read() methods for users to implement the "write out" and "read in" operations.

[0068] The connection endpoints are associated with the ports one-to-one. This is the medium for data transmission, responsible for interacting with the transmission unit along the communication direction for the data, and selecting the value passing or reference passing method for specific data to reduce unnecessary overhead and improve transmission efficiency.

[0069] The transmission unit is the specific implementation of the data transmission function in the communication process. The real-time communication scenarios in the motion control system often occur in real-time edge layer devices. The communication between components mainly shows two specific requirements: intra-process communication and inter-process communication. The transmission unit provides mechanisms based on FIFO queues and shared memory respectively for these two requirements.

[0070] (c) Specific implementation mechanism of the transmission unit

[0071] For the communication between components within the same process, they have direct visibility to the memory space of this process. Therefore, a FIFO queue is configured for each communication connection within the space of this process as the "transfer station" for data flow; the data flowing out from the outputport is stored in this queue through the connection endpoints; then when the consuming component needs data, it reads the data from the same queue and passes it to the input port through the connection endpoints to complete a complete data transmission process.

[0072] The underlying structure of the FIFO uses an array and designs a dual-index mechanism for reading and writing, which respectively point to the array positions corresponding to the current read and write operations, so as to directly access the target elements through the index, which is real-time and efficient.

[0073] For the above read-write dual index, a union is used for packing, and specific read-write operations are implemented in combination with the atomic operation CAS to ensure the consistency and security of data during concurrent read-write operations of multiple components in the queue, and to ensure the stability and efficiency of communication.

[0074] For the inter-process communication scenario, shared memory is selected as the implementation mechanism for the transmission unit. For two components in different processes, a virtual address space of their respective processes is mapped to the same physical memory, and the two communicating components realize cross-process communication by accessing this physical memory.

[0075] The management of shared memory is distinguished by its key value, which is also the index when a process associates with a specific shared memory segment. Therefore, it needs to be distinguishable and unique within the entire system. The method for generating the index of the shared memory used for port connection is defined as shown in Formula 1.

[0076] shm_name = TC1_name + "." + outport_name + "_" + TC2_name + "." + inport_name

[0077] key = shm_name.c_str() (1)

[0078] The shared memory for communication connection is uniquely determined by the four-tuple of "producer component name - output port name - consumer component name - input port name" to ensure uniqueness.

[0079] Furthermore, semaphores are combined to support the synchronization performance of the communication module based on shared memory, coordinate concurrent operation problems, avoid race conditions, and ensure the stability and efficiency of communication.

[0080] (2) Component Method

[0081] To more clearly express the method of the flexible component model in constructing a motion control system, the present invention takes the edge control layer of constructing a motion control system as an example, designs two specific tasks based on the component model, as well as their work processes and communication interactions, to introduce the flexible component method for developing a motion control system.

[0082] The edge control layer is deployed in the Linux real-time environment, and the Linux system provides a real-time edge control environment in combination with the Preempt real-time patch. This part of the system mainly includes two task requirements, and each task is implemented and decoupled by a component object below.

[0083] One is the motion planning task, whose core function is to calculate the specific data of the control instructions for real-time distribution according to the user control logic. The other is the bus communication task, whose core function is to implement the communication function of the bus protocol stack and complete the periodic communication between the control end and the controlled device. According to the scenario description, the algorithm planning component and the bus communication component are designed, and the overall structure is as Figure 6 shown.

[0084] Within the algorithm planning component, first, facing the PLCOpen specification, the basic motion control function blocks and corresponding algorithms are implemented, including various basic motion control function units such as relative motion, absolute motion, and incremental motion in position mode and speed mode. In the Configurable state of the algorithm planning component, three steps are completed: (1) Configure the execution period of the current component to be 1 ms; (2) Configure an output port outport for the component and establish inter-process communication with the inport of the bus communication component through the connect() method; (3) Parse the user control logic and pre-store the algorithms to be called into the function block queue to be executed. Then, enter the Running state through the Start() method of the state machine and loop to execute the following logic at a period of 1 ms: Run the algorithm to obtain the instruction data for each period, and then write the data using the write() method of outport.

[0085] Within the bus communication component, IGH is used to build an EtherCAT master station, and master-slave communication is carried out through the EtherCAT protocol. In the Configurable state of this component, three tasks are completed: (1) Configure the execution period of the current component to be 1 ms; (2) Configure an input port inport for the component and communicate and connect with the outport of the algorithm planning component; (3) Complete the configuration and initialization of the protocol stack master station according to the slave device network. After entering the Running state, loop to execute the following logic at a period of 1 ms: Read the latest instruction data from inport and then send it to the controlled device through the EtherCAT protocol.

[0086] Those skilled in the art can have various variant solutions to implement the present invention without departing from the scope and essence of the present invention. For example, the features of one embodiment can be used in another embodiment to obtain another embodiment. Any modification, equivalent replacement, and improvement made within the technical concept of applying the present invention shall fall within the scope of the rights of the present invention.

Claims

1. A flexible component model for a motion control system, characterized in that, It includes: An execution management module that effectively decouples task scheduling and execution operations, and manages and schedules the associated threads for tasks; A task implementation module that defines a task state machine and hook function interfaces, and is responsible for the management and execution of the complete life cycle of tasks; A real-time communication module that provides an efficient and flexible port connection model, and supports real-time communication functions in both intra-process and inter-process scenarios.

2. The flexible component model for a motion control system according to claim 1, wherein The execution management module includes: A task manager that encapsulates operations related to operating system threads and manages underlying resources during task execution; after a component object is created, it is naturally assigned a thread to run independently, and automatically configures and manages the thread according to information such as the task period, priority, and scheduling policy specified by the user; A task executor that provides a set of unified operation interface specifications for the entire process from the start to the end of a task.

3. The flexible component model for a motion control system according to claim 1, characterized in that, The task implementation module includes: A state machine that defines the various states of the task life cycle, as well as the corresponding state transition methods, transition conditions, and transition processes; Hook function interfaces, as the carriers of task implementation logic, are arranged into state machine management. Users develop the application logic of tasks through hook function interfaces and are called during state transitions to implement the execution of the actual functions of tasks; A native method library that provides specific methods for the application functions of the current component.

4. A flexible component model for a motion control system according to claim 1, characterized in that The real-time communication module includes: A port model, which is a unified interface for data communication inside and outside the component. According to the flow direction of communication data, it is divided into an output port and an input port, which are responsible for writing and reading data respectively; A transmission unit that is responsible for the specific transmission process of communication data and supports different implementation mechanisms according to different communication scenarios; A connection endpoint, which is the medium for data transmission and is responsible for the interaction between ports and transmission units along the communication direction of data.

5. The flexible component model for a motion control system according to claim 4, characterized in that, The port model includes: An output port. The component to which it belongs acts as a data producer and defines a write() method to write data into the transmission unit of the real-time communication module for use by other components; An input port. The component to which it belongs acts as a data consumer and defines a read() method to read data from the transmission unit of the real-time communication module for consumption.

6. A flexible component model for a motion control system according to claim 4, characterized in that, The transmission unit supports different transmission mechanisms for different communication scenarios, including: When communicating between components within a process, use a FIFO queue as the transmission implementation of communication data; When communicating between components across processes, use shared memory as the transmission implementation of communication data.

Citation Information

Patent Citations

  • Robot system software architecture and implementation method and device thereof

    CN106293757A

  • Robot control system based on ROS and OROCOS

    CN106914900A

  • Flexible networking communication platform for heterogeneous equipment

    CN111405022A

  • Numerical control system architecture based on four-core processor and construction method

    CN114510354A