The integration of large-scale wind farm has undesirable impacts on the grid due to the randomness and intermittency of the wind power.An effective way to solve this problem is to deploy battery energy storage systems(BESS)in a wind farm.An optimization model is developed considering constraints like battery lifecycle and fluctuation of wind power.A two-stage modern interior-point method is proposed for an optimal control strategy for BESS,using the results of wind power prediction.Constraints like discharge capacity of battery without a specific expression may cause divergence.By decoupling the model into two stages and adjusting the unsolved constraints in the second stage,divergence can be avoided successfully.The adjust time of BESS output can be shortened by using interpolated wind power forecast results,thus limiting the fluctuation of wind power under different time scales.The simulation results show that this algorithm has a good convergence and a satisfactory control effect.It also has characteristics of polynomial time,which is an advantage for online real-time control.