To solve the problem of optimal allocation of energy storage system, in this paper, we presented a hybrid energy storage capacity optimization method by improving PSO Algorithm. A hybrid energy storage capacity optimization model has been constructed, which considers battery and ultracapacitor as a hybrid energy storage device, considers the lowest annual life cycle cost of hybrid energy storing device as the optimization objective, and considers the indices such as the loss of power supply probability as constrain conditions. Then solves the problem with acceleration coefficient improved PSO algorithm, and simulates the case using Matlab. The simulation result shows that the method not only can optimize the work condition of the battery, reduce the cost of the energy storage system and the life cycle cost, but can improve the convergence speed.