Distributed photovoltaic output prediction and end-side control method based on lstm and time attention mechanism
By employing a distributed photovoltaic (PV) output prediction and end-side control method based on LSTM and time attention mechanisms, combined with online feedback correction and MPC control, the fluctuation problem of distributed PV output under complex weather conditions on a small scale is solved. This achieves high-precision, low-latency PV output prediction and control, and improves grid-friendliness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-13
- Publication Date
- 2026-04-14
AI Technical Summary
Distributed photovoltaic power output exhibits strong randomness and non-stationarity under complex weather conditions on a small scale, resulting in fluctuations in actual power output on the grid-connected side. Traditional control strategies struggle to balance power generation utilization and grid-friendliness, and existing prediction and control schemes are difficult to achieve efficient and stable multi-step prediction and closed-loop optimization in edge scenarios.
A distributed photovoltaic power output prediction method based on LSTM and time attention mechanism is adopted, combined with online feedback correction and MPC control. Multi-step look-ahead prediction is realized through edge devices, and low-latency and robust edge control is performed on the RK3588 embedded platform. The ARM core and NPU are used to process data and perform calculations in collaboration.
It achieves high-precision photovoltaic power output prediction in the multi-step time domain, suppresses model bias and drift, meets grid-connection constraints such as power upper limit and ramp limit, and improves grid friendliness and real-time control.
Smart Images

Figure CN121529548B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of energy forecasting and end-side control technology, specifically to a distributed photovoltaic power output forecasting and end-side control method based on LSTM and time attention mechanism. Background Technology
[0002] With the large-scale integration of distributed photovoltaic (PV) systems into residential, industrial, and microgrid applications, the power output at the grid-connected sites exhibits strong randomness and non-stationarity under complex weather conditions on a small scale. Factors such as rapid cloud cover and recovery, and sudden changes in ambient temperature and wind speed can cause drastic fluctuations in available power output within minutes, leading to issues such as exceeding ramp limits, command jitter, and increased curtailment rates on the grid-connected side. Simultaneously, the grid side imposes stricter requirements on ramp limits, power factor, and voltage stability, making it difficult for traditional control strategies based on static power limiting, fixed ramp limits, and empirical rules to balance power generation utilization and grid-friendliness. While existing loosely coupled "cloud-based prediction + local control" schemes incorporate deep learning prediction, they are prone to delays in reaching the grid-connected site due to communication link latency, packet loss, and network instability in edge scenarios. Furthermore, single-step or shallow look-ahead prediction methods lack the ability to perceive disturbances several steps into the future, making it difficult to reduce power output in time before strong shading occurs, and most schemes do not provide online polarization correction mechanisms for model bias. On the other hand, edge controllers are limited in computing power and power consumption, and traditional MPC solvers based on quadratic programming or interior point methods are difficult to implement stably in control cycles of minutes or even seconds. Although embedded platforms like the RK3588 integrate NPUs and can accelerate neural network inference through the RKNN framework, there is still a lack of a unified and mass-producible engineering path for how to tightly couple "multi-step prediction of multivariable time series, online deviation correction and constraint-feasible closed-loop optimization" on the same device. Summary of the Invention
[0003] This invention aims to provide a distributed photovoltaic power output prediction and end-side control method based on LSTM and time attention mechanism. It is designed to complete multi-step look-ahead prediction at the edge and combine it with online feedback correction to output the active power setpoint of the inverter under the constraints of power upper bound and ramping. It can be preferably implemented on an embedded platform with NPU in a low-latency, robust and easy-to-deploy manner, thereby reducing curtailment and fluctuation and improving grid-friendliness.
[0004] A distributed photovoltaic (PV) output prediction and end-side control method based on LSTM and time attention mechanism, including the distributed PV output prediction steps:
[0005] S1: Collect ambient temperature, total horizontal irradiance, tilt surface irradiance, wind speed, wind direction, and historical power generation data of the AC side grid-connected point of the photovoltaic inverter, and resample according to the preset sampling step size to align the time series.
[0006] S2: Preprocess the collected data, including feature construction, standardization, feature filtering and dimensionality reduction, to generate input and multi-step target sequences. The preprocessing includes wind direction coding, rolling statistics calculation, scale unification, key feature extraction and dimensionality compression.
[0007] S3: Construct a multi-step time series prediction model based on LSTM superimposed time attention mechanism to realize the mapping from the input window to the future multi-step available output prediction vector. The mean square error is used for supervised training, and the quantile output can be trained in parallel to characterize the prediction uncertainty.
[0008] S4: Export the trained model, perform quantization calibration, compile and generate model files, and deploy it on the NPU of the edge device to perform edge inference. The ARM core of the edge device is responsible for data preprocessing, inference result postprocessing and control logic calculation.
[0009] S5: During operation, the model is called with the input data of the most recent preset window length to obtain a multi-step predicted power sequence. Online feedback correction is performed based on the residual between the measured power and the predicted power at the previous moment. A safety margin is set by combining the statistical characteristics of the residual or the quantile prediction results. The corrected power is adjusted downward and physical upper and lower limit constraints are applied to ensure that the output power does not exceed the rated capacity of the equipment.
[0010] S6: Based on the corrected prediction results, construct an MPC problem with the inverter active power setpoint as the decision quantity, set the control time domain, and the objective function includes a reference power tracking term, a curtailment penalty term, and a power increment smoothing term, and apply power upper bound constraints and ramp rate constraints.
[0011] S7: The MPC problem is solved using the PG method on the ARM core. The learning rate decreases logarithmically with the number of iterations. Only a preset number of iterations are performed per control cycle to meet real-time requirements. The first control variable of the solution result is taken as the instruction to be issued.
[0012] S8: Send the instruction to be sent to the inverter to complete the closed-loop control of this cycle. At the same time, record the measured data, prediction results and residual data of this cycle for subsequent model retraining and parameter tuning.
[0013] The beneficial effects of the present invention are: (1) It can realize the available output in multiple time domain steps. (1) High-precision prediction; (2) Suppress model bias and drift by using online feedback correction; (3) Under grid-connected constraints such as power upper limit and ramp limit, optimize output through model prediction control. (4) On RK3588, NPU inference is completed using RKNN and real-time optimization is completed using the projection gradient method to meet the requirements of low latency and high reliability in the field. Attached Figure Description
[0014] Figure 1 This is a schematic diagram of the network framework of the distributed photovoltaic power output prediction and end-side control method based on LSTM and time attention mechanism provided in the embodiments of the present invention.
[0015] In the diagram, Softmax is the normalized exponential function, also known as the Softmax function. Detailed Implementation
[0016] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described below are only for explaining the present invention and do not limit the scope of protection of the present invention.
[0017] The present invention will be further described in detail below through preferred embodiments:
[0018] As attached Figure 1 As shown: This invention discloses a distributed photovoltaic power output prediction and end-side control method based on LSTM and time attention mechanism, including the following steps:
[0019] S1: Collect ambient temperature, total horizontal irradiance, tilt surface irradiance, wind speed, wind direction, and power generation data of the AC side grid-connected point of the photovoltaic inverter, and resample according to the preset sampling step size to align the time series;
[0020] S2: Preprocess the collected data, including feature construction, standardization, feature filtering and dimensionality reduction, to generate input and multi-step target sequences. The preprocessing includes wind direction coding, rolling statistics calculation, scale unification, key feature extraction and dimensionality compression.
[0021] S3: Construct a multi-step time series prediction model based on LSTM superimposed time attention mechanism to realize the mapping from the input window to the future multi-step available output prediction vector. The mean square error is used for supervised training, and the quantile output can be trained in parallel to characterize the prediction uncertainty.
[0022] S4: Export the trained model, perform quantization calibration, compile and generate model files, and deploy it on the NPU of the edge device to perform edge inference. The ARM core of the edge device is responsible for data preprocessing, inference result postprocessing and control logic calculation.
[0023] S5: During operation, the model is called with the input data of the most recent preset window length to obtain a multi-step predicted power sequence. Online feedback correction is performed based on the residual between the measured power and the predicted power at the previous moment. A safety margin is set by combining the statistical characteristics of the residual or the quantile prediction results. The corrected power is adjusted downward and physical upper and lower limit constraints are applied to ensure that the output power does not exceed the rated capacity of the equipment.
[0024] S6: Based on the corrected prediction results, construct an MPC problem with the inverter active power setpoint as the decision quantity, set the control time domain, and the objective function includes a reference power tracking term, a curtailment penalty term, and a power increment smoothing term, and apply power upper bound constraints and ramp rate constraints.
[0025] S7: The MPC problem is solved using the PG method on the ARM core. The learning rate decreases logarithmically with the number of iterations. Each control cycle iterates only a preset number of times to meet the real-time requirements. The first control variable of the solution result is taken as the instruction to be issued.
[0026] S8: Send the instruction to be sent to the inverter to complete the closed-loop control of this cycle. At the same time, record the measured data, prediction results and residual data of this cycle for subsequent model retraining and parameter tuning.
[0027] The following is a detailed explanation of each step.
[0028] Specifically, step S1 includes data acquisition and preprocessing steps:
[0029] S11: The following variables are collected in real time via edge computing units: ambient temperature: T air Total horizontal irradiance: G h Inclined surface irradiance: G tilt Wind speed: W s Wind direction: W d Photovoltaic inverter AC side grid connection point power generation: The sampling period for each signal is... And ensure that the sampling clocks of each signal are synchronized to prevent timing inconsistencies.
[0030] S12: Since different sensors may have different sampling frequencies, we use a linear interpolation method to align the time of different signals. The specific formula is as follows:
[0031] (1)
[0032] in Indicates the first The variables at time... Observed values; Indicates the target sampling time after uniform alignment (the first time). (alignment moments); , Indicates the original sequence with Two adjacent sampling times satisfy ; , The first The variables at the original sampling time , Observed values; subscript Number the variable / feature; subscript The aligned sample number; subscript The original sampling sequence number; These are interpolation weights. This method ensures that all signals are at a uniform time step. Top alignment yields the aligned data matrix:
[0033]
[0034] in, Indicates the time-aligned uniform sampling time ( ). For each variable at time... Aligned feature vectors; all of Stacking them in chronological order yields the final output data matrix. Further discussion will follow. Abbreviated as ,therefore From time to time .
[0035] S13: The aligned and corrected data will be stored in the cache of the edge computing unit.
[0036] The final output data matrix is:
[0037]
[0038] This data matrix will be used in subsequent steps for feature construction and standardization.
[0039] Step S2: Feature construction, filtering, dimensionality reduction, and sliding window sequence generation.
[0040] Step S2 specifically includes the following steps:
[0041] S21: Wind direction is a periodic variable. To avoid periodic boundary problems (e.g.) and (If the actual direction is similar), first convert the wind direction from degrees to radians, as shown in the following formula:
[0042] (2)
[0043] in Indicates the first The wind direction angle values at each sampling time are then calculated. The sine and cosine components of the wind direction are then used to obtain continuous two-dimensional directional features.
[0044] (3)
[0045] in, For the first The radian value of the wind direction at any given time; and These are the components of the wind direction in the sine and cosine directions, respectively.
[0046] S22: To capture the short-term dynamic characteristics of meteorological and power quantities, in steps The resulting aligned data matrix (Also abbreviated as in the text) () as input, at a unified time step The rolling statistics are calculated for the main continuous variable columns in the matrix. For any continuous variable column, denote its value at time t. The value is ,Right now for The scalar component corresponding to a certain column in the window with a length of sliding window Internal calculations include rolling mean, rolling standard deviation, first difference, extreme values, and trend slope.
[0047] Rolling average:
[0048] (4)
[0049] r is the length of the scroll window (number of sample points).
[0050] Rolling standard deviation:
[0051] (5)
[0052] r is the length of the scroll window (number of sample points).
[0053] First-order difference:
[0054] (6)
[0055] in, For sequence In the The values of each sampling point The value of the previous sampling point
[0056] Extreme values and trend slope:
[0057] (7)
[0058] (8)
[0059] Indicates that in For the end, the window length is Within the rolling time window, the sequence The slope of the linear trend; This is the length of the scroll window; This represents the current time step / sampling sequence number; Represents a sequence At any moment Observations at; For the relative index within the window, take (in Corresponding to the current point , Earliest point of corresponding window ); For index The mean within the window, and ; denominator The sum of squared deviations of the index is used for normalization, thereby making... Equivalent to within the window As the independent variable, with The regression slope is the least squares linear fit of the dependent variable.
[0060] These rolling statistics provide rich feature information for the subsequent standardization step S23, which helps the neural network capture fluctuations and trends in the time series.
[0061] S23: To prevent the difference in the units of different features from affecting model training, we standardize each continuous feature.
[0062] The Zscore standardization formula is as follows:
[0063] (9)
[0064] in, and Representing features respectively The mean and standard deviation in the training set.
[0065] For features containing outliers, we use a robust standardization method, the formula of which is:
[0066] , = - (10)
[0067] in, The median of the characteristic, Interquartile difference , These are the lower quartile and upper quartile of the feature in the training set, respectively.
[0068] Standardized data matrix This will serve as the input for the subsequent feature selection and dimensionality reduction step S24.
[0069] S24: After feature standardization, the MRMR (Minimum Redundancy Maximum Correlation) algorithm is used to filter the features. The optimization objective is:
[0070] (12)
[0071] in Let |S| represent the set of candidate features, and |S| represent the set of... The number of features; , For set The first in , One characteristic variable; Power output for photovoltaics; Mutual information is used to measure the correlation between two random variables. Represents a set Summation of mutual information between all internal characteristics and photovoltaic power output. Represents a set Summation of mutual information between pairs of internal features.
[0072] The filtered feature set will be used for dimensionality reduction using PCA (Principal Component Analysis) to calculate the covariance matrix.
[0073] (13)
[0074] in This is the feature matrix after MRMR filtering. For the sample size, Covariance matrix The eigenvector matrix (column vectors are eigenvectors). It is a diagonal matrix formed by the corresponding eigenvalues.
[0075] Before choosing The principal components are used to obtain the dimensionality-reduced feature matrix:
[0076] (14)
[0077] The reduced feature matrix will be used as input for the sliding window sample generation step S25.
[0078] S25: We will use the dimensionality-reduced feature matrix Based on fixed window length Perform sliding window segmentation to obtain the input sample and target sequence at each time step. Assume... Then the first The input sample at time t is:
[0079]
[0080] R represents the field of real numbers, i.e., the set of real numbers. This represents the feature matrix after feature selection and dimensionality reduction, where the i-th... The feature vector corresponding to each time step is denoted as . ; The feature dimension after dimensionality reduction represents the number of features at each time step; The sliding window length represents the length of the historical input sequence and the number of sample points. The sample time step number (the time at the end of the window), and the window coverage range is... ; For the first The input sample matrix is constructed at each time step, consisting of continuous samples within the window. The feature vectors are stacked in chronological order to obtain the result. (in" The colon indicates transpose, so that each line corresponds to a time step. Dimensional features);
[0081] The target sequence is the corresponding future N p Step power sequence:
[0082]
[0083] in The prediction step size / prediction time domain length (the number of steps to predict in the future). The corresponding target sequence vector is from the future The power label of the step; Indicates the first The actual power at each time step.
[0084] S26: Summarize all sliding window samples to form a training set. :
[0085]
[0086] This training set will be used to train LSTM and temporal attention mechanism models, establishing a multi-step prediction relationship from historical features to future power.
[0087] Through the steps described above, starting with the construction of S2 features and going through each processing step, data suitable for neural network training is finally obtained. The data has undergone standardization, dimensionality reduction, sliding windowing, and other processing, making it suitable for multi-step prediction tasks in deep learning models.
[0088] Through the above processing steps, we finally obtain the feature set. for:
[0089]
[0090] in, Indicates time Ambient temperature; Indicates time Total horizontal irradiance; Indicates time Irradiance of the inclined surface; Indicates time wind speed; Indicates time The measured active power of the photovoltaic inverter connected to the grid on the AC side.
[0091] and Represents wind direction variable The sine and cosine coding features obtained after periodic continuous processing, where t is time t, are used to avoid wind direction changes. The discontinuity at the boundary is calculated as follows:
[0092]
[0093] also, , and This is a rolling statistical feature set used to characterize the level, fluctuation, and trend of each continuous time-series input quantity over a short time scale; specifically, in the context of... The final time and length are Within the sliding window, the ambient temperature is monitored. Horizontal total irradiance Radiance of inclined surface Wind speed ,wind direction and measured active power of the AC side of the photovoltaic inverter connected to the grid The rolling average was calculated for each continuous quantity. Rolling standard deviation and first-order difference ,in The mean within the window. The standard deviation within the window. The first-order difference feature of adjacent sampling points is defined as follows: ,in These are the aligned discrete sampling times. This indicates the previous sampling time. It is used to characterize the direction and magnitude of change of this continuous quantity between adjacent time points. This enhances the model's ability to represent short-term fluctuations and trend changes.
[0094] Indicates time The time index is used to correlate with periodic time-coded items. , Together, they depict the characteristics of daily cycle changes, among which , Used to represent the time position within a 24-hour cycle, in order to enhance the model's ability to learn periodic patterns.
[0095] Through this process, we transform the raw time series data into a rich feature set. This includes meteorological, power, and periodic characteristics, enabling neural networks to better learn the complex relationship between input data and future power.
[0096] Thus, the entire process, from S2 to the final model input data, involves steps such as feature construction, standardization, dimensionality reduction, and sliding window processing, ensuring data quality and improving the model's predictive ability.
[0097] Step S3: Train the LSTM attention model and make multi-step predictions with uncertainty.
[0098] Step S3 specifically includes the following steps:
[0099] S31: In this embodiment, the model we construct is based on LSTM and a temporal attention mechanism, aiming to predict future multi-step photovoltaic power from historical meteorological and power data. The model includes an input layer, an LSTM layer, an attention layer, and an output layer.
[0100] Input layer: each time step The input is Its dimensions are ,in It is the length of the input sequence, i.e., the number of steps in the time window. This refers to the feature dimension of the input at each step. The input to the model is the feature matrix processed by the aforementioned S1 and S2 steps, including data such as ambient temperature, irradiance, wind speed, and wind direction.
[0101] LSTM layer: The purpose of the LSTM layer is to capture long-term dependencies in the input historical data. At each time step... Input It will be processed into a hidden state. And control the flow of information through gating mechanisms in the network.
[0102] Attention Layer: The temporal attention mechanism allows the model to focus on important moments in the input sequence, enhancing attention to key time periods. This mechanism assigns weights by calculating the attention score at each moment, thereby generating a weighted context vector.
[0103] Output layer: The goal of the output layer is to generate the future. Photovoltaic power prediction step. The predicted value is generated based on the weighted aggregation of the hidden states of the LSTM layer and the attention layer.
[0104] S321: LSTM cells are used to capture long-term dependencies in time series data. At each time step... LSTM receives the current input and the hidden state of the previous moment As input, output the hidden state at the current time step. and memory unit .
[0105] The update equation for the LSTM layer is as follows:
[0106] Input gate: controls the amount of current input information entering the memory unit.
[0107] (15)
[0108] Forget gate: controls how much information from the previous memory unit is forgotten.
[0109] (16)
[0110] Output gate: Controls the output of the memory unit and determines the current hidden state.
[0111] (17)
[0112] Candidate memory cells: Update the candidate values of memory cells by inputting information.
[0113] (18)
[0114] Memory unit update: Combine the current input with the memory from the previous moment to update the memory unit at the current moment.
[0115] (19)
[0116] Hidden state output: The hidden state at the current moment is obtained by controlling the output gate.
[0117] (20)
[0118] in, Indicates the time step number; For a moment The input feature vector; , They are time points With time The hidden state vector; , They are time points With time The memory unit vector; , , These are the gate control vectors for the input gate, forget gate, and output gate, respectively. This represents the candidate memory unit vector (candidate cell state). This represents the Sigmoid activation function; Represents the hyperbolic tangent activation function; the symbol " " indicates Hadamard element-wise multiplication; For input vectors Weight matrices for each gate / candidate state; Hidden state The cyclic weight matrix for each gate / candidate state; The corresponding bias vector; the weight matrix and bias vector mentioned above are network parameters obtained through training.
[0119] S322: During training, the LSTM layer continuously updates its hidden state. and memory unit This effectively captures long-term dependencies in time series data. The hidden state at each time step... Each time step contains a weighted summary of all information from the previous time step, and this information is passed on to the next time step.
[0120] S331: To enhance the model's focus on key time steps, the hidden state sequence output by the LSTM layer... A time attention mechanism will be introduced. The goal of this mechanism is to focus on the time segments that are most important for the current prediction by calculating an attention score.
[0121] The formula for calculating attention score is as follows:
[0122] (twenty one)
[0123] in, These are the trainable parameters of the attention layer. Attention score for each time step.
[0124] S332: The weights for each time step are calculated by normalizing the attention scores over all time steps using the Softmax function. The larger the weight, the greater the contribution of that time step to the prediction result.
[0125] (twenty two)
[0126] in Indicates the first Attention weights for each time step; It transforms the attention scores at each time step into a normalized function of the probability distribution; It is the first Attention score at each time step; It is an exponential function used to map scores to positive numbers; It is the sum of the exponential scores for all time steps, used for normalization; It is the time step index when summing; It is the length of the input sequence divided by the total number of time steps.
[0127] S333: Utilizing Attention Weights The hidden states of all time steps are weighted and aggregated into a context vector. :
[0128] (twenty three)
[0129] This context vector As a weighted representation of the LSTM layer output, it provides important temporal information for subsequent prediction tasks.
[0130] S341: Context vectors aggregated through a time attention mechanism We map it to the future Step power prediction:
[0131] (twenty four)
[0132] in, and For the weights and biases of the linear output layer, This is the context vector.
[0133] S342: To optimize the model, the MSE loss function is used to measure the difference between the predicted and actual values.
[0134] (25)
[0135] in, Mean squared error loss is used to measure the deviation between the predicted value and the true value; Indicates the number of prediction steps involved in calculating the loss; It is the coefficient used to average the error; It is a summation index; Indicates time index The predicted available power output from the model; Indicates the same moment The actual labeled power value; This usually represents the prediction start point or the current time index. Indicates the next A moment; the difference in parentheses It is the prediction error.
[0136] S35: Model Training and Export
[0137] S351: Training Optimization
[0138] The model was trained using the AdamW optimizer, and an exponential decay learning rate strategy was used to dynamically adjust the learning rate.
[0139] (26)
[0140] in, It is the learning rate at the nth iteration. It is the initial learning rate. It is the decay coefficient, which controls the rate at which the learning rate decreases, and n is the number of training iterations.
[0141] S352: After training is complete, the model trained using the PyTorch framework will be exported as an ONNX format file. The ONNX format is cross-platform, supporting deployment and inference on different platforms such as edge hardware.
[0142] This embodiment successfully predicts future photovoltaic power from historical data using an LSTM and time-attention mechanism model, combining multi-step power prediction with the time-attention mechanism. The model employs MSE loss, quantile loss, and the AdamW optimizer, and avoids overfitting through an early stopping strategy. The final trained model is exported in ONNX format, enabling efficient inference and real-time prediction on edge devices.
[0143] Step S4: Model quantization and deployment, and division of labor for edge inference.
[0144] Step S4 specifically includes the following steps:
[0145] S41: The core of this step is to efficiently deploy the model to the edge device RK3588 NPU. The specific process is as follows: First, export the trained model to ONNX format, then perform quantization and calibration through RKNNToolkit, and finally generate the `.rknn` model file and deploy it to the NPU. At the same time, clarify the division of inference between the ARM core and the NPU to ensure efficient operation of edge inference.
[0146] S411: After the model training is completed, the LSTM and temporal attention mechanism models need to be exported to ONNX format to support cross-platform inference. Specifically, the saved training model is read from the PyTorch environment, and the model inference process is simulated with virtual input using PyTorch's built-in tools to convert it to ONNX format. Finally, the converted model is stored in the `.onnx` format to prepare for subsequent quantization operations.
[0147] The core advantage of the S412:ONNX format lies in its strong cross-platform compatibility. It supports multiple deep learning frameworks such as PyTorch and TensorFlow, allowing trained models to run on different hardware and inference platforms without retraining or modifying the model. At the same time, this format can be further optimized directly in the RKNNToolkit, facilitating the subsequent adaptation of the model to the RK3588NPU.
[0148] S42: Compiling and Deploying to RK3588 NPU
[0149] Furthermore, in S42, the specific steps are divided into...
[0150] S421: The `.rknn` file needs to be compiled to be compatible with the hardware architecture of the RK3588 NPU. The specific operation is to first read the `.rknn` model file through RKNNToolkit, then convert it into a format that the NPU can directly execute and perform hardware-level optimization. Finally, the tool method is called to initialize the NPU inference environment to ensure that the model can normally call hardware resources to perform inference.
[0151] S422: In the inference process, the ARM core and NPU of the RK3588 each perform their respective functions and work together. The ARM core is responsible for the preprocessing of input data, ensuring that the data meets the input requirements of the NPU through operations such as standardization and feature transformation. The NPU uses hardware acceleration capabilities to efficiently execute the core calculations of the model and output the inference results. Afterwards, the ARM core converts the results output by the NPU into the final power prediction value, and is also responsible for the management of processes such as data acquisition and inference request scheduling.
[0152] S423: After the model is deployed, the edge device can perform end-side inference. When new photovoltaic-related monitoring data is received, the ARM core first completes the data preprocessing, then triggers the NPU to perform inference calculation, and finally the ARM core processes the inference results and outputs the final power prediction value. The whole process can realize real-time photovoltaic power prediction and meet the application needs of edge scenarios.
[0153] This embodiment successfully deployed the LSTM and temporal attention mechanism models to the RK3588 NPU through a complete process of "ONNX export → RKNNToolkit → NPU compilation and deployment". The clear division of labor between the ARM core and the NPU ensures the smoothness of the inference process and the accuracy of the results, ultimately realizing real-time and efficient photovoltaic power prediction on embedded devices.
[0154] In step S4, we completed the model export and deployment, and performed inference on the RK3588NPU. To further improve prediction accuracy and reduce the impact of prediction errors on system control, step S5 adopted an online feedback correction mechanism to dynamically correct the model output, while introducing a safety margin adjustment to address the risks brought about by prediction uncertainty.
[0155] Step S5: Multi-step prediction and feedback correction
[0156] Step S5 specifically includes the following steps:
[0157] S511: During runtime Enter the most recent The data window is used to call the already deployed `.rknn` model for multi-step power prediction. The model is based on the current state of the input. Predicting the future From the photovoltaic power, the predicted power sequence is obtained:
[0158]
[0159] in, This represents the predicted available power value at step j.
[0160] S512: To reduce prediction errors caused by model drift or external disturbances, the measured power at the current actual operating time is used as a basis. and model predicted power Calculate the predicted residual :
[0161] (27)
[0162] in, Indicates time The residual reflects the difference between the predicted power and the actual power.
[0163] S513: Based on the residual at the current time The predicted values are then corrected based on feedback. The correction formula is as follows:
[0164] (28)
[0165] in, For the corrected available power prediction, The feedback gain coefficient determines the strength of the residual's influence on the prediction.
[0166] when When, it means that the correction is made entirely based on the residual;
[0167] when When the time is specified, it means that the prediction result will not be modified in any way and the original prediction value will be maintained.
[0168] By adjusting the feedback gain coefficient It allows for flexible control of the correction intensity, avoiding prediction instability caused by over-correction.
[0169] S52: Safety Margin Adjustment and Physical Constraints
[0170] S521: To mitigate the risks associated with forecast uncertainty, a safety margin is introduced based on the statistical properties of the forecast residuals, and adjustments are made to future forecast results. First, the mean square value of the residuals for each forecast step is calculated:
[0171] (29)
[0172] in, Indicates the first The mean square value of the residuals predicted in the step. It is the sample size used for statistical analysis.
[0173] S522: Safety margin correction based on residual mean square value The predicted value is then adjusted for a safety margin. Safety margin coefficient. Used to adjust the size of the safety margin. The correction formula is:
[0174] (30)
[0175] in, This is the corrected predicted value after adding a safety margin. This is the safety margin coefficient, used to control the size of the margin.
[0176] S52.3: Quantile Loss Correction
[0177] The model employs quantile loss during training to model prediction uncertainty, replacing the correction term with predictions from higher quantiles. The specific formula is as follows:
[0178] (31)
[0179] in, The preset quantile parameters, ; This is the prediction result for the corresponding quantile.
[0180] S524: Finally, to ensure that the prediction results are within the physically achievable range, a limiting constraint needs to be imposed on the predicted values to ensure that they do not exceed the rated power of the equipment. :
[0181]
[0182] in, This is the rated power of the equipment, ensuring that the output power does not exceed the equipment's capacity or safety threshold.
[0183] S53: On the RK3588 NPU, all inference, residual correction, safety margin adjustments, and physical constraints are executed in real time with millisecond-level latency. Furthermore, the entire S53 feedback control cycle includes the following steps:
[0184] S531: Input data: Input the most recent data each time. Step data window To obtain the future from the `.rknn` model. Step-by-step predicted power sequence ;
[0185] S532: Calculate the residual: Calculate the residual at the current time step. ;
[0186] S533: Feedback Correction: Correct future forecasts based on residuals to obtain... ;
[0187] S534: Safety Margin Adjustment: Apply the residual variance or quantile prediction results and add a safety margin adjustment;
[0188] S535: Physical Limiting: Physically limits the corrected prediction results to ensure that the output power is within a reasonable range, thus obtaining the final predicted output. .
[0189] After each inference, the system records the measured data, prediction results, and residual information. This information will be used for subsequent model retraining and adaptive parameter optimization, thereby achieving continuous self-learning and closed-loop enhancement.
[0190] Step S5, through an online feedback correction mechanism combined with safety margin adjustment, successfully improves the accuracy of multi-step power prediction and ensures that the prediction results operate within physical and safety constraints. The real-time inference and feedback control mechanism executes on the RK3588NPU with millisecond-level latency, providing an efficient and safe solution for the operation and control of photovoltaic systems.
[0191] In step S5, we completed multi-step power prediction based on the LSTM and time attention mechanism model, and performed feedback correction and safety margin adjustment on the prediction results. In step S6, based on the prediction results, we will construct an MPC problem to optimize the active power setting of the photovoltaic power generation system in order to minimize power prediction error, smooth control variable changes, and ensure safety.
[0192] Step S6: MPC Modeling and Constraint Construction
[0193] Step S6 specifically includes the following steps:
[0194] S61: To extend the control input across the entire prediction period, we first need to construct the control trajectory. Control Input Indicates the future Step control settings, where the control input for each step This represents the active power setting at the corresponding time point. To extend these control inputs to a power setting trajectory for the complete prediction cycle. We introduce a preservation matrix The formula for calculating the control trajectory is:
[0195] (32)
[0196] in: The predicted control output trajectory represents the future. Step power setting.
[0197] :Depend on A vector space consisting of real numbers.
[0198] :future The control input for each step indicates the active power setting for each step.
[0199] Preserve the matrix, and reduce the decision quantity Convert to a complete predicted trajectory.
[0200] By preserving the matrix , the future The control quantity of the step is extended to a complete predictive power settling trajectory. It also provides complete control outputs for subsequent optimization.
[0201] S62: To avoid drastic changes in the control input between adjacent time steps, we use a difference matrix. To calculate the control increment and smooth it. Difference matrix. This ensures that the changes between adjacent control steps are not too large, thus achieving ramp limitation.
[0202] The formula for calculating the control increment is:
[0203] (33)
[0204] in:
[0205] Difference matrix: used to divide the control sequence in the predictive control time domain. This is converted into a sequence of changes (increments) between adjacent control steps. (By...) The effect can be obtained , and then combine The first step increment can be represented as The increments for the remaining steps are represented as the difference between the control quantities of two adjacent steps. This yields... Used to constrain the rate of change of control quantity, thereby limiting the change amplitude of adjacent control steps, achieving ramp (slope) limiting and avoiding sudden changes in power setpoint.
[0206] : The power setting that has been executed so far.
[0207] : Control the increment of the quantity to ensure that there are no drastic changes in adjacent control steps.
[0208] By calculating the control increment This can effectively limit the rate of change of the control quantity and avoid sudden changes in power setting.
[0209] S63 optimizes control input Define an objective function The function consists of several parts:
[0210] Reference power tracking: Minimize the error between the control input and the reference power.
[0211] Upper bound penalty: Penalize power that exceeds the upper bound of available power.
[0212] Smoothing of adjacent control steps: reducing drastic changes between adjacent control steps.
[0213] Sparsity penalty: Reduce the variation of control inputs by adding sparsity constraints.
[0214] The expression for the objective function is:
[0215] (34)
[0216] in Objective function, used to optimize control input. It consists of reference power tracking error, upper bound penalty, adjacent control step smoothing term, sparsity penalty, etc. : Prediction step size / prediction time domain length. : The time step index of the current moment / current control cycle. Step index in the prediction / control time domain. . : No. The control input for the step is the power setpoint / set power, therefore Indicates the first The control input for the step is the set value of the previous control step. Reference power. : The upper limit of safe available power. : The weights of the control terms (corresponding to the tracking error term, hinge penalty term, and smoothing term, respectively). : Hinge / truncation function; takes 0 when the value inside the parentheses is negative, and takes its value when it is positive, used for "penalty only when exceeding the upper bound". : Sparsity of the control quantity, used for sparsity constraints / penalties. : of The norm is the sum of the absolute values of its components and is used for sparsity penalty. Sparsity penalty coefficient.
[0217] The objective function includes:
[0218] 1. Reference power tracking error: via Control the tracking accuracy of the reference power.
[0219] 2. Hinge penalty: Use Penalty for exceeding the upper limit of available power.
[0220] 3. Smoothing constraints: through Control the smoothness of adjacent control steps.
[0221] 4. Sparsity penalty: through Control sparsity penalty terms to reduce unnecessary changes in control quantities.
[0222] S64: To ensure that the control input is within a reasonable range and to prevent excessive changes in adjacent control steps, constraints are imposed on the control input and adjacent control steps. Constraints on the control input include:
[0223]
[0224] in:
[0225] : The upper limit for each control input.
[0226] : Maximum control increment, limiting the rate of power change.
[0227] These constraints ensure that every control input Within the legal range, and the changes in adjacent control steps do not exceed the ramp limit.
[0228] Step S7: Online solution using the PG method. Step S7 specifically includes the following steps:
[0229] S71: Learning Rate Initialization and Decay
[0230] To optimize process stability, we employ a gradually decreasing learning rate. Through an exponential decay strategy, the learning rate decreases progressively with each iteration, thus ensuring the stability of the optimization process.
[0231] The formula for updating the learning rate is:
[0232] (35)
[0233] in: : The learning rate at the nth iteration. Initial learning rate. : Learning rate decay factor. Number of iterations.
[0234] S72: To guide the optimization process, we need to calculate the objective function. Control quantity The gradient is calculated in three parts: 1. the gradient of the reference power error; 2. the gradient of the hinge penalty; and 3. the gradient of the smoothing constraint.
[0235] The gradient calculation formula is:
[0236] (36)
[0237] in Describe the objective function For control input vector The gradient is used to update the control variable using the projective gradient method, where... Let be the objective function. To predict the control input vector in the time domain; To control vector The mapping is a linear mapping matrix that predicts the power trajectory. Transpose it. To predict the set power trajectory vector in the time domain; To predict the reference power vector in the time domain, For tracking error vector; This is the weight matrix for the tracking error term; The upper bound penalty term weight matrix; To predict the upper bound vector of safe available power in the time domain; The element-wise truncation function is defined as follows: This is used to retain only positive excesses that exceed the upper bound; This represents the Hadamard product (element-by-element multiplication). For element-wise pointer vectors, when The value is 1 if the gradient is active and 0 otherwise, to ensure that the penalty gradient only takes effect on the upper bound component. This is a difference matrix used to calculate the changes between adjacent control steps. Transpose it. The vector of change between adjacent steps; The bias vector is composed of the known setpoints from the previous control step, such that the first difference term corresponds to... ; This is the weight matrix for the smoothing term; the three terms correspond to the tracking error term, the upper bound penalty term, and the smoothing term, respectively. Gradient contribution.
[0238] S73: Based on the calculated gradient We use gradient descent to update the control input. :
[0239] (37)
[0240] in The control input vector updated by gradient descent has not yet been projected into the feasible region. : No. The current control input vector at the next iteration. Objective function Control quantity The gradient. : The learning rate / step size corresponding to the current iteration. : Iteration count index. ": The assignment / update symbol indicates that the variable on the left is updated using the expression on the right.
[0241] S74: To ensure that each control input is within the legal range, we will update the control input. Projected into the feasible region:
[0242] (38)
[0243] in :vector The The component (the first) (Step control input unprojected update value). : No. The upper limit of allowed step control input. : Clipping / limiting operator, that is, to clip / limit the width of the frame. Operators restricted to the interval [a, b]. Lower bound of the control input. Control step index. The control time domain length / control steps are controlled by the dimension of the input vector.
[0244] S75: Stop iteration when the maximum number of iterations is reached or adjacent solutions converge, and output control variables:
[0245] or (39)
[0246] in : Current iteration number. Maximum number of iterations. , : The control input vector obtained from two consecutive iterations. : Infinite norm. : Convergence threshold; convergence is considered achieved if the change between adjacent solutions is less than this threshold. "OR": The system stops if either of the two stopping conditions is met. If the stopping condition is met, the control quantity for the current control cycle is output. And then distribute them.
[0247] Step S8: Control quantity issuance and log recording. Step S8 specifically includes the following steps:
[0248] S81: Quantization and Distribution
[0249] Quantify the optimal control quantity:
[0250] (40)
[0251] in : No. Each control cycle is used to issue the "active power setpoint (after quantization)" before it is issued. Optimal control sequence The first control variable, which is also the first decision variable / first step control input, is the component that "takes the first control variable of the solution result as the instruction to be issued". Quantization operator: quantizes the control quantity to the power step size supported by the device. : Power step size / quantization resolution supported by the device. : Control cycle / discrete time index.
[0252] S82: Trim the control amount to a feasible range and issue the final control command:
[0253] (41)
[0254] in : No. The active power command is finally sent to the inverter in each control cycle. : The quantized set value. : Clipping / limiting operator, It is restricted to the interval [a, b]. : Lower bound of the control quantity. The safe available power upper limit is used to ensure that the transmitted power does not exceed the safe available output upper limit. Ensure that the control quantity does not exceed the safe available power upper limit and prepare for transmission.
[0255] S83: Record relevant data for this period, for subsequent optimization and retraining.
[0256] (42)
[0257] in : No. Data records / sample entries for each control cycle are used for subsequent optimization and retraining. :from arrive The recent The step feature data window is the input window used for model inference / control. : Input window length, which is the most recent The data window for each step. The final control command issued in this cycle. : No. Measured power for each cycle.
[0258] Save the feature data and actual power of this cycle for subsequent model retraining and adaptive optimization.
[0259] To verify the comprehensive performance of the control method proposed in this invention, a simulation model containing an 86-channel photovoltaic array, a midpoint clamped three-level inverter, and a 25kV distribution network was built in the Matlab / Simulink simulation environment. Using actual meteorological data as input, the performance of different control methods in terms of power absorption, fluctuation suppression, and real-time performance was compared and analyzed. The results are shown in Table 1 below.
[0260] Table 1
[0261]
[0262] Table 1 presents the comparison results of different control methods in the Matlab / Simulink simulation environment, focusing on indicators such as curtailment rate, power fluctuation suppression rate, end-side inference delay, grid-connected current THD, and inverter response time. Overall, traditional static power curtailment control and fixed ramp-up empirical control, lacking look-ahead prediction and optimization, exhibit high curtailment rates (8.5% and 7.2%, respectively) and limited fluctuation suppression capabilities (62.3% and 68.5%). Furthermore, grid-connected current THD and inverter response time are also poor (THD of 5.8% and 4.2%, and response times of 85ms and 72ms, respectively). Introducing prediction, cloud-based prediction combined with local PID control improves curtailment rate and fluctuation suppression (5.1% and 75.8%, respectively), but the end-side inference delay reaches 120ms. Further employing a single LSTM prediction combined with MPC reduces the curtailment rate to 3.8%, increases fluctuation suppression to 82.1%, reduces the end-side inference delay to 45ms, lowers THD to 2.1%, and shortens the response time to 42ms. In comparison, this invention performs best in all aspects: the lowest curtailment rate is 3.5%, the highest power fluctuation suppression rate is 85.3%, the end-side inference delay is further reduced to 42ms, the lowest grid-connected current THD is 1.9%, and the fastest inverter response time is 35ms, demonstrating the comprehensive advantages of achieving multi-step prediction and constraint optimization closed-loop control with low end-side delay.
[0263] The preferred embodiments of this application have been described in detail above with reference to the accompanying drawings. Typical known structures and common knowledge techniques in the preferred embodiments have not been described in detail here. Those skilled in the art can improve and implement the technical solutions of this invention based on the guidance provided in these embodiments and their own capabilities. Some typical known structures, known methods or common knowledge techniques should not be obstacles for those skilled in the art to implement this application.
[0264] The scope of protection claimed in this application shall be determined by the contents of its claims, and the contents described in the invention description, specific embodiments and drawings shall be used to interpret the claims.
[0265] Within the scope of the technical concept of this application, several modifications can be made to the specific implementation of this application, and these modified implementations should also be considered within the protection scope of this application.
Claims
1. A distributed photovoltaic power output prediction and end-side control method based on LSTM and time attention mechanism, characterized in that, Includes the distributed photovoltaic power output prediction steps: S1: Collect ambient temperature, total horizontal irradiance, tilt surface irradiance, wind speed, wind direction, and historical power generation data of the AC side grid-connected point of the photovoltaic inverter, and resample according to the preset sampling step size to align the time series. S2: Preprocess the collected data, including feature construction, standardization, feature filtering and dimensionality reduction, to generate input and multi-step target sequences. The preprocessing includes wind direction coding, rolling statistics calculation, scale unification, key feature extraction and dimensionality compression. S3: Construct a multi-step time series prediction model based on LSTM superimposed time attention mechanism to realize the mapping from the input window to the future multi-step available output prediction vector. Mean square error is used for supervised training, and quantile output is trained in parallel to characterize prediction uncertainty. S4: Export the trained model, perform quantization calibration, compile and generate model files, and deploy it on the NPU of the edge device to perform edge inference. The ARM core of the edge device is responsible for data preprocessing, inference result postprocessing and control logic calculation. S5: During operation, the model is called with the input data of the most recent preset window length to obtain a multi-step predicted power sequence. Online feedback correction is performed based on the residual between the measured power and the predicted power at the previous moment. A safety margin is set by combining the statistical characteristics of the residual or the quantile prediction results. The corrected power is adjusted downward and physical upper and lower limit constraints are applied to ensure that the output power does not exceed the rated capacity of the equipment. S6: Based on the corrected prediction results, construct an MPC problem with the inverter active power setpoint as the decision quantity, set the control time domain, and the objective function includes a reference power tracking term, a curtailment penalty term, and a power increment smoothing term, and apply power upper bound constraints and ramp rate constraints. S7: The MPC problem is solved using the PG method on the ARM core. The learning rate decreases logarithmically with the number of iterations. Each control cycle iterates only a preset number of times to meet the real-time requirements. The first control variable of the solution result is taken as the instruction to be issued. S8: Send the instruction to be sent to the inverter to complete the closed-loop control of this cycle. At the same time, record the measured data, prediction results and residual data of this cycle for subsequent model retraining and parameter tuning.
2. The distributed photovoltaic power output prediction and end-side control method based on LSTM and time attention mechanism according to claim 1, characterized in that, Step S2 specifically includes the following steps: Wind direction coding uses a sine / cosine coding method, and the specific calculation process includes: First, convert the wind direction from degrees to radians using the following formula: (2) in For the first The angle value of the wind direction at any given time. For the corresponding radian value; Then, based on the radian value, the two-dimensional directional features are calculated using the following formula: , (3) in , These represent the components of wind direction in the sine and cosine directions, respectively. Rolling statistics are calculated for time-series variables including ambient temperature, total horizontal irradiance, tilted surface irradiance, wind speed, wind direction, and power generation at the grid-connected point on the AC side of the photovoltaic inverter. The rolling mean, rolling standard deviation, first difference, window extrema, and trend slope are calculated by setting the data collection window size. The specific formulas are as follows: Rolling average: (4) in For window length, For the first The value of the variable at any given time; Rolling standard deviation: (5) First-order difference: (6), Window extremes and trend slope: , (7) (8) The mean of the time indices within the window, where , These are the maximum and minimum values within the window, respectively. This represents the slope of the linear fit of the variables within the window.
3. The distributed photovoltaic power output prediction and end-side control method based on LSTM and time attention mechanism according to claim 2, characterized in that, The standardization process in step S2 is performed in two categories: For continuous features without outliers, Z-score standardization is used, with the formula: (9) in To obtain the mean of this feature in the training set, The standard deviation of this feature in the training set; For features containing outliers, robust standardization is used, with the following formula: , = - (10) in To find the median of this feature in the training set, Interquartile difference , These are the lower quartile and upper quartile of the feature in the training set, respectively; and the wind direction sine and cosine coding features do not participate in repeated standardization.
4. The distributed photovoltaic power output prediction and end-side control method based on LSTM and time attention mechanism according to claim 3, characterized in that, The feature selection and dimensionality reduction in step S2 adopts a combination of MRMR algorithm selection and PCA dimensionality reduction. The optimization objective of the MRMR algorithm for selecting key features is: (12) in For the complete feature set, After filtering dimensional feature subset, For variables and mutual information, Power output for photovoltaics; The PCA dimensionality reduction steps are as follows: First, calculate the covariance matrix of the feature set after MRMR filtering. (13) in This is the feature matrix after filtering. Given the sample size, we then solve for the eigenvalues and eigenvectors of the covariance matrix, and select the first... The eigenvectors corresponding to the largest eigenvalues constitute the projection matrix. The final dimensionality-reduced feature matrix is as follows: (14)。 5. The distributed photovoltaic power output prediction and end-side control method based on LSTM and time attention mechanism according to claim 1, characterized in that, Step S3 specifically includes the following: The model is based on LSTM and temporal attention mechanism. The model includes an input layer, an LSTM layer, an attention layer and an output layer. The role of the LSTM layer is to capture the long-term dependencies of the time series from the historical data of the input. The temporal attention mechanism allows the model to focus on important moments in the input sequence and enhance the attention to key time periods. This mechanism assigns weights by calculating the attention score at each moment, thereby generating a weighted context vector. At each time step The LSTM layer receives the current input. and the hidden state of the previous moment As input, output the hidden state at the current time step. and memory unit ; During training, the LSTM layers continuously update their hidden states. and memory unit Effectively captures long-term dependencies in time series and the hidden state at each time step. Each time step contains a weighted summary of all information from the previous time step and passes this information to the next time step. In order to enhance the model’s attention to key time steps, the hidden state sequence output by the LSTM layer introduces a time attention mechanism. The formula for calculating attention score is as follows: (21) in, These are the trainable parameters of the attention layer. Attention score for each time step; The weights for each time step are calculated by normalizing the attention scores across all time steps. The larger the weight, the greater the contribution of that time step to the prediction result; Using attention weights The hidden states of all time steps are weighted and aggregated into a context vector. : (23), Context vectors aggregated through time attention mechanism Map it to the future Step power prediction : (24) in, and These are the weights and biases for the linear output layer.
6. The distributed photovoltaic power output prediction and end-side control method based on LSTM and time attention mechanism according to claim 1, characterized in that, Step S5 specifically includes the following steps: S511: The model predicts future photovoltaic power based on the current input state, and obtains the predicted power sequence; S512: Measured power at the current moment and model predicted power Calculate the predicted residual : (27) in, The residual at time k reflects the difference between the predicted power and the actual power. S513: Based on the residual at the current time The predicted values are then corrected using the following formula: (28) in, For the corrected available power prediction, The feedback gain coefficient determines the strength of the residual's influence on the prediction. when When, it means that the correction is made entirely based on the residual; when When the time is specified, it means that the prediction result will not be modified in any way and the original prediction value will be maintained.
7. The distributed photovoltaic power output prediction and end-side control method based on LSTM and time attention mechanism according to claim 6, characterized in that... Step S5 also includes a quantile loss correction step: The model employs quantile loss during training, replacing the corrected predictions with predictions from higher quantiles. The specific formula is as follows: (31) in, The preset quantile parameters, This is the predicted result for the corresponding quantile; S524: Finally, to ensure that the prediction results are within the physically achievable range, a limiting constraint needs to be imposed on the predicted values to ensure that they do not exceed the rated power of the equipment. : , in, This is the rated power of the equipment, ensuring that the output power does not exceed the equipment's capacity or safety threshold.
8. The distributed photovoltaic power output prediction and end-side control method based on LSTM and time attention mechanism according to claim 1, characterized in that, The MPC problem in step S6 is specifically defined as follows: Objective function: (34) To predict the time domain, For the first The active power setpoint of the inverter in step. For the first The reference power of the step, To correct the predicted values, These are the weighting coefficients for each objective item. Sparsity parameters are used to control the variation of quantities. This is the sparsity penalty coefficient; Constraints: , For the first Step controls the upper limit of input. To control the time domain, , , , This represents the maximum allowable power variation of a photovoltaic inverter.
9. The distributed photovoltaic power output prediction and end-side control method based on LSTM and time attention mechanism according to claim 8, characterized in that, The specific process of solving the MPC problem using the PG method in step S7 includes: Learning rate setting: An exponentially decaying learning rate is used, with the following formula: ,in For the first The learning rate for the next iteration. The initial learning rate, This is the learning rate decay factor. This represents the number of iterations. Gradient calculation: The gradient of the objective function with respect to the active power setpoint. (36) in Let be the weight matrix of the objective function. It is the ReLU activation function. For indicator functions, To preserve the matrix, It is a difference matrix. ; Iterative update and projection: First, update the setpoint using gradient descent. (37) Given the setpoint vector for the current iteration, the updated values are then projected onto the feasible region using the following formula: , To be Operators restricted to the interval [a, b]; Convergence condition: when the number of iterations... , The maximum number of iterations, or the infinite norm of the difference between the setpoint vectors of two adjacent iterations, satisfies... , When the convergence threshold is reached, stop iterating and take the first control variable. .
Citation Information
Patent Citations
Maximum power tracking control method for photovoltaic power generation system
CN120949887A
Hybrid photovoltaic power prediction method and system based on multi-source data fusion
US20220373984A1