Introduction

With the increasing penetration of renewable energy into the traditional power grid, issues related to grid operation security have emerged. Therefore, accurate power forecasting for renewable sources such as solar and wind energy is essential. However, precise solar power forecasting remains challenging.

A large number of studies have been conducted on solar power forecasting in the past. Most of these studies utilize statistical analysis methods based on data-driven models to predict solar energy time series using historical measurement data1,2. Statistical forecasting requires establishing mathematical relationships among various influencing factors, such as load, time consumption, and the share of industrial output in total power generation, before a mathematical model can be employed for predictions. This entire process is time-consuming, often involving calibration and adjustment of the mathematical models. Artificial intelligence techniques, such as back propagation (BP) neural network algorithms3, multi-layer perceptron neural network (MLPNN) model, radial basis function neural network (RBFNN) neural network, recurrent neural network (RNN) neural network4,5,6, support vector machine (SVM) and adaptive network-based fuzzy inference system (ANFIS) hybrid models7,8, have been employed in solar power forecasting. The ELM algorithm has also been utilized for short-term power prediction9,10. The particle swarm optimization (PSO) was used to update the weights and biases of the ELM model, demonstrating superior performance compared to BP prediction models11. The fundamental ELM model randomly selects weights and bias matrices; however, improved ELM algorithms can yield better predictive performance12. Additionally, there are studies utilizing numerical weather prediction or satellite imagery to develop physical models for forecasting solar irradiance and PV power13,14. In practice, to meet decision-making needs, it is essential to consider different forecasting horizons when selecting an appropriate prediction method15.

Since solar output power primarily depends on meteorological factors, it exhibits significant uncertainty. The aim of this study is to further improve the accuracy of solar power prediction using machine learning algorithms. A hybrid P-ELM algorithm is used, integrating the persistence method and the characteristics of ELM for power forecasting Temperature, irradiance, and solar output power are used as input parameters, while the temperature, irradiance, and solar output power at the next instant serve as output parameters. Data is collected at 15-minute intervals, yielding 124 sets of temperature and irradiance measurements from a specific location as sample data. The maximum output power of the solar system is calculated based on the model in16. The performance of the P-ELM algorithm is evaluated in terms of mean absolute error (MAE) and root mean square error (RMSE). From the simulation results, the P-ELM algorithm provides the temperature, insolation and solar power output at the next instant, i.e., it predicts the temperature, insolation and solar power output values one day in advance. The performance is better than the persistence method and ELM algorithm, making is more suitable for the practical application of solar power forecasting. It mitigates the uncertainties caused by meteorological factors and can effectively enhance the security and stability of the power system.

In the short-term range, the proposed method combines the advantages of both the persistence method and the ELM algorithm. The simulations were conducted on an Intel(R) Core(TM) i7-7700HQ CPU at 2.8 GHz, with 16 GB RAM, running a 64-bit Windows 10 system. MATLAB 2014b was used as the simulation tool.

Extreme learning machine algorithm

The ELM algorithm is a type of single hidden layer feedforward neural network (SLFN), as shown in (Fig. 1). In this structure, the hidden layer does not require adjustment, and the input weights and biases can be arbitrarily specified, while the output weights are calculated analytically17. Unlike traditional single hidden layer neural network learning algorithms, ELM aims not only to minimize training error but also to achieve a minimal norm of the output weights. Its computational speed is hundreds to thousands of times faster than that of traditional neural networks, while also exhibiting universal approximation capability. The ELM algorithm flow is illustrated in (Fig. 2).

Fig. 1
figure 1

The structure of the SLFN model.

Fig. 2
figure 2

The flowchart of ELM algorithm.

For a neural network, it is entirely possible to think of it as a function, which is much simpler in terms of inputs and outputs alone. As can be seen from the model structure of the algorithm in (Fig. 1), from left to right the input of the neural network is the training sample set x, in the middle is the hidden layer, and the hidden layer and the input layer are fully connected. So far the computation of ELM algorithm from input to output is shown below:

The samples are selected such that S samples form a matrix (Xj, Yj), j = 1,2,3 …S. where X is a p-dimensional input matrix and Y is a q-dimensional target matrix. First, initialize the weight matrix wi and bias matrix bi connecting the input layer, and set the number of hidden layer neurons to L, i = 1, 2,…, L .

Then, the activation function g(.) is selected to calculate the hidden layer output. The Sigmoid function is used as the activation function in this study, and the ELM output model is shown as:

$$\sum\limits_{{i = 1}}^{L} {\beta _{i} g(w_{i} x_{j} + b_{i} ) = y_{j} } ,j = 1,2, \cdots ,S$$
(1)

where the parameter of the input weight vector \(w_{i} = [w_{{i1}} {\text{ }}w_{{i2}} {\text{ }}...{\text{ }}w_{{if}} ]^{T}\) is arbitrarily selected to connect the input node to the i-th hidden layer node; βi is the output weight vector connecting between the ith hidden layer node and the output node; and bi is the threshold value of the i-th hidden layer node. xj is the feature vector of the j-th sample, yj denotes the vector of dependent variables corresponding to the j-th dependent variable, and Y is the output of the neural network.

Equation (Eq.) (1) can be written in the following form18:

$$G\beta = Y$$
(2)

where

$$G = \left[ {\begin{array}{*{20}c} {g(w_{1} x_{1} + b_{1} )} & \cdots & {g(w_{L} x_{1} + b_{L} )} \\ \vdots & \cdots & \vdots \\ {g(w_{1} x_{S} + b_{1} )} & \cdots & {g(w_{L} x_{S} + b_{L} )} \\ \end{array} } \right]_{{S \times L}}$$
(3)
$$\beta = \left[ {\begin{array}{*{20}c} {\beta _{{\text{1}}} } & {\beta _{{\text{1}}} } & \cdots & {\beta _{{\text{L}}} } \\ \end{array} } \right]$$
(4)

Finally, the output matrix of hidden layer weights is computed, that is, the least squares solution of this system14. The calculation formula is as:

$$\begin{gathered} \left\| {G(w_{1} \cdots w_{L} ,b_{1} \cdots b_{L} )\hat{\beta } - Y} \right\| \hfill \\ = \mathop {\min }\limits_{\beta } \left\| {G(w_{1} \cdots w_{L} ,b_{1} \cdots b_{L} )\beta - Y} \right\| \hfill \\ \end{gathered}$$
(5)
$$\hat{\beta } = (G^{T} G)^{{ - 1}} H^{T} Y$$
(6)

According to the theory of the Moor-Penrose generalized inverse19, the output of weights matrix is:

Unlike traditional single hidden layer neural network learning algorithms, ELM aims not only to minimize training error but also to achieve a minimal norm of the output weights. Feedforward neural networks can achieve lower training errors, smaller weight norms, and enhanced network generalization performance. The ELM is designed to minimize both training errors and the norm of the output weights.

P-ELM algorithm

Persistence method

The persistence method assumes that the value at instant t + x remains consistent with the value at instant t; in other words, the persistence technique is based on the hypothesis of a high correlation between the current and future values. This method demonstrates higher accuracy in short-term and very short-term predictions compared to other forecasting methods. However, as the prediction time scale increases, the accuracy of the persistence method declines rapidly. The model for this method is presented:

$$x(t + 1) = x(t)$$
(7)

P-ELM algorithm

The P-ELM algorithm, which combines the persistence method with the ELM algorithm, retains the simplicity and accuracy of the persistence method while incorporating the rapid learning and error minimization capabilities of the ELM algorithm.

The sample is described as \((X_{i} ,X_{{i + 1}} )_{{i = 1}}^{{S{\text{ - 1}}}} ,\begin{array}{*{20}c} {} \\ \end{array} i = 1,2, \cdots ,S,\)\(X_{i} \in R^{p} \begin{array}{*{20}c} {} \\ \end{array} X_{i} = \left[ {\begin{array}{*{20}c} {X_{{i1}} } & {X_{{i2}} } & \cdots & {X_{{i\left( {S - 1} \right)}} } \\ \end{array} } \right]^{T} ,X_{{i + {\text{1}}}} \in R^{p} ,\)

\(X_{{i + {\text{1}}}} = \left[ {\begin{array}{*{20}c} {X_{{\left( {i + {\text{1}}} \right){\text{2}}}} } & {X_{{\left( {i + {\text{1}}} \right){\text{3}}}} } & \cdots & {X_{{\left( {i + {\text{1}}} \right)S}} } \\ \end{array} } \right]^{T} ,\)

The vectors at instant i are used as inputs, the vectors at instant i + 1 are used as outputs, and the dimensionality of the input and output vectors coincides with p. The number of nodes in the hidden layer is L and the activation function is g(.). The mathematical model of the P-ELM can be described by:

$$\sum\limits_{{i = 1}}^{L} {\beta _{i} g(w_{i} X_{j} + b_{i} ) = X_{{j + 1}} } ,j = 1,2, \cdots ,S{\text{ - 1}}$$
(8)

where β is the output weight matrix connecting the hidden layer and the output layer, w is the input weight matrix connecting the input layer and the hidden layer, and b is the bias matrix. This can be expressed in the form of Eq. (2).

The matrix is given:

$$G = \left[ {\begin{array}{*{20}c} {g(w_{1} X_{1} + b_{1} )} & \cdots & {g(w_{L} X_{1} + b_{L} )} \\ \vdots & \cdots & \vdots \\ {g(w_{1} X_{{S{\text{ - 1}}}} + b_{1} )} & \cdots & {g(w_{L} X_{{S{\text{ - 1}}}} + b_{L} )} \\ \end{array} } \right]_{{(S{\text{ - 1}}) \times L}}$$
(9)

The target matrix is given:

$$Y = \left[ {X_{2} ,X_{3} , \cdots X_{S} } \right]^{T}$$
(10)

The output weight matrix is shown in Eq. (6).

The P-ELM algorithm model structure is similar to the basic ELM algorithm model structure, as shown in (Fig. 3).

Fig. 3
figure 3

The model structure of P-ELM algorithm.

Simulation model description

PV array model description

The result of model predict is the output power of the PV system, and the PV generator is affected not only by solar irradiation, reflection, and temperature but also by the parameters and performance of the generator itself20. The PV array is the fundamental power conversion unit of the PV generator, exhibiting nonlinear characteristics and being expensive; and requires a lot of time to obtain its operating curves under various operating conditions. This paper employs the PV generator model based on a 100 W monocrystalline solar panel as a reference template, allowing the operational characteristics of the PV array to be applied under various operating conditions and physical parameters, with the model parameters summarized in (Table 1). Its maximum power point output can be expressed as:

$$Pv = \eta AI[1 - 0.05(te - 25)]$$
(11)

Where η is the PV array conversion rate A is the area of the PV array, I is the daily irradiance, and te is the outdoor air temperature.

The maximum power point tracking (MPPT) technology is an essential part for improving the efficiency of PV systems, MPPT technology automatically identifies the voltage VR and current IR that maximize the operational efficiency of the PV array under given temperature and irradiation21,22, as illustrated in (Fig. 4).

Table 1 Photovoltaic generator model parameters.
Fig. 4
figure 4

PV array power characteristic curve.

Description of performance estimation

This paper employs different statistical analysis metrics, namely the MAE and the RMSE, as indicators for forecasting trend recognition and evaluates the performance of each computational method. The formulas for calculating these metrics are as follows:

$$MAE = \frac{1}{N}\sum\limits_{{j = 1}}^{N} {\left| {y_{j} - t_{j} } \right|}$$
(12)
$$RMSE = \sqrt {\frac{{\text{1}}}{N}\sum\limits_{{j = 1}}^{N} {\left( {y_{j} - t_{j} } \right)^{2} } }$$
(13)

where yj and tj are the measured and corresponding predicted values of solar output power; N is the number of sampling points.

Simulation and result analysis

The input parameters of the P-ELM structure include the outdoor air temperature t, daily irradiance I, and the maximum output power P of the photovoltaic array at instant i; the output parameters correspond to the outdoor air temperature t, daily irradiance I, and maximum output power P at instant i + 1. The test data is obtained from a photovoltaic array simulation model, comprising a total of 124 sets of data. The first 100 sets are utilized as training samples for the P-ELM algorithm, while the remaining 24 sets serve as testing samples.

For comparative analysis, the persistence algorithm, ELM algorithm, and P-ELM algorithm are utilized in this section. To verify the advantages, two-part experiments are conducted on the system: one is the experiment of solar power output prediction, and the other is the training and testing results of the ELM and P-ELM algorithms. Considering that the persistence algorithm did not have this training step, so the persistence algorithm did not conduct this experiment. The prediction results of the persistence method, ELM algorithm, and P-ELM algorithm on the test samples are shown in (Fig. 5). The MAE and RMSE are computed and listed in (Table 2 )to compare with the persistence method and ELM algorithm.

The training and testing results of the ELM and P-ELM algorithms are shown in (Figs. 6 and 7), respectively. (Table 3) is the ELM and P-ELM training time comparison table.

Fig. 5
figure 5

Comparison of three methods for solar power output prediction.

Fig. 6
figure 6

Training and testing results of ELM prediction algorithm.

Fig. 7
figure 7

Training and testing results of the P- ELM prediction algorithm.

Solar output power prediction curve can be seen from (Fig. 5). Through the comparison of different prediction methods, the persistence algorithm and the ELM algorithm show a large discrepancy between the predicted fluctuation results and the actual output power curve, making the prediction inaccurate. In contrast, the PELM algorithm predicts fluctuations that are similar to the actual output curve, and the difference between the predicted power values and the actual power values is smaller compared to the ELM algorithm, indicating better performance. Combined with the statistical index data for solar output power prediction in (Table 2), it can be concluded that the combination of the persistence method and ELM proposed in this paper can better realize the tracking of power fluctuations and get better prediction results, and the prediction effect of this method is better.

From the training data curves of ELM prediction algorithm and P-ELM prediction algorithm in (Figs. 6 and 7), it can be seen the fluctuation of the testing output power curve and the fluctuation of the predicted output power curve are not significantly different according to the training results of the two algorithms. Analyzing the testing results, the ELM algorithm’s predicted output power curve shows large discrepancies compared to the testing output power curve, indicating poor prediction performance. In contrast, the P-ELM algorithm shows a predicted output power curve that closely follows the fluctuations in the testing output power curve, indicating better prediction accuracy. In summary, the P-ELM algorithm achieves better prediction results. The statistical metrics MAE and RMSE for the three prediction algorithms are shown in (Table 2). Since the weight and bias matrices in both the ELM and P-ELM algorithms are randomly assigned, the statistical metrics vary with each run. Here, data from five randomly selected runs are compared.

Table 2 Comparison of statistical indicators for solar output power prediction.

As can be seen from the data in (Table 2), the metrics of the persistence method are fixed and significantly worse than ELM and P-ELM algorithms. The P-ELM algorithm exhibits notably better performance metrics compared to the ELM algorithm, with an accuracy improvement by an order of magnitude. Therefore the prediction accuracy of P-ELM algorithm is better than the persistence method and ELM algorithm.

The five running time records of the ELM and P-ELM algorithms are shown in (Table 3). For training on 100 data samples, the running time of the ELM algorithm is slightly shorter than that of the P-ELM algorithm, both operating on the millisecond scale. This minimal difference indicates that the computational time has negligible impact on real-time performance, making both algorithms well-suited for short-term and very short-term prediction applications.

Table 3 ELM and P-ELM training time comparison table.

Simulation results show that the proposed P-ELM algorithm applied to solar power prediction can ensure the reliability and effectiveness of the real-time prediction system.

Conclusion

Accurate prediction of solar power is important to avoid customer penalties, build trust in energy markets, and rationalize power generation. Both mainstream deep learning and traditional learning methods use features based on simple phenomena; they only consider spatial or temporal features to bypass the nonlinearity of solar power series. However, some studies have combined different spatiotemporal feature extraction methods through a stacked layer mechanism. This paper proposes a hybrid intelligent algorithm that combines the advantages of persistence forecasting and machine learning algorithms. The proposed P-ELM method utilizes meteorological factors and the current output power as input conditions for the next-step prediction, preserving the high correlation between data across consecutive time steps. This approach enables accurate one-step-ahead predictions of temperature, daily irradiance, and output power. Due to the high accuracy of persistence methods for ultra-short-term predictions, the accuracy decreases as the sampling interval increases. Therefore, this approach is suitable only for short-term and ultra-short-term power forecasting applications. Additionally, P-ELM incorporates the high-speed training characteristic of the ELM algorithm, making it suitable for real-time short-term solar power output prediction.