| In the context of the energy crisis,mankind is under pressure to undergo an energy transition.Solar energy is a clean,renewable energy source with a wide range of uses.But because solar energy is subject to the earth’s rotation,cloud shading and other reasons make it has a random,intermittent,low energy density resulting in volatility and other disadvantages,will make the entire power system in the grid can not be safe and smooth operation.Therefore,accurate and effective prediction of photovoltaic power generation can enable safe and stable operation of the grid.In this paper,we use the Adaptive Spiral Flying Sparrow Search Algorithm(ASFSSA)to find the hyperparameters of Long Short Term Mermory network(LSTM)and propose an optimized LSTM model to predict the ultra-short-term PV power generation.Firstly,the hyperparameters of the conventional model are difficult to adjust,and the sparrow search algorithm(SSA)is used to optimize the hyperparameter adjustment process of the model,and the SSA-LSTM model is established,and the performance is compared with the LSTM model,and the root mean square error,mean absolute error and mean absolute percentage error are reduced by 11.09%,9.549%and 2.256%,respectively,and the Nash coefficient is improved by 6.58%.Secondly,in order to solve the problems that SSA is easy to fall into local optimum and large randomness,the sparrow algorithm is improved,and the specific refinements are as follows:replacing the pseudo-random number generator of SSA with Tent tent mapping,optimizing the population initialization process,making the initial population distribution more uniform;introducing adaptive weight strategy and Levy flight mechanism fusion,making the search method become extensive and flexible,increasing the optimal feasible solution The introduction of the variable spiral search strategy makes the algorithm’s search scope more detailed and effectively improves the search accuracy.The performance of ASFSSA is tested by six basic algorithm test functions and compared with other search algorithms.Finally,the ASFSSA-LSTM model is simulated and analyzed for ultra-short-term PV power prediction using the power data of a PV power station in Xinjiang,and compared with other models.The results show that the root mean square error,mean absolute error,and mean absolute percentage error of the proposed model ASFSSA-LSTM are reduced to 0.12381,0.08887,and 1.8492%,respectively,and compared with LSTM,SSA-LSTM,WOS-LSTM,and GWO-LSTM,the RMSE of ASFSSA-LSTM is reduced by 10.88%,1.073%,1.196%,1.371%,MAE decreased by 9.88%,1.9%,0.6%,0.11%,MAPE decreased by 2.39%,0.48%,0.21%,0.1%,and NSE improved by 6.75%,0.59%,0.34%,0%,respectively. |