Real-time mixing test control and test system and method based on Linux-RT system and application
The real-time hybrid test control system based on Linux-RT system solves the problems of insufficient real-time performance, poor scalability and difficulty in multi-protocol integration in the existing technology. It realizes high-performance, stable and easy-to-use real-time hybrid test control, which is suitable for test scenarios such as seismic performance of building structures, dynamic response of bridge structures and vibration control of mechanical equipment.
Patent Information
- Application Number
- CN202511284525.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-10
- Publication Date
- 2025-11-18
AI Technical Summary
Existing real-time hybrid test systems suffer from insufficient real-time performance, poor scalability, difficulty in integrating multiple protocols, insufficient performance optimization, and weak fault handling capabilities, making it difficult to achieve high-performance real-time hybrid test control on general-purpose hardware platforms.
A real-time hybrid test control system based on Linux-RT is adopted, which combines the deterministic scheduling capability of the Linux real-time kernel, multi-protocol communication fusion technology and high-performance data processing algorithms. Through a real-time system manager, real-time actuators, data processing pipelines, multi-protocol communication interfaces and real-time performance monitoring modules, deterministic real-time response, flexible hardware platform, multi-protocol support and efficient data processing are achieved.
It provides deterministic real-time responses, supports multiple communication protocols, reduces development costs, improves system scalability and performance, ensures system stability and ease of use, and adapts to the needs of different testing scenarios.
Smart Images

Figure CN120972724A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to real-time hybrid test control and test system, method and application based on Linux-RT system, and belongs to the field of real-time hybrid test technology for structural engineering. Background Technology
[0002] Real-Time Hybrid Testing (RTHS) is an important testing method in structural engineering. It achieves real-time coupling between numerical simulation and physical testing by simulating one part of a structure using a numerical model (numerical substructure) and actually loading another part using physical specimens (physical substructure). During the hybrid test, the numerical substructure needs to transmit the calculated boundary conditions to the loading device of the physical substructure in real time, while the physical substructure needs to feed back the measured response data to the numerical substructure in real time. The real-time performance, stability, and determinism of this two-way data exchange directly determine the success of the test.
[0003] Currently, real-time hybrid testing systems mainly suffer from the following technical problems: First, ensuring real-time performance is difficult. Traditional systems, based on Windows or general-purpose Linux systems, cannot provide deterministic real-time responses. The uncertainty of task scheduling leads to large fluctuations in communication latency, severely affecting the stability of hybrid testing. Second, insufficient system scalability. Existing systems typically use dedicated hardware platforms and fixed communication protocols, resulting in high hardware upgrade costs and difficulties in integrating new communication methods, making it difficult to adapt to the needs of different testing scenarios. Third, difficulty in multi-protocol integration. Practical applications require simultaneous support for multiple communication methods such as UDP network communication, EtherCAT industrial bus, and analog signals. Existing systems lack a unified communication abstraction layer, making coordination between protocols difficult. Fourth, insufficient performance optimization. Traditional systems involve a large amount of memory copying, lock contention, and context switching during data processing, severely impacting the system's real-time performance. Fifth, weak fault handling capabilities. The lack of a comprehensive real-time performance monitoring and fault diagnosis mechanism makes it difficult to quickly locate and recover from system anomalies.
[0004] Existing solutions include: hybrid experimental systems based on dedicated real-time operating systems (RTOS), which offer good real-time performance but are costly, difficult to develop and maintain, and have limited hardware platform options; systems based on Windows real-time extensions, which have limited real-time performance and system stability issues; and systems based on general-purpose Linux, which are less expensive but cannot meet the requirements of hard real-time. None of these existing technologies can adequately balance the needs for real-time performance, cost, scalability, and ease of use. Summary of the Invention
[0005] To address the aforementioned deficiencies in existing technologies, this invention proposes a real-time hybrid test control and test system, method, and application based on the Linux-RT system. By combining the deterministic scheduling capabilities of the Linux real-time kernel, multi-protocol communication fusion technology, and high-performance data processing algorithms, it solves the technical problems of insufficient real-time performance, poor scalability, difficulty in multi-protocol fusion, and insufficient performance optimization in existing real-time hybrid test systems, thereby achieving high-performance real-time hybrid test control on a general-purpose hardware platform.
[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A real-time hybrid test control system based on Linux-RT system includes: The real-time system manager adopts a singleton pattern design and uses atomic state variables to manage system state transitions, implementing deterministic transitions between the states STOPPED, INITIALIZING, READY, RUNNING, PAUSED, and ERROR, and providing a state change callback mechanism. The real-time executor, based on the SCHED_FIFO scheduling policy of the Linux real-time kernel, sets high-priority real-time threads to execute data processing tasks, supports priority settings and CPU affinity binding, and achieves deterministic periodic task scheduling. The data processing pipeline adopts a filter chain-based architecture, which uses lambda functional programming to achieve zero-copy data transfer and supports arbitrary combinations and cascading of input filters, control compensation filters, and output filters. A multi-protocol communication interface provides a unified communication abstraction layer, supporting multiple real-time communication protocols such as UDP, EtherCAT, and WebSocket, enabling low-latency data exchange between numerical and physical substructures; The real-time performance monitoring module measures task execution time and jitter in real time, updates performance statistics using an exponential moving average algorithm, and provides monitoring of minimum, maximum, and average jitter performance metrics. The real-time system manager, real-time executor, data processing pipeline, multi-protocol communication interface, and real-time performance monitoring module are connected in sequence.
[0007] Furthermore, the real-time system manager includes: Atomic state management mechanism, using std::atomic <systemstate>Type variables store system state, and lock-free state transitions are achieved through atomic swap operations; An asynchronous configuration processing mechanism is used to prevent duplicate configuration processing using atomic flags. It supports startup request caching and automatically starts the system after configuration is complete. A thread-safe callback management mechanism supports multiple components registering state change listeners, automatically triggering relevant component responses when a state change occurs.
[0008] Furthermore, the real-time scheduling mechanism of the real-time actuator includes: The SCHED_FIFO first-in-first-out real-time scheduling strategy sets the thread priority to 80 to ensure preemptive execution of high-priority tasks. High-precision periodic execution loops are implemented by using std::chrono::steady_clock to provide a monotonic time base, achieving microsecond-level precision timed execution. A real-time jitter monitoring mechanism accurately calculates the time deviation of each execution and evaluates the real-time performance of the system.
[0009] Furthermore, the implementation of the data processing pipeline includes: The filter chain is built based on lambda functions, with each filter encapsulated as a callable object, supporting chained combinations of input, processing, and output; Zero-copy data transfer mechanism: Data packets are passed by reference in the pipe, avoiding the overhead of data copying; The system features an exceptional safety design, ensuring that the failure of a single filter does not affect the overall pipeline operation, and controlling data flow through return values.
[0010] Furthermore, the multi-protocol communication interface includes: The UDP communication interface is used for real-time data exchange with numerical simulation software and supports non-blocking data transmission and reception. The EtherCAT communication interface, based on a singleton pattern global manager, uniformly manages EtherCAT network resources to achieve real-time control of industrial-grade hardware devices. The WebSocket communication interface is used for real-time data transmission and system status synchronization with the host computer software. A unified communication abstraction layer provides standard interfaces such as initialize, sendData, receiveData, and isConnected; The EtherCAT communication interface further includes: The global manager uses a singleton pattern to avoid resource conflicts between multiple communicating instances and ensure system stability. A lock-free circular buffer, employing atomic operations and memory ordering semantics, enables high-performance single-producer, single-consumer data transfer. Multiple data processing modes, including buffer mode, pass-through mode and disable mode, are available to meet the needs of different application scenarios. The implementation of the lock-free circular buffer includes: Use std::atomic type read-write indexes and ensure memory access order through memory_order_acquire and memory_order_release semantics; A 64-byte aligned data structure avoids false sharing between multi-core CPUs; Modulo-optimized index calculation improves index update efficiency through bitwise operations.
[0011] Furthermore, the real-time performance monitoring module includes: An execution time statistics mechanism records the minimum execution time, maximum execution time, and average execution time in real time. The jitter measurement and filtering mechanism uses an exponential moving average algorithm to smooth instantaneous jitter, with a smoothing factor set to 0.01. An overtime detection and alarm mechanism automatically records and alarms when the execution time exceeds a set threshold.
[0012] Furthermore, it also includes a zero-order hold control mechanism: Output continuity is guaranteed; even if the data packet is invalid, the previous output value is retained to avoid output jumps. A communication interruption adaptation mechanism maintains the continuity of control output in unstable network environments; The filter chain is designed to be fault-tolerant, and return value control ensures that the filter chain will not be interrupted due to a single point of failure.
[0013] The real-time hybrid test control system also supports the following control algorithms: PID controllers provide proportional, integral, and derivative control functions and support real-time parameter adjustment; An adaptive controller, based on a model reference adaptive control algorithm, can automatically adjust control parameters according to the system response; The inverse dynamics controller calculates the required control input based on the desired trajectory, thereby achieving precise trajectory tracking control.
[0014] A real-time hybrid experimental system based on Linux-RT includes: The real-time control core runs on an industrial control computer configured with the Linux-RT kernel and is responsible for real-time data processing and control algorithm execution. The host computer configuration software communicates with the real-time control core via the WebSocket protocol, providing a visual configuration interface and real-time data monitoring; Multi-protocol hardware interface, supporting various hardware connection methods such as EtherCAT industrial bus, UDP network communication, and analog signal input / output; The real-time control core also includes: The configuration parsing module supports parsing JSON format configuration files, converting user configurations into internal system data structures; The data recording module records key data and system performance indicators in real time during the experiment. The fault diagnosis module provides system status monitoring, error detection, and automatic recovery functions.
[0015] The control method for the above-mentioned real-time hybrid test control system based on the Linux-RT system includes the following steps: S1: Initialize the system manager in the Linux-RT real-time kernel environment and set the system state to STOPPED. S2: Configure the scheduling strategy and priority of the real-time executor, and establish data processing pipelines and communication interfaces; S3: Parse user configuration files and build corresponding filter chains and communication connections; S4: Change the system state to READY and wait for the startup command; S5: After receiving the start command, change the system state to RUNNING state and start the real-time execution thread; S6: In the real-time execution loop, perform data acquisition, processing, and output operations at a set frequency; S7: Continuously monitor system performance metrics, record execution time and jitter statistics; S8: Upon receiving a stop command or detecting an error, safely halt real-time execution and transition the system state; In the real-time execution loop of step S6: A high-precision timer is used to control the loop cycle, ensuring the stability of the execution frequency; The input data is processed sequentially through a filter chain, the control algorithm is executed, and the output control signal is generated. Measure the execution time of each loop in real time and update performance statistics.
[0016] An application of a real-time hybrid test control system, real-time hybrid test system, or control method based on a Linux-RT system, applicable to one of the following hybrid test scenarios: Real-time hybrid test of seismic performance of building structure, controlling the shaking table and loading equipment through EtherCAT interface; Dynamic response tests of bridge structures, combining numerical simulation and physical models for collaborative testing; Vibration control test for mechanical equipment, realizing real-time interaction between numerical control algorithm and physical actuator; Experiments on complex structures with multiple degrees of freedom, supporting parallel coordinated control of multiple substructures.
[0017] By adopting the above technical solution, the present invention has at least one of the following beneficial effects compared with the prior art: (1) Excellent real-time performance: Based on the Linux-RT kernel's SCHED_FIFO scheduling strategy, combined with high-priority threads and atomic operations, the system can provide deterministic real-time response, meeting the strict time requirements of real-time hybrid experiments; (2) Strong system scalability: It adopts modular design and unified communication abstraction layer, supports multiple communication protocols such as UDP, EtherCAT, WebSocket, etc. New protocols can be easily integrated through plug-in, and the hardware platform selection is flexible to adapt to different test scenario requirements; (3) Low development cost: Based on the open-source Linux-RT kernel and general hardware platform, the system cost is reduced while maintaining industrial-grade real-time performance; (4) Performance optimization: Employs zero-copy data transfer, lock-free programming, cache optimization and other technologies to minimize system overhead and improve data processing efficiency; (5) High reliability: A complete status management mechanism, real-time performance monitoring, fault diagnosis and automatic recovery functions ensure the system operates stably for a long time; (6) Easy to use: It provides a graphical configuration interface and rich monitoring functions, allowing users to easily configure the system, control the test and analyze the results. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the overall architecture of the real-time hybrid test control system based on the Linux-RT system of this invention; Figure 2 This is a flowchart of the real-time system manager state transition process of this invention; Figure 3 This is a schematic diagram of the data processing pipeline structure of the real-time actuator of the present invention; Figure 4 This is a schematic diagram of the multi-protocol communication interface architecture of the present invention. Detailed Implementation
[0019] The following is in conjunction with the appendix Figure 1-4 The present invention will be further described in detail below to facilitate a clear understanding of the invention, but these descriptions do not constitute a limitation thereof.
[0020] In the description of this invention, it should be noted that the terms "upper," "lower," "front," "rear," "left," "right," "vertical," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limiting this invention.
[0021] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "joining" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0022] Example 1 This embodiment of a real-time hybrid test control system based on the Linux-RT system includes: The real-time system manager, designed using the singleton pattern, manages system state transitions using atomic state variables, implementing deterministic transitions between the STOPPED, INITIALIZING, READY, RUNNING, PAUSED, and ERROR states, and providing a state change callback mechanism; the real-time system manager includes: Atomic state management mechanism, using std::atomic <systemstate>Type variable stores system state, and realizes lock-free state transition through atomic exchange operation; Asynchronous configuration processing mechanism, uses atomic flag to prevent repeated configuration processing, supports start request cache, and automatically starts the system after configuration is completed; Multi-thread safe callback management mechanism, supports multiple component registration state change listening, and automatically triggers related component response when state changes.
[0023] Real-time executor, based on SCHED_FIFO scheduling policy of Linux real-time kernel, sets high-priority real-time thread to execute data processing tasks, supports priority setting and CPU affinity binding, and realizes deterministic periodic task scheduling; the real-time scheduling mechanism of the real-time executor includes: SCHED_FIFO first-in-first-out real-time scheduling policy, sets thread priority to 80, and ensures preemptive execution of high-priority tasks; high-precision periodic execution loop, uses std::chrono::steady_clock to provide a monotonic time reference, realizes timing execution with microsecond-level precision; real-time jitter monitoring mechanism, accurately calculates the time deviation of each execution, and evaluates the real-time performance of the system in real time.
[0024] Data processing pipeline, adopts a filter chain-based architecture, realizes zero-copy data transfer through lambda functional programming, and supports arbitrary combination and cascade of input filter, control compensation filter and output filter; the implementation of the data processing pipeline includes: filter chain construction based on lambda function, each filter is encapsulated as a callable object, supporting chain combination of input, processing and output; zero-copy data transfer mechanism, data packets are transferred by reference in the pipeline, avoiding data copy overhead; exception safety design, single filter failure does not affect the overall pipeline operation, and data flow is controlled through return value.
[0025] Multi-protocol communication interface, provides a unified communication abstraction layer, supports multiple real-time communication protocols such as UDP, EtherCAT and WebSocket, and realizes low-latency data exchange between numerical substructure and physical substructure; the multi-protocol communication interface includes: UDP communication interface, used for real-time data exchange with numerical simulation software, supporting non-blocking data transmission and reception; EtherCAT communication interface, based on singleton mode global manager to uniformly manage EtherCAT network resources, realizing real-time control of industrial-grade hardware devices; WebSocket communication interface, for real-time data transmission and system state synchronization with host computer software; unified communication abstraction layer, providing initialize, sendData, receiveData and isConnected standard interfaces; The EtherCAT communication interface further includes a global manager singleton mode, which avoids resource conflicts between multiple communication instances and ensures system stability; a lock-free ring buffer, which uses atomic operations and memory order semantics to achieve high-performance single-producer-single-consumer data transmission; and multiple data processing modes, including a buffering mode, a pass-through mode, and a disabled mode, which adapt to the needs of different application scenarios. The implementation of the lock-free ring buffer includes using read-write indexes of std::atomic types to ensure memory access order through memory_order_acquire and memory_order_release semantics; a 64-byte-aligned data structure to avoid false sharing phenomena between multi-core CPUs; and index calculation optimized through modulo operation to improve index update efficiency through bit operations.
[0026] A real-time performance monitoring module measures task execution time and jitter in real time, updates performance statistics using an exponential moving average algorithm, and provides minimum, maximum, and average jitter performance index monitoring. The real-time performance monitoring module includes an execution time statistics mechanism that records minimum, maximum, and average execution times in real time; a jitter measurement and filtering mechanism that uses an exponential moving average algorithm to smooth instantaneous jitter with a smoothing factor of 0.01; and a timeout detection and alarm mechanism that automatically records and alarms when the execution time exceeds a set threshold.
[0027] The real-time system manager, real-time executor, data processing pipeline, multi-protocol communication interface, and real-time performance monitoring module are connected in sequence.
[0028] In this embodiment, the real-time hybrid test control system based on the Linux-RT system further includes a zero-order hold control mechanism: Output continuity is guaranteed, even if the data packet is invalid, to maintain the last output value and avoid output jumps; A communication interruption adaptation mechanism maintains the continuity of control output in unstable network environments; A filter chain fault-tolerant design ensures that the filter chain is not interrupted by a single point of failure through return value control.
[0029] In addition, the real-time hybrid test control system of this embodiment also supports the following control algorithms: A PID controller provides proportional, integral, and derivative control functions and supports real-time parameter adjustment; An adaptive controller based on model reference adaptive control algorithm can automatically adjust control parameters according to system response; An inverse dynamics controller calculates the required control input based on the desired trajectory to achieve precise trajectory tracking control.
[0030] Embodiment 2 The real-time hybrid test system based on the Linux-RT system in this embodiment comprises: The real-time control core is running on the industrial computer configured with the Linux-RT kernel, and is responsible for real-time data processing and control algorithm execution; the real-time control core further comprises: a configuration parsing module supporting JSON format configuration file parsing to convert user configuration into system internal data structure; a data recording module for real-time recording of key data and system performance indicators during the test process; a fault diagnosis module providing system state monitoring, error detection and automatic recovery functions; The host computer configuration software communicates with the real-time control core through the WebSocket protocol, and provides a visual configuration interface and real-time data monitoring; The multi-protocol hardware interface supports EtherCAT industrial bus, UDP network communication, analog signal input and output and other hardware connection modes; Embodiment 3 The control method of the real-time hybrid test control system based on the Linux-RT system in this embodiment comprises the following steps: S1: initializing the system manager in the Linux-RT real-time kernel environment, and setting the system state to the STOPPED state; S2: configuring the scheduling strategy and priority of the real-time executor, establishing a data processing pipeline and a communication interface; S3: parsing the user configuration file, and constructing the corresponding filter chain and communication connection; S4: converting the system state to the READY state, and waiting for the start command; S5: after receiving the start command, converting the system state to the RUNNING state, and starting the real-time execution thread; S6: in the real-time execution loop, performing data acquisition, processing and output operations at a set frequency; in the real-time execution loop of step S6: using a high-precision timer to control the loop period to ensure the stability of the execution frequency; sequentially processing input data, executing control algorithms and outputting control signals through the filter chain; measuring the execution time of each loop in real time, and updating performance statistics.
[0031] S7: continuously monitoring system performance indicators, recording execution time and jitter statistics; S8: receiving a stop command or detecting an error, safely stopping real-time execution and converting the system state; Embodiment 4 The application of the real-time hybrid test control system or the real-time hybrid test system or the control method based on the Linux-RT system in embodiments 1-3 is applied to one of the following hybrid test scenarios: Real-time hybrid testing of seismic performance of building structures, control of the shaking table and loading equipment through the EtherCAT interface; Bridge structure dynamic response testing, combined with numerical simulation and physical model for collaborative testing; Mechanical equipment vibration control testing, realizing real-time interaction between numerical control algorithm and physical actuators; Multi-degree-of-freedom complex structure testing, supporting parallel coordinated control of multiple substructures.
[0032] Example 5 This example is combined with Example 1 and detailed description or specific implementation method. Figure 1-4 of the accompanying drawings.
[0033] (I) Basic system architecture implementation As shown in Figure 1 , this section provides a basic implementation of a real-time hybrid test control system based on Linux-RT system. The system mainly includes real-time system manager, real-time executor, data processing pipeline, multi-protocol communication interface and real-time performance monitoring module.
[0034] The real-time system manager is designed in singleton mode, ensuring that there is only one state management instance in the system. The system supports six states: STOPPED, INITIALIZING, READY, RUNNING, PAUSED, and ERROR. State transition is realized through atomic exchange operation: Atomic state management flow: 1. Check if the new state is different from the current state 2. If different, update the state variable 3. Trigger all registered state change callbacks This design avoids the priority inversion problem that may be caused by traditional lock mechanism, ensuring the atomicity and real-time performance of state transition.
[0035] As shown in Figure 2 , the real-time executor is based on the SCHED_FIFO scheduling policy of the Linux real-time kernel, setting high-priority real-time threads. The executor initialization process: Real-time scheduling setting steps: 1. Set thread scheduling policy to SCHED_FIFO 2. Set high-priority parameter 3. Bind CPU affinity setting In this way, the real-time executor can obtain deterministic CPU scheduling, ensuring timely execution of real-time tasks.
[0036] (II) Detailed implementation of data processing pipeline As Figure 3 This section describes the implementation of the data processing pipeline in detail. The data processing pipeline uses a filter chain-based architecture, with each filter encapsulated as a lambda function object.
[0037] The construction process of the filter chain is as follows: Step 1: Parse the filter definitions in the configuration file; Step 2: Create corresponding lambda functions according to the filter type; Step 3: Add lambda functions to the filter chain; Step 4: Set up the data transfer mechanism between filters.
[0038] Implementation process of the input filter: Data processing steps: 1. Check if there is data arriving at the communication interface 2. If there is data, receive and add it to the data packet 3. Set the valid state of the data packet 4. Return the processing result to the next filter This implementation uses a zero-copy mechanism, and data is passed between filters through references, avoiding the overhead of data copying. The return value of each filter is used to control the data flow, returning true to continue executing the subsequent filter, and returning false to interrupt the filter chain execution.
[0039] (Three) Real-time execution loop implementation This section describes the implementation of the real-time execution loop in detail. The execution loop uses high-precision timing control to ensure strict periodic execution.
[0040] Core process of the real-time execution loop: Execution loop steps: 1. Calculate the execution period and next wake-up time 2. Record the start time at the beginning of each period 3. Calculate and record the execution jitter 4. Sequentially execute all filters in the filter chain 5. Calculate the execution time and update performance statistics 6. Precisely time the next period This implementation uses a monotonic time reference to avoid the impact of system time adjustments on timing accuracy. By accurately calculating the jitter value of each execution, the real-time performance of the system is evaluated in real time.
[0041] (Four) Implementation of multi-protocol communication interface As Figure 4 As shown, this section implements a unified multi-protocol communication interface. All communication protocols inherit from the CommInterface base class, providing standardized interface functions.
[0042] Communication interface base class definition: Unified interface method: - initialize(): Initializes the communication interface - sendData(): Sends data packets - receiveData(): Receives data packets - isConnected(): Checks the connection status - cleanup(): Cleans up resources Example of UDP communication interface implementation: The UDP interface uses a non-blocking mode to avoid blocking and waiting when receiving data. Data is sent directly using the `sendto` function, and received data is checked for availability using the `recvfrom` function in conjunction with `select` or `poll` mechanisms.
[0043] EtherCAT communication interface implementation: The EtherCAT interface uses a global manager model to avoid resource conflicts between multiple communication instances. The manager is responsible for the initialization of the EtherCAT master station, the configuration of slave stations, data mapping, and periodic data exchange.
[0044] Key features include: - Get the global singleton object - Initialize network interface - Data exchange and processing WebSocket communication interface implementation: The WebSocket interface is used for real-time communication with the host computer configuration software, supporting functions such as configuration distribution, status reporting, and data monitoring. An asynchronous message processing mechanism is employed to avoid blocking the execution of real-time tasks.
[0045] (v) Zero-order hold control mechanism This section implements a zero-order hold control mechanism to ensure the continuity of the output signal.
[0046] The core idea of zero-order hold is that even if the input data is invalid or communication is interrupted, the output should retain the previous valid value to avoid the output jump causing an impact on the physical system.
[0047] Zero-order hold implementation process: Control strategy: 1. Check if the data packet is valid and contains data. 2. If valid, send the latest data and update the hold value. 3. If invalid, send the last held value. 4. Ensure output continuity This mechanism is particularly suitable for real-time hybrid testing scenarios, ensuring that the physical loading device can maintain a stable control signal even in cases of network instability or abnormal data processing.
[0048] (vi) System Integration and Application This section demonstrates the integration of the complete system and typical application scenarios.
[0049] System startup process: Step 1: Initialize the Linux-RT kernel environment and set real-time scheduling parameters; Step 2: Create a Real-Time System Manager instance and set its initial state to STOPPED; Step 3: Initialize various communication interfaces according to the configuration file; Step 4: Build a data processing pipeline and create a filter chain; Step 5: Start the real-time execution thread to begin periodic data processing; Step 6: Start the WebSocket service and wait for the host computer to connect; Step 7: The system is ready and awaits the test configuration and start command.
[0050] Typical application scenarios: Seismic testing of building structures: The numerical substructure uses finite element software such as OpenSees to simulate the superstructure of the building, while the physical substructure consists of actual specimens of key bottom components. The system receives displacement commands calculated by OpenSees via UDP protocol, controls an electro-hydraulic servo loader to load the physical specimen via EtherCAT protocol, and simultaneously feeds back the measured reaction force data to OpenSees.
[0051] Bridge structural dynamic response test: The numerical substructure simulates the main structure of the bridge, while the physical substructure is the actual model of the key nodes. The system coordinates the synchronous execution of numerical calculations and physical loading to achieve a realistic simulation of the bridge's response under dynamic loads.
[0052] Vibration control test for mechanical equipment: A numerical substructure operation control algorithm is used, with the actual mechanical equipment as the physical substructure. The system realizes real-time interaction between the control algorithm and the physical equipment to verify the effectiveness of the control strategy.
[0053] (vii) System performance verification This section demonstrates the methods for system performance verification.
[0054] Real-time performance testing: The system's response delay is measured using a high-precision timer, encompassing the entire process of data reception, processing, and transmission. The system is capable of meeting the stringent time requirements of real-time mixed experiments.
[0055] Stability test: The system underwent long-term continuous operation testing, with monitoring of system status and performance metrics. During the testing period, the system operated stably without communication interruptions or program crashes.
[0056] Multi-protocol concurrency testing: Simultaneously enabling multiple communication protocols including UDP, EtherCAT, and WebSocket, the stability of concurrent operation of multiple protocols was verified. Test results showed no interference between the protocols and correct data transmission.
[0057] Through extensive testing and verification, the real-time hybrid test control system based on the Linux-RT system of this invention has shown excellent performance in terms of real-time performance, stability, and scalability, and is particularly suitable as a technical platform for real-time hybrid test systems.
[0058] The above are merely preferred embodiments of the present invention and do not constitute any limitation on the structure of the present invention. The arrangement and quantity of the present invention are not limited to this example and can be optimized according to actual engineering conditions. Any modifications, equivalent changes, and decorations made to the above embodiments based on the technical principles of the present invention, without departing from the scope of the present invention, are still within the scope of the present invention.< / systemstate> < / systemstate>
Claims
1. A real-time hybrid test control system based on Linux-RT system, characterized in that, include: The real-time system manager adopts a singleton pattern design and uses atomic state variables to manage system state transitions, implementing deterministic transitions between the states STOPPED, INITIALIZING, READY, RUNNING, PAUSED, and ERROR, and providing a state change callback mechanism. The real-time executor, based on the SCHED_FIFO scheduling policy of the Linux real-time kernel, sets high-priority real-time threads to execute data processing tasks, supports priority settings and CPU affinity binding, and achieves deterministic periodic task scheduling. The data processing pipeline adopts a filter chain-based architecture, which uses lambda functional programming to achieve zero-copy data transfer and supports arbitrary combinations and cascading of input filters, control compensation filters, and output filters. A multi-protocol communication interface provides a unified communication abstraction layer, supporting multiple real-time communication protocols such as UDP, EtherCAT, and WebSocket, enabling low-latency data exchange between numerical and physical substructures; The real-time performance monitoring module measures task execution time and jitter in real time, updates performance statistics using an exponential moving average algorithm, and provides monitoring of minimum, maximum, and average jitter performance metrics. The real-time system manager, real-time executor, data processing pipeline, multi-protocol communication interface, and real-time performance monitoring module are connected in sequence.
2. The real-time hybrid test control system based on Linux-RT system according to claim 1, characterized in that, The real-time system manager includes: Atomic state management mechanism, using std::atomic <systemstate> Type variables store system state, and lock-free state transitions are achieved through atomic swap operations;< / systemstate> An asynchronous configuration processing mechanism is used to prevent duplicate configuration processing using atomic flags. It supports startup request caching and automatically starts the system after configuration is complete. A thread-safe callback management mechanism supports multiple components registering state change listeners, automatically triggering relevant component responses when a state change occurs.
3. The real-time hybrid test control system based on the Linux-RT system according to claim 2, characterized in that, The real-time scheduling mechanism of the real-time actuator includes: The SCHED_FIFO first-in-first-out real-time scheduling strategy sets the thread priority to 80 to ensure preemptive execution of high-priority tasks. High-precision periodic execution loops are implemented by using std::chrono::steady_clock to provide a monotonic time base, achieving microsecond-level precision timed execution. A real-time jitter monitoring mechanism accurately calculates the time deviation of each execution and evaluates the real-time performance of the system.
4. The real-time hybrid test control system based on Linux-RT system according to claim 3, characterized in that, The implementation of the data processing pipeline includes: The filter chain is built based on lambda functions, with each filter encapsulated as a callable object, supporting chained combinations of input, processing, and output; Zero-copy data transfer mechanism: Data packets are passed by reference in the pipe, avoiding the overhead of data copying; The system features an exceptional safety design, ensuring that the failure of a single filter does not affect the overall pipeline operation, and controlling data flow through return values.
5. The real-time hybrid test control system based on Linux-RT system according to claim 1, characterized in that, The multi-protocol communication interface includes: The UDP communication interface is used for real-time data exchange with numerical simulation software and supports non-blocking data transmission and reception. The EtherCAT communication interface, based on a singleton pattern global manager, uniformly manages EtherCAT network resources to achieve real-time control of industrial-grade hardware devices. The WebSocket communication interface is used for real-time data transmission and system status synchronization with the host computer software. A unified communication abstraction layer provides standard interfaces such as initialize, sendData, receiveData, and isConnected; The EtherCAT communication interface further includes: The global manager uses a singleton pattern to avoid resource conflicts between multiple communicating instances and ensure system stability. A lock-free circular buffer, employing atomic operations and memory ordering semantics, enables high-performance single-producer, single-consumer data transfer. Multiple data processing modes, including buffer mode, pass-through mode and disable mode, are available to meet the needs of different application scenarios. The implementation of the lock-free circular buffer includes: Use std::atomic type read-write indexes and ensure memory access order through memory_order_acquire and memory_order_release semantics; A 64-byte aligned data structure avoids false sharing between multi-core CPUs; Modulo-optimized index calculation improves index update efficiency through bitwise operations.
6. The real-time hybrid test control system based on Linux-RT system according to claim 5, characterized in that, The real-time performance monitoring module includes: An execution time statistics mechanism records the minimum execution time, maximum execution time, and average execution time in real time. The jitter measurement and filtering mechanism uses an exponential moving average algorithm to smooth instantaneous jitter, with a smoothing factor set to 0.
01. An overtime detection and alarm mechanism automatically records and alarms when the execution time exceeds a set threshold.
7. The real-time hybrid test control system based on Linux-RT system according to claim 1, characterized in that, It also includes a zero-order hold control mechanism: Output continuity is guaranteed; even if the data packet is invalid, the previous output value is retained to avoid output jumps. A communication interruption adaptation mechanism maintains the continuity of control output in unstable network environments; The filter chain is designed to be fault-tolerant, and return value control ensures that the filter chain will not be interrupted due to a single point of failure. The real-time hybrid test control system also supports the following control algorithms: PID controllers provide proportional, integral, and derivative control functions and support real-time parameter adjustment; An adaptive controller, based on a model reference adaptive control algorithm, can automatically adjust control parameters according to the system response; The inverse dynamics controller calculates the required control input based on the desired trajectory, thereby achieving precise trajectory tracking control.
8. A real-time hybrid experimental system based on Linux-RT, characterized in that, include: The real-time control core runs on an industrial control computer configured with the Linux-RT kernel and is responsible for real-time data processing and control algorithm execution. The host computer configuration software communicates with the real-time control core via the WebSocket protocol, providing a visual configuration interface and real-time data monitoring; Multi-protocol hardware interface, supporting various hardware connection methods such as EtherCAT industrial bus, UDP network communication, and analog signal input / output; The real-time control core also includes: The configuration parsing module supports parsing JSON format configuration files, converting user configurations into internal system data structures; The data recording module records key data and system performance indicators in real time during the experiment. The fault diagnosis module provides system status monitoring, error detection, and automatic recovery functions.
9. A control method for a real-time hybrid test control system based on a Linux-RT system according to any one of claims 1-7, characterized in that, Includes the following steps: S1: Initialize the system manager in the Linux-RT real-time kernel environment and set the system state to STOPPED. S2: Configure the scheduling strategy and priority of the real-time executor, and establish data processing pipelines and communication interfaces; S3: Parse user configuration files and build corresponding filter chains and communication connections; S4: Change the system state to READY and wait for the startup command; S5: After receiving the start command, change the system state to RUNNING state and start the real-time execution thread; S6: In the real-time execution loop, perform data acquisition, processing, and output operations at a set frequency; S7: Continuously monitor system performance metrics, record execution time and jitter statistics; S8: Upon receiving a stop command or detecting an error, safely halt real-time execution and transition the system state; In the real-time execution loop of step S6: A high-precision timer is used to control the loop cycle, ensuring the stability of the execution frequency; The input data is processed sequentially through a filter chain, the control algorithm is executed, and the output control signal is generated. Measure the execution time of each loop in real time and update performance statistics.
10. An application of a real-time hybrid test control system based on a Linux-RT system according to any one of claims 1-7, or a real-time hybrid test system based on a Linux-RT system according to claim 8, or a control method according to claim 9, characterized in that, It is applied to one of the following mixed testing scenarios: Real-time hybrid test of seismic performance of building structure, controlling the shaking table and loading equipment through EtherCAT interface; Dynamic response tests of bridge structures, combining numerical simulation and physical models for collaborative testing; Vibration control test for mechanical equipment, realizing real-time interaction between numerical control algorithm and physical actuator; Experiments on complex structures with multiple degrees of freedom, supporting parallel coordinated control of multiple substructures.
Citation Information
Cited By
Vehicle-mounted kernel queue transmission optimization system and method based on NTB-vNTB EPF collaboration
CN121210156A
A vehicle-mounted kernel queue transmission optimization system and method based on NTB-vNTB EPF cooperation
CN121210156B
