Safe and Intelligent Control for Maglev Trains
Other Articles

How Safety-Aware Deep Reinforcement Learning Can Stabilise Maglev Train–Guideway Systems
Study conducted by Ir Prof. Yi-Qing NI and his research team

Maglev trains offer an advanced form of transportation with the potential for high-speed, comfortable and reliable travel. Unlike conventional railways, however, maglev trains rely on precise electromagnetic forces to maintain a stable air gap between the train and its guideway. Even small changes in this gap can affect the stability and safety of the system.
The challenge becomes more complex when the flexibility of the guideway is considered. As a maglev train interacts dynamically with its guideway, vibration and deformation can influence the levitation system, while changes in the levitation force can in turn affect guideway motion. Under disturbances or resonance conditions, this coupled interaction may lead to increasingly unstable vibrations and, in extreme cases, the risk of the train approaching or striking the guideway. Figure 1 illustrates the configuration of the electromagnetic levitation (EMS)-type maglev system and its flexible guideway.
Published in Mechanical Systems and Signal Processing [1], Prof. Yi-Qing NI, Yim, Mak, Kwok & Chung Endowed Professorship in Smart Structures and Chair Professor of Smart Structures and Rail Transit of the Department of Civil and Environmental Engineering at The Hong Kong Polytechnic University, and his research team developed a new control strategy that combines safe deep reinforcement learning (SDRL) with a reciprocal control barrier function (RCBF). The approach aims to allow an intelligent controller to optimise maglev performance while explicitly maintaining the system within a predefined safe operating range.

(a)
(b)

(c)
Figure 1.(a) Maglev—Analysis of magnet-track coupled vibration, (b) real-time calculation and control of vehicle-track magnetic forces in a vector-form finite element model of a maglev train-levitation-track-bridge system, (c) cross-section of an EMS-type maglev system and a schematic of a single EMS module with flexible guideway.
Bringing Safety into Intelligent Learning
Deep reinforcement learning (DRL) enables a control system to learn how to make decisions by interacting with its environment. However, conventional DRL mainly seeks to maximise a long-term reward and does not automatically guarantee that the learned control policy will remain within practical safety constraints.
To address this limitation, the research team incorporated an RCBF directly into the reward function of the DRL controller. The RCBF acts as a safety mechanism: as the system approaches the boundary of the predefined safe region, the barrier function increases sharply, encouraging the controller to avoid unsafe states while still pursuing its control objectives. A damping coefficient is also introduced to regulate the balance between safety and control optimality.
The resulting RCBF–SDRL controller was designed for a nonlinear maglev system coupled with a flexible guideway. The controller aims to maintain the air gap close to its reference value while reducing control effort and preventing the system from reaching unsafe boundaries. The team also established theoretical analyses addressing the safety and stability of the resulting control system.
Learning to Control a Dynamic Maglev System
The team first developed a mathematical model that captures the interaction between the electromagnetic levitation system and the flexible guideway. The guideway was represented as a flexible beam, while the nonlinear electromagnetic force was incorporated into the levitation dynamics. This coupled model allows the controller to account for guideway deformation rather than treating the guideway as perfectly rigid.
The RCBF–SDRL controller was implemented using the twin delayed deep deterministic policy gradient (TD3) framework. During training, the controller learned to maintain a stable air gap while respecting the safety constraints. Compared with several baseline reinforcement-learning approaches, including TD3, DDPG, RCBF-DDPG and HJB-DDPG, the RCBF–SDRL approach achieved faster and more stable convergence during training.
Fast Response under Challenging Conditions
Numerical simulations showed that the proposed controller could rapidly bring the system towards its target air gap. In the simulated maglev system, the RCBF–SDRL controller reached the reference condition in approximately 0.15 seconds, compared with about 0.8 seconds for the PID controller (see Figure 2). It also maintained zero overshoot in the tested cases.

(a) (b)
Figure 2. Air gap curves and control signal curves of the PID, the GA–ST–SMC and the proposed RCBF–SDRL controllers: (a) air gap curves, (b) control signal curves
More importantly, the controller remained effective when operating conditions changed. The team tested different train loads, sudden load fluctuations, external disturbances and track irregularities. Under changing train loads, for example, the RCBF–SDRL controller maintained zero overshoot in the simulated cases, while the PID controller exhibited substantially larger oscillations (see Figure 3). Under random disturbances and track irregularities, the proposed controller also maintained comparatively smooth air-gap responses.

(a) (b)
Figure 3. Air gap curves and control signal curves of PID, AMPC and RCBF–SDRL controllers under scenarios with vanishing disturbances: (a) Air gap curves, (b) Control signal curves
From Simulation to Laboratory Demonstration
To further examine practical control performance, the team conducted experiments using a magnetic levitation laboratory system (see Figure 4). The experimental setup consisted of a magnetic levitation unit, an electronic control box and a data acquisition system, with the control algorithm implemented through a computer-based closed-loop system.

(a)

(b)
Figure 4. The magnetic levitation system: (a) setup of the system, (b) diagram of the system structure
Under disturbance-free conditions, the RCBF–SDRL controller reached the target air gap in approximately 0.5 seconds, compared with 2.5 seconds for PID and 0.6 seconds for adaptive model predictive control (AMPC). The RCBF–SDRL controller also showed favourable performance in cumulative error measures including IAE, ISE and ITSE.
The experiments further examined disturbances and different levitated masses. Under both persistent and vanishing disturbance conditions, the proposed controller reached the target air gap in approximately 0.6 seconds, while the PID and AMPC controllers required around 2 seconds and 0.8 seconds, respectively (see Figure 5). When different masses were tested to represent changing load conditions, the RCBF–SDRL controller consistently achieved convergence in about 0.5 seconds, compared with approximately 2 seconds for PID and 0.7 seconds for AMPC.


(a) (b)
Figure 5. Air gap and voltage curves of PID, AMPC and RCBF–SDRL controllers: (a) air gap curves, (b) voltage curves
Towards Safer Intelligent Transportation
The study demonstrates how artificial intelligence can be combined with established control theory to address a key challenge in intelligent transportation: how to make learning-based control not only effective but also safety-aware.
By embedding the RCBF within the reinforcement-learning framework, the proposed approach provides a mechanism for incorporating explicit safety constraints into the learning process. The study therefore offers a potential pathway towards intelligent control systems that can adapt to changing operating conditions while maintaining stable and safe behaviour.
For future maglev transportation, such safety-aware intelligent control could support more resilient operation in the presence of changing passenger loads, environmental disturbances and track irregularities. The research provides a foundation for further development and validation of intelligent control technologies for advanced rail transportation systems.
Prof. Ni was recognised by Stanford University as one of the top 2% most-cited scientists worldwide (career-long & single-year) in the field of civil engineering for eight consecutive years, from 2019 to 2026. He is a leading expert in structural health monitoring and vibration control for large-scale infrastructure, including bridges, high-rise buildings, high-speed rail and Maglev systems. His research excellence has earned him major national and international recognition, including the 16th Guanghua Engineering Science and Technology Award from the Chinese Academy of Engineering (2026), regarded as the highest award in China’s engineering sector; the Second Prize of the National Science and Technology Progress Award (2016); the First Prize of the Guangdong Science and Technology Progress Award (2014); Gold Medals (with Special Recognition) at the International Exhibition of Inventions of Geneva (2009 and 2013); and the “Structural Health Monitoring Person-of-the-Year” Award (2017).
Prof. Ni has published more than 440 SCI journal papers, with an h-index of 77 and over 26,500 citations on Google Scholar. He currently serves as a Co-Editor-in-Chief of the Journal of Infrastructure Intelligence and Resilience (Elsevier) and Intelligent Transportation Infrastructure (Oxford), as well as an Associate Editor of the Journal of Civil Structural Health Monitoring (Springer) and Journal of Vibration and Control (SAGE), and is a Fellow of the Hong Kong Institution of Engineers and the American Society of Civil Engineers (ASCE).
In 2015, the Ministry of Science and Technology of the People’s Republic of China approved the establishment of the National Rail Transit Electrification and Automation Engineering Technology Research Centre (Hong Kong Branch) in recognition of Prof. Ni’s significant contributions to the nation’s rail sector, with Prof. Ni serving as its Director.
| References |
|---|
[1] Zhu, Q., Wang, S.-M., & Ni, Y.-Q. (2025). Reciprocal control barrier function enhanced safe deep reinforcement learning control for maglev train–guideway coupling system. Mechanical Systems and Signal Processing, 241, 113495. DOI: 10.1016/j.ymssp.2025.113495.
Ir Prof. Yi-Qing NI Yim, Mak, Kwok & Chung Endowed Professorship in Smart Structures, |


