An optimal design of a three-component hybrid fuel cell electric vehicle comprised of fuel cells, battery, and supercapacitors is presented. First, the benefits of using this hybrid combination are analyzed, and then the article describes an active power-flow control strategy from each energy source based on optimal control theory to meet the demand of different vehicle loads while optimizing total energy cost, battery life and other possible objectives at the same time. A cost function that minimizes the square error between the desired variable settings and the current sensed values is developed. A gain sequence developed compels the choice of power drawn from all devices to follow an optimal path, which makes trade-offs among different targets and minimizes the total energy spent. A new method is introduced to make the global optimization into a real-time based control. A model is also presented to simulate the individual energy storage systems and compare this invention to existing control strategies, the simulation results show that the total energy spent is well saved over the long driving cycles, also the fuel cell and batteries are kept operating in a healthy way.