Microgrid short-term load prediction method and device, electronic equipment and storage medium
By combining LSTM neural networks and the Wasserstein GAN generative adversarial framework, the problems of dynamic dependency pattern capture and physical constraints in microgrid load forecasting are solved, achieving higher accuracy and more stable load forecasting.
Patent Information
- Application Number
- CN202511858167.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-10
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2045-12-10
AI Technical Summary
Existing microgrid load forecasting methods struggle to effectively capture the dynamic dependency patterns hidden in long-term time series and neglect physical balance constraints, resulting in large fluctuations in forecasting performance, easy overfitting of models, or unstable training, which limits practical engineering deployment and generalization capabilities.
We employ an LSTM neural network combined with a Wasserstein GAN generative adversarial framework. By modeling the network using physical embedding vectors and power residual feature vectors, we introduce a physical constraint loss function and a progressive training strategy to coordinate the network's structural modeling capabilities with the consistency of physical constraints, thereby improving prediction accuracy.
It significantly improves the accuracy and robustness of short-term load forecasting for microgrids, enhances the stability and physical consistency of forecast results, and improves the model's ability to generalize in complex scenarios.
Smart Images

Figure CN121328859A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of power load forecasting and artificial intelligence technology, and in particular to a method, device, electronic device and storage medium for short-term load forecasting of microgrids. Background Technology
[0002] With the rapid development of new energy technologies, microgrids, as regional energy subsystems integrating renewable energy, energy storage devices, and intelligent control systems, are increasingly becoming an important component in building flexible and efficient power systems. Microgrid loads exhibit significant nonlinearity, strong time-varying characteristics, and random fluctuations, making them susceptible to various factors such as weather changes, user behavior, and system operating status, resulting in significant challenges for short-term load forecasting.
[0003] Currently, the mainstream load forecasting methods mainly include statistical modeling methods and machine learning-based deep forecasting methods. However, existing methods generally have the following shortcomings: they are difficult to effectively capture the dynamic dependency patterns hidden in long-term series, resulting in large fluctuations in forecasting performance; they generally ignore the physical balance constraints in the microgrid power system, which may produce forecast results that do not conform to the actual operating rules; and in complex scenarios, the models are prone to overfitting or training instability, which limits the practical engineering deployment and generalization ability. Summary of the Invention
[0004] Aimed at at least in solving one of the technical problems existing in the prior art, the present invention provides a method, device, electronic device and storage medium for short-term load forecasting of microgrids, thereby improving the accuracy of short-term load forecasting of microgrids.
[0005] One aspect of the present invention provides a short-term load forecasting method for microgrids, comprising: Acquire historical operating data of the target microgrid, preprocess the historical operating data to obtain training data; The electric power features of the training data are obtained, and the electric power features are embedded into the LSTM neural network as physical prior feature vectors to obtain physical embedding vectors. The training data and physical embedding vectors are then fused to obtain a fused sequence. The fused sequence is pre-trained using an LSTM neural network to obtain a first physical constraint LSTM model; The first physical constraint LSTM model is jointly trained using the Wasserstein GAN generative adversarial framework to obtain the second physical constraint LSTM model. The discriminator of the second physical constraint LSTM model is frozen and jointly trained to obtain the microgrid short-term load forecasting model. The real-time operating data of the target microgrid is acquired, and the short-term load forecasting model of the microgrid is used to predict the real-time operating data to obtain the short-term load forecasting result of the target microgrid.
[0006] According to the aforementioned microgrid short-term load forecasting method, historical operating data of the target microgrid is obtained, and the historical operating data is preprocessed to obtain training data, including: Collect historical operating data of the target microgrid, including historical load data, historical multi-source environmental data, and historical power data; The historical operational data is preprocessed by data cleaning, data alignment, and normalization. Data cleaning includes filling in missing data using time series interpolation, identifying and deleting outlier data using box plots, and reducing noise using wavelet transform. Data alignment includes aligning the historical load data and the historical multi-source environmental data with timestamps. Normalization includes converting data of different dimensions in the historical operational data to the same scale.
[0007] According to the aforementioned microgrid short-term load forecasting method, the power characteristics of the training data are obtained, and these power characteristics are embedded into an LSTM neural network as a physical prior feature vector to obtain a physical embedding vector. The training data and the physical embedding vector are then fused to obtain a fused sequence, including: The training data is extracted to obtain the electric power characteristics, and the power balance residual is calculated based on the electric power characteristics. for: ; Among them, the power characteristics include local power generation. Interaction power with the main network Load power and line loss power , Indicates a time step; Determine the physical prior feature vector based on the characteristics of electric power and the power balance residual. for: ; The physical prior feature vector is mapped using a two-layer fully connected LSTM neural network to obtain the physical embedding vector. for: ; in, For activation function, This is the weight matrix. It is a bias term, and Represents a 64-dimensional matrix; Based on the dimension of the physical embedding vector, feature vectors of the training data are mapped to obtain a main input vector with the same dimension as the physical embedding vector. for: ; in, For the feature vectors of the training data, Represents the weight matrix. This indicates the bias term.
[0008] The physical embedding vector is copied at each time step and concatenated with the main input vector to obtain the fused sequence. for: ; in, This indicates a splicing operation. The main sequence feature matrix is the main input vector, and ,in The physical embedding vector is copied at each time step, where , This represents the total time step.
[0009] According to the microgrid short-term load forecasting method, the first physical constraint LSTM model is obtained by pre-training an LSTM neural network based on the fused sequence, including: The LSTM neural network receives the input fusion sequence at each time step, and updates the hidden state and cell state of the fusion sequence using a two-layer stacked long short-term memory network. Obtain the hidden state after the total time steps update, and convert the hidden state after the total time steps update into a prediction representation through a fully connected layer. : ; in, The hidden state after the total time step update, where This represents the weight matrix of the fully connected layer. For bias terms; The predicted representation is linearly transformed through a fully connected mapping layer to obtain the predicted load data for the next time step. ; The pre-training of the LSTM neural network is optimized using the total loss function to obtain the first physically constrained LSTM model. The total loss function is a weighted sum of the physical loss function and the mean squared error loss function. for: ; in, For the total time step, This is the power balance residual.
[0010] According to the microgrid short-term load forecasting method, the first physically constrained LSTM model is jointly trained using the Wasserstein GAN generative adversarial framework to obtain the second physically constrained LSTM model, which includes: The Wasserstein GAN generative adversarial framework includes a generator consisting of a first physical constraint LSTM model and a discriminator consisting of an encoder structure of an LSTM neural network. The predicted load data obtained from the generator is acquired, and the predicted load data and the actual load data are evaluated by a discriminator, Wasserstein distance and gradient penalty to obtain a scalar score; Based on the scalar score, the parameters of the jointly trained first physically constrained LSTM model and the Wasserstein GAN generative adversarial framework are optimized using the physical loss function, the generator's total objective loss function, and the discriminator's loss function to obtain the second physically constrained LSTM model. The generator's total objective loss function... for: ; in, To counteract the loss of weight, For physical constraint weights, Data-driven weights To combat the losses, This is the mean squared error loss; Discriminator loss function for: ; in, This represents the predicted load data generated by generator G. Expected value For the discriminator to analyze the predicted load data The output; Indicates from the true distribution data Real load data extracted from Expected value To obtain actual load data The output; This is a gradient penalty term. For the discriminator to interpolate samples gradient, Represents the L2 norm, The gradient penalty coefficient is used for interpolated samples. ,in , Represents a uniformly distributed random variable. This is the actual load data.
[0011] According to the microgrid short-term load forecasting method, the method employs an alternating approach for joint training, wherein the alternating approach includes: Update the discriminator, including freezing the generator, collecting real and predicted load data, calculating interpolation samples and discriminator loss, and backpropagating to update the discriminator parameters; or, The generator is updated, including freezing the discriminator to generate predicted load data, calculating adversarial loss, physical constraint loss and data-driven loss, and updating generator parameters through backpropagation by gradient pruning. The alternation method also includes dynamically adjusting the physical constraint weights after a preset number of epochs.
[0012] According to the aforementioned microgrid short-term load forecasting method, the discriminator of the second physically constrained LSTM model is frozen, and joint training is performed based on the second loss function to obtain the microgrid short-term load forecasting model, including: Freeze the discriminator of the second physical constraint LSTM model and stop updating the discriminator parameters; Using the parameters of the frozen discriminator as a fixed scorer, the generator of the second physical constraint LSTM model is updated using physical constraint loss, adversarial loss and data-driven loss. When updating the generator of the second physical constraint LSTM model after a preset number of epochs, the adversarial loss is decayed until the physical residual of the validation set of the training data stops decreasing, thus obtaining the microgrid short-term load forecasting model.
[0013] Another aspect of the present invention provides a microgrid short-term load forecasting device, comprising: The first module is used to acquire historical operating data of the target microgrid, preprocess the historical operating data, and obtain training data. The second module is used to acquire the electric power features of the training data, embed the electric power features as physical prior feature vectors into the LSTM neural network to obtain physical embedding vectors, and fuse the training data with the physical embedding vectors to obtain a fused sequence. The third module is used to pre-train the fused sequence using an LSTM neural network to obtain a first physical constraint LSTM model. The fourth module is used to jointly train the first physical constraint LSTM model using the Wasserstein GAN generative adversarial framework to obtain the second physical constraint LSTM model. The fifth module is used to freeze the discriminator of the second physical constraint LSTM model and perform joint training based on the second loss function to obtain the microgrid short-term load forecasting model. The sixth module is used to acquire real-time operating data of the target microgrid, and to predict the short-term load forecast results of the target microgrid by using the microgrid short-term load forecast model.
[0014] Another aspect of the present invention provides an electronic device, including a processor and a memory; The memory is used to store programs; The processor executes the program to implement the method as described above.
[0015] This invention also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the methods described above.
[0016] The beneficial effects of this invention are as follows: Using a Long Short-Term Memory (LSTM) network as the core prediction structure, the power residual feature vector representing the physical state of the system is jointly modeled with the time-series input to achieve state-aware prediction enhancement; simultaneously, the Wasserstein GAN adversarial training mechanism and physical constraint loss function (i.e., physical information neural network) are introduced to improve the stability and physical consistency of the prediction results; a progressive training strategy is adopted, through a three-stage process of physical-guided pre-training—staged adversarial optimization—parameter freezing fine-tuning, coordinating the network's structural modeling ability, data fitting ability, and physical constraint consistency, thereby significantly improving the robustness and generalization ability of the model in complex and variable operating scenarios, and improving the accuracy of short-term load prediction for microgrids in complex scenarios. Attached Figure Description
[0017] Figure 1 This is a schematic diagram of the microgrid short-term load forecasting process according to an embodiment of the present invention.
[0018] Figure 2 This is a schematic diagram of the historical data preprocessing process according to an embodiment of the present invention.
[0019] Figure 3 This is a schematic diagram of the physical embedding mapping process according to an embodiment of the present invention.
[0020] Figure 4 This is a schematic diagram of the LSTM neural network pre-training process according to an embodiment of the present invention.
[0021] Figure 5This is a schematic diagram of the joint training process of the LSTM model and generative adversarial training in an embodiment of the present invention.
[0022] Figure 6 This is a schematic diagram of a microgrid short-term load forecasting device according to an embodiment of the present invention. Detailed Implementation
[0023] The embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings. Throughout the description, the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions. In the following description, suffixes such as "module," "part," or "unit" used to denote elements are used only for the purpose of illustrative purposes and have no specific meaning in themselves. Therefore, "module," "part," or "unit" can be used interchangeably. Terms such as "first," "second," etc., are used only to distinguish technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of indicated technical features, or implicitly indicating the sequential relationship of the indicated technical features. In the following description, the consecutive reference numerals for method steps are for ease of review and understanding. Adjusting the implementation order of steps, in conjunction with the overall technical solution of the present invention and the logical relationship between the various steps, will not affect the technical effect achieved by the technical solution of the present invention. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0024] refer to Figure 1 , Figure 1 This is a microgrid short-term load forecasting process according to an embodiment of the present invention, which includes, but is not limited to, steps S100~S600: S100: Acquire historical operating data of the target microgrid, preprocess the historical operating data to obtain training data.
[0025] In some embodiments, historical operating data includes historical load data, historical multi-source environmental data, and historical power data of the target microgrid.
[0026] In some embodiments, reference Figure 2 The historical data preprocessing flowchart shown includes, but is not limited to, steps S110-S120: S110 collects historical operating data of the target microgrid, including historical load data, historical multi-source environmental data, and historical power data.
[0027] In some embodiments, historical operating data includes indicators such as load value, temperature, humidity, wind speed, and solar irradiance. The load value is the load data, representing the load of the microgrid at a certain historical moment; the temperature, humidity, wind speed, and solar irradiance are multi-source environmental data at a certain historical moment.
[0028] Understandably, the load value records the hourly electricity consumption of the microgrid and is the core target variable for prediction. Multi-source environmental data, such as temperature data, is used to capture the impact of changes in ambient temperature on the load, for example, the increased use of air conditioning in hot weather. Humidity data is used to analyze the potential impact of humidity on certain industrial or commercial electricity consumption scenarios (such as data center cooling). Wind speed data is used to assess the output fluctuations of wind power generation, which indirectly affects the load demand of the microgrid. Solar irradiance data is used to measure the output capacity of photovoltaic power generation, which further affects the power supply and demand relationship of the microgrid.
[0029] In some embodiments, historical power data includes grid interaction power, local generation power, load power, and line loss power, and is used to ensure the integrity of physical law modeling.
[0030] S120, performs preprocessing on historical operational data by sequentially performing data cleaning, data alignment, and normalization.
[0031] In some embodiments, data cleaning involves using time series interpolation to fill in missing data, box plotting to identify and remove outlier data, and wavelet transform to reduce noise in the data; data alignment involves aligning load data with multi-source environmental data using a unified timestamp, filling hourly environmental data to minute-level granularity while keeping environmental parameters constant within each hour, and performing linear interpolation on environmental data from adjacent hours to generate minute-level environmental data; and data normalization involves normalizing the data by converting data of different dimensions to the same scale and using Z-score standardization to convert the data into a distribution with a mean of 0 and a standard deviation of 1.
[0032] Understandably, training data is divided into training, validation, and test sets. The first 70% of the data is used as the training set, the middle 15% as the validation set, and the last 15% as the test set, in chronological order, to ensure consistency in data distribution between model training and evaluation.
[0033] S200: Obtain the electric power features of the training data, embed the electric power features as physical prior feature vectors into the LSTM neural network to obtain the physical embedding vector, and fuse the training data with the physical embedding vector to obtain the fused sequence.
[0034] In some embodiments, reference Figure 3 The physical embedding mapping process shown in the diagram includes, but is not limited to, steps S210 to S250: S210: Extract the training data to obtain the power characteristics, and calculate the power balance residual based on the power characteristics.
[0035] In some embodiments, power features are obtained by extracting features from the grid interaction power, local generation power, load power and line loss power of historical power data in the training data. Specifically, power features are obtained by extracting historical power data using time series features or time-related features through an LSTM neural network.
[0036] Specifically, time series features are extracted by lag features, including creating lag variables, such as various power data with preset time intervals of 1, 3, and 7 hours in advance, to capture time dependence; rolling statistical features, calculating the rolling mean, rolling standard deviation, and rolling maximum value of preset time intervals in the past; and time-related feature extraction, which extracts features from timestamps and extracts features according to hours, days, months, etc., to obtain the corresponding power features.
[0037] In some embodiments, the balancing residual The calculation method is as follows: ; Among them, the power characteristics include local power generation. Interaction power with the main network Load power and line loss power , Indicates a time step.
[0038] S220 determines the physical prior eigenvector based on the electric power characteristics and power balance residuals.
[0039] In some embodiments, physical prior feature vectors Based on the above power characteristics and balance residuals The organization of equal physical quantities yields: ; Among them, the physical prior feature vector serves as the prior feature input representing the current physical state of the system.
[0040] S230 uses a two-layer fully connected LSTM neural network to perform feature mapping on the physical prior feature vector to obtain the physical embedding vector.
[0041] In some embodiments, a physical embedding module is constructed using an LSTM neural network to perform feature mapping on the physical prior vectors, specifically implemented using a two-layer fully connected neural network structure: ; in, This is the weight matrix. For bias terms, To obtain the physical embedding vector with the same dimension as the LSTM input, the physical embedding vector is fused with the main input of the time series into a unified feature representation sequence. A broadcast concatenation mechanism is adopted to repeat the physical embedding information at each time step and concatenate it with the original sequence features, where the concatenated original sequence features are the training set in the training data.
[0042] S240, based on the dimension of the physical embedding vector, perform feature mapping on the feature vector of the training data to obtain the main input vector with the same dimension as the physical embedding vector.
[0043] In some embodiments, the feature vector of the training data is extracted through the fully connected layer of an LSTM neural network. Of course, the dynamic changes in the time series can also be captured by an LSTM neural network. Therefore, the extracted features not only reflect the current state but also include information about the past state. The features extracted from the training data are vectorized to obtain the feature vector.
[0044] In some embodiments, feature mapping refers to transforming training data into a new representation in the feature space such that the training data conforms to the input requirements of an LSTM.
[0045] In some embodiments, the physical embedding vector is concatenated and fused with the LSTM main input sequence at each time step. The feature vector of the training data of the LSTM main input sequence is... To align with the physical embedding feature dimension, the feature vector at each time step is first... Mapped to a main input vector of dimension 64 for: ; Construct the main sequence feature matrix after mapping for: ; The physical embedding vector is also copied T times so that each time step is accompanied by the same representation of the current physical state: ; S250 copies the physical embedding vector at each time step and concatenates it with the main input vector to obtain the fused sequence.
[0046] In some embodiments, the physical embedding vector is copied at each time step and concatenated with the main input vector to obtain a fused sequence. for: ; in, This indicates a splicing operation. This represents the total time step.
[0047] S300, based on the fusion sequence, uses an LSTM neural network for pre-training to obtain the first physical constraint LSTM model.
[0048] In some embodiments, the fused sequence LSTM neural network takes the feature vector of the fused sequence as input and employs a two-layer stacked Long Short-Term Memory (LSTM) network. The hidden unit dimension of each LSTM layer is set to 128. The LSTM neural network uses a standard gating mechanism, where the forget gate, input gate, and output gate all use the Sigmoid activation function, and the candidate memory units use the Tanh activation function. At the final time step of the output sequence of the last LSTM layer, its hidden state is extracted and linearly transformed through a fully connected mapping layer, mapping the 128-dimensional hidden state to a final 1-dimensional output vector used for prediction, thus obtaining the representation vector for load prediction.
[0049] refer to Figure 4 The schematic diagram of the LSTM neural network pre-training process shown includes, but is not limited to, steps S310 to S330: S310: Obtain the hidden state after the total time step update, and convert the hidden state after the total time step update into a prediction representation through a fully connected layer.
[0050] In some embodiments, prediction representation for: ; in, The hidden state after the total time step update, where This represents the weight matrix of the fully connected layer. This is a bias term.
[0051] In some embodiments, the input fused sequence is received at each time step using an LSTM neural network, and the hidden state and cell state of the fused sequence are updated using a two-layer stacked Long Short-Term Memory network. Specifically, for each time step... LSTM network receives input The hidden state is updated using a two-layer stacked long short-term memory network. and cellular state This allows us to obtain the temporal model of the LSTM neural network.
[0052] S320 performs a linear transformation on the predicted representation through a fully connected mapping layer to obtain the predicted load data for the next time step.
[0053] Among them, the predicted load data for the next moment .
[0054] S330 optimizes the pre-training of the LSTM neural network using the total loss function to obtain the first physically constrained LSTM model.
[0055] In some embodiments, the total loss function is a weighted sum of data-driven loss and physical constraint loss. , is represented as: ; Where 0.1 is the physical constraint weight and 0.9 is the data-driven weight.
[0056] In some embodiments, the optimizer of the LSTM neural network is configured to use the Adam optimization algorithm with an initial learning rate of lr = 1e-4. and The weights are set to 0.9 and 0.999 respectively, with a weight decay coefficient of 1e-5. A dynamic learning rate adjustment strategy is implemented: if the validation set loss does not significantly decrease within 50 consecutive epochs, the current learning rate is automatically decayed to 0.5 times its original value, with a minimum learning rate limit of 1e-6. The batch size is 64, and the maximum number of training epochs is set to 200. An early stopping strategy is introduced: training is terminated early if the validation loss does not improve within 10 consecutive training epochs.
[0057] S400, the first physical constraint LSTM model is jointly trained using the Wasserstein GAN generative adversarial framework to obtain the second physical constraint LSTM model.
[0058] In some embodiments, reference Figure 5 The diagram shown illustrates the joint training process of the LSTM model and generative adversarial model, which includes, but is not limited to, step S410: S410. Based on the scalar score, the parameters of the jointly trained first physical constraint LSTM model and the Wasserstein GAN generative adversarial framework are optimized using the physical loss function, the generator's total objective loss function, and the discriminator's loss function to obtain the second physical constraint LSTM model.
[0059] Physical loss function for: ; in, For the total time step, This is the power balance residual.
[0060] The Wasserstein GAN generative adversarial framework includes a generator consisting of a first-physical-constrained LSTM model and a discriminator consisting of an encoder structure of an LSTM neural network.
[0061] In some embodiments, the generator receives historical load data and prior physical state information as input to generate a short-term load forecast sequence for a future period. Specifically, the input data includes the master sequence data up to time t. With synchronously constructed physical embedding vectors The two features are fused and then fed into an LSTM network to output a predicted sequence. .
[0062] In some embodiments, the predicted load data and the actual load data are evaluated using a discriminator, Wasserstein distance, and gradient penalty to obtain a scalar score.
[0063] Specifically, the discriminator architecture adopts an LSTM-based encoder structure, outputting a sequence authenticity score, and combining the actual load data y with the generated load data. As input, the embedding layer is used to map the input features, transforming the loading values into high-dimensional features. =64), then through an LSTM encoder layer, the encoder contains 4 layers of multi-head self-attention, each layer outputting a dimension of 64. =128, extract the temporal pattern of the data, and map the sequence to a scalar score using global average pooling. .
[0064] In some embodiments, the Wasserstein distance is represented by a scalar score as follows: Wasserstein distance measures the distribution of generated data. Compared with the actual data distribution Differences between them: ; in The generated data distribution is the same as the predicted load data distribution mentioned above, and the actual data distribution is the same as the actual load data mentioned above (i.e., historical load data).
[0065] Wasserstein distance is used as the loss function, and the generator loss maximizes the discriminator's score on the generated data. ; In some embodiments, the discriminator loss is to minimize the Wasserstein distance: ; In some embodiments, gradient penalty is added to force the discriminator to satisfy the Lipschitz continuity condition, replacing weight clipping and improving training stability, for randomly interpolated samples. Calculate the gradient penalty term for: ; Where λ=10 is the penalty coefficient.
[0066] In some embodiments, jointly training a physically constrained LSTM and a generative adversarial network, and optimizing the model parameters through a physical constraint loss function and an adversarial training loss function, includes: The objective loss function includes the generator's total loss and the discriminator's loss, where the generator's total loss is as follows: ; Among them, here =0.5 is the weight for adversarial loss. =0.3 is the physical constraint weight. =0.2 is the data-driven weight. To combat the losses, This represents the mean squared error loss.
[0067] The discriminator loss is as follows: ; in, This represents the predicted load data generated by generator G. Expected value For the discriminator to analyze the predicted load data The output; Indicates from the true distribution data Real load data extracted from Expected value To obtain actual load data The output; This is a gradient penalty term. For the discriminator to interpolate samples gradient, Represents the L2 norm, The gradient penalty coefficient is used for interpolated samples. ,in , Represents a uniformly distributed random variable. This is the actual load data.
[0068] Gradient penalty coefficient =10, interpolation sample .
[0069] In some embodiments, joint training employs an alternating approach, including: Phase A involves updating the discriminator, freezing the generator, and collecting real data. and generate load data Calculate interpolation samples Calculate the discriminator loss Backpropagation updates parameters; the discriminator learning rate is limited. To prevent overfitting.
[0070] Phase B involves updating the generator, freezing the discriminator, and generating the prediction sequence. ; Calculate the damage caused by the opponent Calculate physical constraint loss With data-driven loss Backpropagation updates generator parameters, gradient clipping (threshold 1.0).
[0071] Dynamic weight adjustments are performed, increasing the physical constraint weights every 10 epochs. (Increase linearly from 0.3 to 0.5) to gradually strengthen compliance.
[0072] The generator's learning rate is determined by the initial value. =1e-5, decaying by 20% every 30 epochs; the discriminator's learning rate is fixed. =1e-4.
[0073] S500 freezes the discriminator of the second physical constraint LSTM model and performs joint training to obtain the microgrid short-term load forecasting model.
[0074] In some embodiments, provided the discriminator's capabilities are stable, the generator is further optimized to enhance the physical compliance and generation quality of the prediction results. Furthermore, by freezing the discriminator parameters, dynamic game theory during adversarial training is prevented from interfering with the generator's physical constraint optimization.
[0075] In some embodiments, if the training process involves freezing the discriminator, stopping the parameter updates of the discriminator, and using it only as a fixed scorer to provide adversarial signals, then joint loss optimization is performed, combining physical constraint loss, adversarial loss, and data-driven loss to update the generator parameters.
[0076] The loss function during joint training is: ; Among them, here =0.3 is the weight for adversarial loss. =0.6 is the physical constraint weight. Data-driven weights; optimizer configuration: Adam optimizer used in the generator, initial learning rate... Momentum parameters =0.5, =0.999. The parameters in the discriminator are completely frozen and do not participate in backpropagation.
[0077] Dynamically adjusted, with anti-loss weights applied every 10 epochs. The training is reduced by 10% to gradually decrease the impact of adversarial training; if the physical residual of the validation set does not decrease after 15 consecutive epochs, the training is terminated.
[0078] S600 acquires real-time operating data of the target microgrid, and uses the microgrid short-term load forecasting model to predict the real-time operating data, thereby obtaining the short-term load forecasting results of the target microgrid.
[0079] In some embodiments, the short-term load forecast for the target microgrid is as follows: Input data preparation: Obtain real-time historical load data of the microgrid. Meteorological data, as well as physical state information such as local power generation, main grid interaction power, and line loss power, are used to normalize all input variables in the same way as during the training phase. Time index features (such as hours and days of the week) are extracted, and master sequence data and physical prior embedding features are generated based on the constructed feature engineering scheme.
[0080] Model inference: Load the trained generator model, input preprocessed real-time data, and generate a load forecast sequence for the next hour. .
[0081] Post-processing of results, predicting values The normalization parameters of the training set are denormalized to restore the actual load values and obtain short-term load forecast results.
[0082] Figure 6 This is a schematic diagram of a microgrid short-term load forecasting device according to an embodiment of the present invention. The device includes a first module 610, a second module 620, a third module 630, a fourth module 640, a fifth module 650, and a sixth module 660.
[0083] The system comprises the following modules: The first module acquires historical operating data of the target microgrid, preprocesses the historical data to obtain training data; the second module acquires the power characteristics of the training data, embeds these power characteristics as physical prior feature vectors into an LSTM neural network to obtain a physical embedding vector, and fuses the training data with the physical embedding vector to obtain a fused sequence; the third module pre-trains the fused sequence using an LSTM neural network to obtain a first physically constrained LSTM model; the fourth module jointly trains the first physically constrained LSTM model using a Wasserstein GAN generative adversarial framework to obtain a second physically constrained LSTM model; the fifth module freezes the discriminator of the second physically constrained LSTM model and jointly trains it according to a second loss function to obtain a short-term load forecasting model for the microgrid; and the sixth module acquires real-time operating data of the target microgrid, uses the short-term load forecasting model to predict the real-time operating data, and obtains the short-term load forecasting result for the target microgrid.
[0084] Exemplarily, with the cooperation of the first, second, third, fourth, fifth, and sixth modules in the device, the embodiment device can implement any of the aforementioned microgrid short-term load forecasting methods, namely: acquiring historical operating data of the target microgrid; preprocessing the historical operating data to obtain training data; acquiring the power characteristics of the training data; embedding the power characteristics as physical prior feature vectors into an LSTM neural network to obtain a physical embedding vector; fusing the training data and the physical embedding vectors to obtain a fused sequence; pre-training the fused sequence using an LSTM neural network to obtain a first physically constrained LSTM model; jointly training the first physically constrained LSTM model using a Wasserstein GAN generative adversarial framework to obtain a second physically constrained LSTM model; freezing the discriminator of the second physically constrained LSTM model; jointly training it according to a second loss function to obtain a microgrid short-term load forecasting model; acquiring real-time operating data of the target microgrid; and using the microgrid short-term load forecasting model to predict the real-time operating data to obtain the short-term load forecasting result of the target microgrid. The beneficial effects of this invention are as follows: Using a Long Short-Term Memory (LSTM) network as the core prediction structure, the power residual feature vector representing the physical state of the system is jointly modeled with the time-series input to achieve state-aware prediction enhancement; simultaneously, the Wasserstein GAN adversarial training mechanism and physical constraint loss function (i.e., physical information neural network) are introduced to improve the stability and physical consistency of the prediction results; a progressive training strategy is adopted, through a three-stage process of physical-guided pre-training—staged adversarial optimization—parameter freezing fine-tuning, coordinating the network's structural modeling ability, data fitting ability, and physical constraint consistency, thereby significantly improving the robustness and generalization ability of the model in complex and variable operating scenarios, and improving the accuracy of short-term load prediction for microgrids in complex scenarios.
[0085] This invention also provides an electronic device, which includes a processor and a memory; The memory stores the program; The processor executes a program to perform the aforementioned microgrid short-term load forecasting method; the electronic device has the function of carrying and running the software system for microgrid short-term load forecasting provided in the embodiments of the present invention, such as a personal computer, minicomputer, mainframe, workstation, network or distributed computing environment, standalone or integrated computer platform, or communicating with charged particle tools or other imaging devices, etc.
[0086] This invention also provides a computer-readable storage medium storing a program that is executed by a processor to implement the microgrid short-term load forecasting method described above.
[0087] In some alternative embodiments, the functions / operations mentioned in the block diagrams may not occur in the order shown in the operation diagrams. For example, depending on the functions / operations involved, two consecutively shown blocks may actually be executed substantially simultaneously, or the blocks may sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts of this invention are provided by way of example to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented in the embodiments of this invention. Alternative embodiments are contemplated, in which the order of various operations is changed and sub-operations described as part of a larger operation are executed independently.
[0088] This invention also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the aforementioned microgrid short-term load forecasting method.
[0089] Furthermore, although the invention has been described in the context of functional modules, it should be understood that, unless otherwise stated, one or more of the described functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the invention. Rather, considering the properties, functions, and internal relationships of the various functional modules in the apparatus disclosed in the embodiments of the invention, the actual implementation of the module will be understood within the scope of conventional skill of an engineer. Therefore, those skilled in the art can implement the invention as set forth in the claims using ordinary techniques without excessive experimentation. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the invention, which is determined by the full scope of the appended claims and their equivalents.
[0090] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0091] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can include, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0092] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0093] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0094] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0095] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
[0096] The above is a detailed description of the preferred embodiments of the present invention, but the present invention is not limited to the embodiments described. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention, and these equivalent modifications or substitutions are all included within the scope defined by the claims of this application.
Claims
1. A method for short-term load forecasting of microgrids, characterized in that, include: Acquire historical operating data of the target microgrid, preprocess the historical operating data to obtain training data; The electric power features of the training data are obtained, and the electric power features are embedded into the LSTM neural network as physical prior feature vectors to obtain physical embedding vectors. The training data and physical embedding vectors are then fused to obtain a fused sequence. The fused sequence is pre-trained using an LSTM neural network to obtain a first physical constraint LSTM model; The first physical constraint LSTM model is jointly trained using the Wasserstein GAN generative adversarial framework to obtain the second physical constraint LSTM model. The discriminator of the second physical constraint LSTM model is frozen and jointly trained to obtain the microgrid short-term load forecasting model. The real-time operating data of the target microgrid is acquired, and the short-term load forecasting model of the microgrid is used to predict the real-time operating data to obtain the short-term load forecasting result of the target microgrid.
2. The microgrid short-term load forecasting method according to claim 1, characterized in that, The process of acquiring historical operating data of the target microgrid, preprocessing the historical operating data to obtain training data, includes: Collect historical operating data of the target microgrid, including historical load data, historical multi-source environmental data, and historical power data; The historical operational data is preprocessed by data cleaning, data alignment, and normalization. Data cleaning includes filling in missing data using time series interpolation, identifying and deleting outlier data using box plots, and reducing noise using wavelet transform. Data alignment includes aligning the historical load data and the historical multi-source environmental data with timestamps. Normalization includes converting data of different dimensions in the historical operational data to the same scale.
3. The microgrid short-term load forecasting method according to claim 1, characterized in that, The process involves acquiring the electric power features from the training data, embedding these features as a physical prior feature vector into an LSTM neural network to obtain a physical embedding vector, and then fusing the training data with the physical embedding vector to obtain a fused sequence, including: The training data is extracted to obtain the electric power characteristics, and the power balance residual is calculated based on the electric power characteristics. for: ; Among them, the power characteristics include local power generation. Interaction power with the main network Load power and line loss power , Indicates a time step; Determine the physical prior feature vector based on the characteristics of electric power and the power balance residual. for: ; The physical prior feature vector is mapped using a two-layer fully connected LSTM neural network to obtain the physical embedding vector. for: ; in, For activation function, This is the weight matrix. It is a bias term, and Represents a 64-dimensional matrix; Based on the dimension of the physical embedding vector, feature vectors of the training data are mapped to obtain a main input vector with the same dimension as the physical embedding vector. for: ; in, For the feature vectors of the training data, Represents the weight matrix. Indicates the bias term; The physical embedding vector is copied at each time step and concatenated with the main input vector to obtain the fused sequence. for: ; in, This indicates a splicing operation. The main sequence feature matrix is the main input vector, and ,in The physical embedding vector is copied at each time step, where , This represents the total time step.
4. The microgrid short-term load forecasting method according to claim 3, characterized in that, The step of pre-training an LSTM neural network based on the fused sequence to obtain a first physically constrained LSTM model includes: The LSTM neural network receives the input fusion sequence at each time step, and updates the hidden state and cell state of the fusion sequence using a two-layer stacked long short-term memory network. Obtain the hidden state after the total time steps update, and convert the hidden state after the total time steps update into a prediction representation through a fully connected layer. : ; in, The hidden state after the total time step update, where This represents the weight matrix of the fully connected layer. For bias terms; The predicted representation is linearly transformed through a fully connected mapping layer to obtain the predicted load data for the next time step. ; The pre-training of the LSTM neural network is optimized using the total loss function to obtain the first physically constrained LSTM model. The total loss function is a weighted sum of the physical loss function and the mean squared error loss function. for: ; in, For the total time step, This is the power balance residual.
5. The microgrid short-term load forecasting method according to claim 4, characterized in that, The process of jointly training the first physically constrained LSTM model using the Wasserstein GAN generative adversarial framework to obtain the second physically constrained LSTM model includes: The Wasserstein GAN generative adversarial framework includes a generator consisting of a first physical constraint LSTM model and a discriminator consisting of an encoder structure of an LSTM neural network. The predicted load data obtained from the generator is acquired, and the predicted load data and the actual load data are evaluated by a discriminator, Wasserstein distance and gradient penalty to obtain a scalar score; Based on the scalar score, the parameters of the jointly trained first physically constrained LSTM model and the Wasserstein GAN generative adversarial framework are optimized using the physical loss function, the generator's total objective loss function, and the discriminator's loss function to obtain the second physically constrained LSTM model. The generator's total objective loss function... for: ; in, To counteract the loss of weight, For physical constraint weights, Data-driven weights To combat the losses, This is the mean squared error loss; Discriminator loss function for: ; in, This represents the predicted load data generated by generator G. Expected value For the discriminator to analyze the predicted load data The output; Indicates from the true distribution data Real load data extracted from Expected value To obtain actual load data The output; This is a gradient penalty term. For the discriminator to interpolate samples gradient, Represents the L2 norm, The gradient penalty coefficient is used for interpolated samples. ,in , Represents a uniformly distributed random variable. This is the actual load data.
6. The microgrid short-term load forecasting method according to claim 5, characterized in that, The method employs an alternating approach for joint training, wherein the alternating approach includes: Update the discriminator, including freezing the generator, collecting real and predicted load data, calculating interpolation samples and discriminator loss, and backpropagating to update the discriminator parameters; or, The generator is updated, including freezing the discriminator to generate predicted load data, calculating adversarial loss, physical constraint loss and data-driven loss, and updating generator parameters through backpropagation by gradient pruning. The alternation method also includes dynamically adjusting the physical constraint weights after a preset number of epochs.
7. The microgrid short-term load forecasting method according to claim 5, characterized in that, The process of freezing the discriminator of the second physically constrained LSTM model and jointly training it according to the second loss function to obtain the microgrid short-term load forecasting model includes: Freeze the discriminator of the second physical constraint LSTM model and stop updating the discriminator parameters; Using the parameters of the frozen discriminator as a fixed scorer, the generator of the second physical constraint LSTM model is updated using physical constraint loss, adversarial loss and data-driven loss. When updating the generator of the second physical constraint LSTM model after a preset number of epochs, the adversarial loss is decayed until the physical residual of the validation set of the training data stops decreasing, thus obtaining the microgrid short-term load forecasting model.
8. A short-term load forecasting device for microgrids, characterized in that, include: The first module is used to acquire historical operating data of the target microgrid, preprocess the historical operating data, and obtain training data. The second module is used to acquire the electric power features of the training data, embed the electric power features as physical prior feature vectors into the LSTM neural network to obtain physical embedding vectors, and fuse the training data with the physical embedding vectors to obtain a fused sequence. The third module is used to pre-train the fused sequence using an LSTM neural network to obtain a first physical constraint LSTM model. The fourth module is used to jointly train the first physical constraint LSTM model using the Wasserstein GAN generative adversarial framework to obtain the second physical constraint LSTM model. The fifth module is used to freeze the discriminator of the second physical constraint LSTM model and perform joint training based on the second loss function to obtain the microgrid short-term load forecasting model. The sixth module is used to acquire real-time operating data of the target microgrid, and to predict the short-term load forecast results of the target microgrid by using the microgrid short-term load forecast model.
9. An electronic device, characterized in that, Including the processor and memory; The memory is used to store programs; The processor executes the program to implement the microgrid short-term load forecasting method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The storage medium stores a program that is executed by a processor to implement the microgrid short-term load forecasting method as described in any one of claims 1-7.
Citation Information
Patent Citations
Short-term load prediction method and system
CN113256017A
Generative adversarial network-based power grid load sequence prediction method and system
CN114239934A
Power grid load prediction method and device based on GAN and GRU neural networks
CN115619040A
Small sample load prediction method based on hybrid neural network and generative adversarial
CN115640901A
Family load short-term prediction method based on signal decomposition and adversarial learning
CN115879592A
Cited By
Multi-task learning model, training method, electronic equipment and computer storage medium
CN121599045A
Generative adversarial learning-based load prediction method and system in complex weather
CN121863370A
A short-term load prediction method based on quantum hybrid features
CN122553104A