Design of an optimal fuzzy scheme for a fuel cell/battery vehicle to control the power flow between the main components, i.e. the fuel cell, electric motor, and battery, under various driving conditions, is considered in this paper. For this purpose, firstly, the optimum sizes of the main components are calculated by means of a Particle Swarm Optimization (PSO) algorithm. Subsequently, a Fuzzy Logic Controller (FLC) is devised for the control of the power flow. Finally, the FLC is optimized for various driving patterns and an optimal control scheme, based on PSO application, is proposed for energy management of the Fuel Cell Vehicle (FCV) under various traffic conditions. In each one of the mentioned stages, the same optimization process is conducted by applying a Genetic Algorithm (GA) for comparison with the result of the PSO. The results of the computer simulation are compared over diverse driving conditions. The results give an acceptable indication of progress in fuel economy for various driving patterns, using the proposed optimal fuzzy controller. (C) 2016 Sharif University of Technology. All rights reserved.