Because hydrogen can be extracted naturally and stored for a long time, different types of fuel cells have been developed to generate clean power, particularly for use in vehicles. However, the power demand of a running vehicle leads to unstable and irregular loading of fuel cells. This not only reduces fuel cell lifespan and efficiency but also affects driving safety when the slow output response cannot satisfy an abrupt increase in power demand. Magnetic flywheels with characteristics such as high energy density, high-speed charging ability, and low loss have been extensively used in Formula One cars. This study developed a hybrid powertrain in which a magnetic flywheel system (MFS) is integrated with the fuel cells to solve the aforementioned problems. Moreover, an auto-tuning proportional integral derivative (PID) controller based on the controls of a multiple adaptive neuro-fuzzy interference system and particle swarm optimization was designed for MFS control. Furthermore, MATLAB/Simulink simulations considering an FTP-75 urban driving cycle were conducted, and a variability improvement of approximately 273% in fuel cell output was achieved. (C) 2016 Elsevier Ltd. All rights reserved.