A hybrid powertrain integrating the magnetic flywheel and fuel cells is proposed. An auto-tuning PID controller is designed for MFS control. The MIMO-ANFIS and PSO based optimal control is realized. A 27.3% improvement in the output variability of fuel cell is achieved under control.