Micro-grid group collaborative optimization scheduling and demand response method based on AI driving
By constructing a state prediction model through deep probabilistic modeling and recursive Bayesian estimation, and combining it with adaptive game equilibrium algorithm and reinforcement learning, the problem of coordinated optimization and demand response of microgrid groups is solved, achieving high-precision prediction and energy mutual assistance, and improving energy utilization efficiency and the robustness of scheduling strategy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- STATE GRID SHANGHAI MUNICIPAL ELECTRIC POWER CO
- Filing Date
- 2025-12-19
- Publication Date
- 2026-04-24
AI Technical Summary
Existing microgrid dispatching methods are ill-equipped to handle the random fluctuations in renewable energy generation and electricity load, lack the ability to handle multi-source uncertainties, and cannot achieve overall coordinated optimization of microgrid groups. Furthermore, existing methods suffer from communication constraints and physical limitations during execution, resulting in insufficient adaptability and robustness.
A state prediction model is constructed using deep probabilistic modeling and recursive Bayesian estimation. Combined with an adaptive game equilibrium algorithm and reinforcement learning, control instructions are generated through a hierarchical consensus mechanism. The scheduling strategy is optimized in real time and learned online to adapt to execution deviations.
It enables high-precision prediction of power generation, power load and energy storage status, quickly identifies energy exchange opportunities, improves energy utilization efficiency, reduces operating costs, and ensures efficient and reliable transmission and execution of control commands.
Smart Images

Figure CN121923087A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to artificial intelligence technology, and more particularly to an AI-driven method for collaborative optimization scheduling and demand response of microgrid groups. Background Technology
[0002] Existing microgrid dispatching methods primarily rely on deterministic models for optimization, making it difficult to address the stochastic fluctuations in renewable energy generation and electricity load. Most existing methods employ simplified prediction models with insufficient accuracy, failing to effectively handle multi-source uncertainties and resulting in significant deviations between optimization results and actual operating conditions. Furthermore, traditional methods typically treat microgrids as independent entities, lacking consideration for the overall coordinated optimization of microgrid groups and failing to fully utilize the energy complementarity between microgrids.
[0003] Existing AI applications in microgrid optimization and scheduling mainly focus on single algorithms, such as simple neural network prediction or basic reinforcement learning optimization, lacking the organic integration of multiple AI technologies. Existing methods often ignore the impact of prediction uncertainty on optimization decisions and fail to establish a closed-loop feedback mechanism for prediction-optimization-execution. Furthermore, most methods are not designed to consider communication constraints and physical limitations in actual execution, resulting in poor performance of theoretically optimal solutions in practical applications.
[0004] Existing demand response methods for microgrid clusters typically employ centralized control strategies, which place high demands on the reliability of communication networks and are susceptible to single-point failures. While distributed control methods have been studied, they lack consideration of the game-theoretic relationships and benefit-sharing mechanisms among nodes within the microgrid cluster, making it difficult to achieve fair and efficient energy sharing. Furthermore, most existing methods utilize static decision-making models, failing to dynamically adjust strategy parameters based on real-time execution conditions, resulting in insufficient adaptability and robustness. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides an AI-driven collaborative optimization scheduling and demand response method for microgrid groups, which can solve the problems in existing technologies.
[0006] A first aspect of this invention provides an AI-driven microgrid group collaborative optimization scheduling and demand response method, comprising:
[0007] The system acquires operational data from multiple microgrids. Based on this operational data, a state prediction model for the microgrid cluster is established using a deep probabilistic modeling method. The state prediction model outputs predicted power generation, predicted power load, and predicted energy storage status. The prediction deviation is calculated in real time using a recursive Bayesian estimation method, and the parameters of the state prediction model are dynamically updated based on the deviation value.
[0008] Based on the output results and prediction deviation of the state prediction model, the overall power surplus and energy gap of the microgrid group are calculated, and a resource state matrix containing the power generation capacity, energy storage regulation space and transferable load of each microgrid is generated. Based on the resource state matrix and the fast scenario library, energy mutual assistance opportunities are identified.
[0009] Based on the energy mutual aid opportunities and resource constraints, an adaptive game equilibrium algorithm is used to solve the energy optimization allocation scheme; the optimization allocation scheme is input into a reinforcement learning model, the allocation weights are dynamically adjusted based on historical execution results, and the final scheduling strategy is output.
[0010] Based on the final scheduling strategy, a hierarchical consensus mechanism is used to generate control commands for each microgrid.
[0011] The system collects command execution data from each microgrid in real time. When an execution deviation exceeds a preset deviation threshold, the execution data is input into the state prediction model for online learning, dynamically optimizing the execution parameters of the scheduling strategy.
[0012] Optionally,
[0013] A state prediction model for a microgrid cluster is established using a deep probabilistic modeling method. This model outputs predicted power generation, predicted load, and predicted energy storage status. The prediction deviation is calculated in real-time using a recursive Bayesian estimation method. The parameters of the state prediction model are then dynamically updated based on the deviation values. The steps include:
[0014] A multi-task shared conditional variational autoencoder is constructed as the basic architecture of the state prediction model. The conditional variational autoencoder includes a feature extraction layer, a temporal dependency layer, and an attention layer. The feature extraction layer uses one-dimensional convolution to extract features from the running data. The temporal dependency layer uses a bidirectional long short-term memory network to process the output data of the feature extraction layer. The attention layer uses a multi-head attention mechanism to assign weights to the output data of the temporal dependency layer.
[0015] The output data of the conditional variational autoencoder is input into the Gaussian mixture model, and the distribution parameters of the Gaussian mixture model are optimized by the expectation-maximization algorithm to obtain the initial prediction results.
[0016] A Bayesian neural network is used to perform recursive Bayesian estimation on the initial prediction result. At each time step, cognitive uncertainty and random uncertainty are calculated through probability weight distribution. The cognitive uncertainty is calculated by the variance of the weight posterior distribution, and the random uncertainty is calculated by the variance of the likelihood function. The cognitive uncertainty and random uncertainty are added together to obtain the prediction bias at the current time step.
[0017] Based on the prediction bias, a prediction confidence interval is constructed. By minimizing the deviation between the prediction interval coverage and the preset confidence level, the upper and lower bounds of the prediction confidence interval are dynamically optimized, and the parameters of the state prediction model are updated according to the optimization results of the prediction confidence interval.
[0018] Based on the optimization results of the prediction confidence interval, the state prediction model outputs the predicted values of power generation, power load, and energy storage status.
[0019] Optionally,
[0020] Based on the output and prediction deviation of the state prediction model, the overall power surplus and energy deficit of the microgrid group are calculated, and a resource state matrix containing the generation capacity, energy storage regulation space, and transferable load of each microgrid is generated. The steps of matching and identifying energy mutual assistance opportunities based on the resource state matrix and the fast scenario library include:
[0021] The corrected power generation, corrected load demand, and corrected energy storage capacity of the microgrid group are calculated using the output results and prediction deviation of the state prediction model, and the power surplus value and energy deficit value are calculated.
[0022] Clustering historical operating data yields multiple typical scenarios, and the scenario weights of these typical scenarios are calculated. Based on the corrected power generation, corrected load demand, and corrected energy storage capacity, a current state vector is constructed. The best matching scenario is determined based on the similarity between the current state vector and the typical scenarios, as well as the scenario weights.
[0023] A resource state matrix for a microgrid cluster is constructed, wherein the power generation capacity sub-matrix includes the corrected power generation capacity and the power surplus value, the energy storage regulation sub-matrix includes the corrected energy storage capacity, the maximum charging power, and the maximum discharging power, and the transferable load sub-matrix includes the corrected load demand and the energy deficit value; the power and capacity parameters in the resource state matrix are dynamically corrected based on the optimal matching scenario;
[0024] The energy complementarity and resource matching degree between any two microgrids are calculated based on the corrected resource state matrix. The energy complementarity is calculated by the inner product of the power surplus value and the energy deficit value, and the resource matching degree is calculated by the ratio of the power generation capacity submatrix to the energy storage regulation submatrix. The product of the energy complementarity, resource matching degree and the similarity of the optimal matching scenario is used as the energy mutual assistance feasibility index. Based on the energy mutual assistance feasibility index, energy mutual assistance opportunities of microgrid groups are identified.
[0025] Optionally,
[0026] Based on the energy mutual aid opportunities and resource constraints identified by the resource state matrix, an adaptive game equilibrium algorithm is used to solve for the optimal energy allocation scheme. The steps of inputting the optimal allocation scheme into a reinforcement learning model, dynamically adjusting the allocation weights based on historical execution results, and outputting a final scheduling strategy considering execution reliability include:
[0027] The energy mutual assistance opportunity is used as the basis for selecting game participants. The mutual assistance weights among participants are calculated based on the energy mutual assistance feasibility index. A utility function containing mutual assistance benefit, operating cost, and load deviation is constructed. The product of the mutual assistance weight and the calculation result of the utility function is used as the weighted utility value.
[0028] Establish game constraints, including mutual capacity constraints and matching degree constraints. The mutual capacity constraints are determined based on the power surplus value and energy gap value, and the matching degree constraints are determined based on the resource matching degree. The Nash bargaining solution method is used to calculate the game equilibrium solution, and the energy optimization allocation scheme is obtained by maximizing the product of the difference between the weighted utility value and the retention utility value.
[0029] Construct a state vector containing power generation, load demand, energy storage capacity, and mutual assistance power, and an action vector containing mutual assistance power adjustment and energy storage adjustment; design a reward function, which includes an economic benefit term, a reliability index term, and an execution deviation term; use the energy optimization allocation scheme as the initial strategy for reinforcement learning, and train a reinforcement learning model based on the state vector, action vector, and reward function;
[0030] The execution success rate and actual execution deviation of historical scheduling schemes are statistically analyzed, and an execution reliability index is calculated based on the execution success rate and the actual execution deviation. The execution reliability index is combined with the Q-value update result to generate allocation weights, and the energy optimization allocation scheme is adjusted using the allocation weights to output the final scheduling strategy.
[0031] Optionally,
[0032] The steps of using the energy optimization allocation scheme as the initial policy for reinforcement learning and training a reinforcement learning model based on the state vector, action vector, and reward function include:
[0033] A multi-dimensional state space is constructed, and the mutual power, energy storage state, and load allocation in the energy optimization allocation scheme are combined with the power change rate, energy storage change rate, and historical execution characteristics to form a time-series state vector; the time-series state vector is standardized to obtain a normalized state vector.
[0034] A hierarchical action space is constructed, with the mutual power adjustment amount and adjustment time window forming the main action space, and the energy storage adjustment amount and compensation coefficient forming the auxiliary action space; based on the main action space and the auxiliary action space, action constraints are constructed, and the action constraints are mapped to the feasible action space.
[0035] A dual experience pool is constructed: the state-action sequence corresponding to the energy optimization allocation scheme is stored in the game equilibrium solution experience pool, and the state-action sequence with a historical execution success rate greater than a preset success rate threshold is stored in the historical execution experience pool; a combined loss function is calculated based on the game equilibrium solution experience pool and the historical execution experience pool.
[0036] An embedded network structure is adopted. The game layer parameters are updated based on the game equilibrium loss, and the update magnitude is inversely proportional to the action deviation. The execution layer parameters are updated based on the execution deviation loss, and the update magnitude is directly proportional to the action deviation. In the initial training stage, the game equilibrium features are learned by using fixed sampling parameters. In the training transition stage, the sampling parameters are adjusted according to the cosine law to gradually introduce execution experience. In the training stabilization stage, a dual learning strategy with a fixed ratio is adopted.
[0037] Optionally,
[0038] The steps of learning game equilibrium features using fixed sampling parameters in the initial training phase, gradually introducing execution experience by adjusting the sampling parameters according to the cosine law in the transition training phase, and employing a fixed-proportion dual learning strategy in the stable training phase include:
[0039] The root mean square deviation of the Q-values of the samples in the game equilibrium solution experience pool is calculated as the game equilibrium metric. When the game equilibrium metric meets the preset conditions, the training initial stage is entered, and training data is sampled from the two experience pools at a fixed ratio.
[0040] The rate of change of the parameter update amplitude is used as a training stability index. When the training stability index and the game equilibrium measurement index simultaneously meet the preset conditions, the training transition phase is entered. The sampling weight adjustment coefficient is calculated based on the training round. The sampling weight adjustment coefficient gradually transitions from the initial weight to the target weight according to the cosine decreasing law with the training round.
[0041] The exponential moving average of the prediction error of historical execution samples is calculated as the execution fit index; when the execution fit index and the training stability index simultaneously meet the preset conditions, the training stability phase is entered, and the fixed sampling ratio of dual learning is determined according to the ratio of the game equilibrium metric index and the execution fit index.
[0042] The game equilibrium metric, the training stability metric, and the execution fitting metric are monitored in real time. When any metric exceeds the corresponding threshold, the training phase is rolled back to the previous phase. The corresponding preset threshold is dynamically adjusted based on the difference between the metrics before and after the rollback.
[0043] Optionally,
[0044] According to the final scheduling strategy, the steps for generating control commands for each microgrid using a hierarchical consensus mechanism include:
[0045] A power setting value is generated based on the final scheduling strategy; the response time requirement is calculated based on the difference between the power setting value and the current power; and the execution priority is determined based on the adjustment amplitude of the power setting value.
[0046] A power consistency constraint is established based on the power setpoint, which requires that the power setpoint deviation between adjacent microgrids within the consensus subnet be less than a preset power deviation threshold; a timing coordination constraint is established based on the response time requirement, which ensures that the instruction execution time of adjacent microgrids meets the communication delay requirement; and control instructions for the microgrid group are deployed hierarchically based on the execution priority.
[0047] A time-varying adjacency matrix is constructed by obtaining the connection status between microgrids, and a link weight matrix is constructed based on a comprehensive evaluation of link delay and bandwidth; the communication path with minimal delay is calculated according to the time-varying adjacency matrix and the link weight matrix.
[0048] A comprehensive evaluation index is obtained by calculating the reciprocal of link delay, bandwidth utilization, and link reliability. The link state transition probability is updated based on the difference between the comprehensive evaluation index and the average link quality. The communication path is optimized based on the link state transition probability, and the control command is transmitted to each microgrid according to the optimized communication path.
[0049] The steps for real-time acquisition of command execution data from each microgrid and dynamic optimization of scheduling strategy execution parameters include: real-time acquisition of command execution data from each microgrid; when an execution deviation is detected to exceed a preset deviation threshold, the execution data is input into a state prediction model for online learning to dynamically optimize the execution parameters of the scheduling strategy.
[0050] In a second aspect, a computer-readable storage medium is provided, having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
[0051] Thirdly, an electronic device is provided, comprising:
[0052] processor;
[0053] Memory used to store processor-executable instructions;
[0054] The processor is configured to invoke instructions stored in the memory to execute the aforementioned method.
[0055] This invention constructs a high-precision state prediction model by combining deep probabilistic modeling and recursive Bayesian estimation, enabling accurate prediction of power generation, power load, and energy storage status. At the same time, it quantifies prediction uncertainty, providing a reliable basis for subsequent optimization decisions. Based on the energy mutual assistance identification method matching resource state matrix and scenario library, it can quickly discover energy complementarity opportunities within microgrid groups, improve energy utilization efficiency, and reduce overall operating costs.
[0056] This invention combines an adaptive game equilibrium algorithm with reinforcement learning to solve energy optimization allocation schemes while ensuring fairness. It also dynamically adjusts allocation weights based on historical execution data, realizing the transformation from theoretical optimal solutions to practically reliable execution schemes. Furthermore, it employs a hierarchical consensus mechanism to generate control commands, comprehensively considering power consistency constraints, timing coordination constraints, and communication network characteristics to ensure that control commands can be transmitted and executed efficiently and reliably. Attached Figure Description
[0057] Figure 1 This is a flowchart illustrating the AI-driven microgrid group collaborative optimization scheduling and demand response method according to an embodiment of the present invention.
[0058] Figure 2 A comparison chart showing the execution deviations of different scheduling strategies in actual microgrid groups. Detailed Implementation
[0059] The technical solutions of the present invention will be described below with reference to the accompanying drawings. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0060] Figure 1 This is a flowchart illustrating the AI-driven microgrid group collaborative optimization scheduling and demand response method of the present invention, as shown below. Figure 1 As shown, the method includes:
[0061] The system acquires operational data from multiple microgrids. Based on this operational data, a state prediction model for the microgrid cluster is established using a deep probabilistic modeling method. The state prediction model outputs predicted power generation, predicted power load, and predicted energy storage status. The prediction deviation is calculated in real time using a recursive Bayesian estimation method, and the parameters of the state prediction model are dynamically updated based on the deviation value.
[0062] Based on the output results and prediction deviation of the state prediction model, the overall power surplus and energy gap of the microgrid group are calculated, and a resource state matrix containing the power generation capacity, energy storage regulation space and transferable load of each microgrid is generated. Based on the resource state matrix and the fast scenario library, energy mutual assistance opportunities are identified.
[0063] Based on the energy mutual aid opportunities and resource constraints, an adaptive game equilibrium algorithm is used to solve the energy optimization allocation scheme; the optimization allocation scheme is input into a reinforcement learning model, the allocation weights are dynamically adjusted based on historical execution results, and the final scheduling strategy is output.
[0064] Based on the final scheduling strategy, a hierarchical consensus mechanism is used to generate control commands for each microgrid.
[0065] The system collects command execution data from each microgrid in real time. When an execution deviation exceeds a preset deviation threshold, the execution data is input into the state prediction model for online learning, dynamically optimizing the execution parameters of the scheduling strategy.
[0066] Optionally,
[0067] A state prediction model for a microgrid cluster is established using a deep probabilistic modeling method. This model outputs predicted power generation, predicted load, and predicted energy storage status. The prediction deviation is calculated in real-time using a recursive Bayesian estimation method. The parameters of the state prediction model are then dynamically updated based on the deviation values. The steps include:
[0068] A multi-task shared conditional variational autoencoder is constructed as the basic architecture of the state prediction model. The conditional variational autoencoder includes a feature extraction layer, a temporal dependency layer, and an attention layer. The feature extraction layer uses one-dimensional convolution to extract features from the running data. The temporal dependency layer uses a bidirectional long short-term memory network to process the output data of the feature extraction layer. The attention layer uses a multi-head attention mechanism to assign weights to the output data of the temporal dependency layer.
[0069] The output data of the conditional variational autoencoder is input into the Gaussian mixture model, and the distribution parameters of the Gaussian mixture model are optimized by the expectation-maximization algorithm to obtain the initial prediction results.
[0070] A Bayesian neural network is used to perform recursive Bayesian estimation on the initial prediction result. At each time step, cognitive uncertainty and random uncertainty are calculated through probability weight distribution. The cognitive uncertainty is calculated by the variance of the weight posterior distribution, and the random uncertainty is calculated by the variance of the likelihood function. The cognitive uncertainty and random uncertainty are added together to obtain the prediction bias at the current time step.
[0071] Based on the prediction bias, a prediction confidence interval is constructed. By minimizing the deviation between the prediction interval coverage and the preset confidence level, the upper and lower bounds of the prediction confidence interval are dynamically optimized, and the parameters of the state prediction model are updated according to the optimization results of the prediction confidence interval.
[0072] Based on the optimization results of the prediction confidence interval, the state prediction model outputs the predicted values of power generation, power load, and energy storage status.
[0073] For example, the conditional variational autoencoder comprises three main components: a feature extraction layer, a temporal dependency layer, and an attention layer. The feature extraction layer uses a one-dimensional convolutional network to extract features from microgrid operation data. It sets up three convolutional layers with kernel sizes of 5, 3, and 3, and the number of kernels are 64, 128, and 256, respectively, with a stride of 1 for each. Each convolutional layer is followed by a batch normalization layer and a ReLU activation function to effectively extract local feature patterns from the microgrid operation data. For example, for wind power data, the convolutional layer can capture short-term power fluctuations; for photovoltaic power generation data, it can identify the periodic characteristics of day-night cycles; and for load data, it can extract peak and off-peak load characteristics.
[0074] The time-series dependency layer employs a bidirectional Long Short-Term Memory (LSTM) network to process the output data of the feature extraction layer, capturing long-term dependencies in the time series. The bidirectional LSTM is configured as a two-layer structure, with each layer containing 128 hidden units (64 forward and 64 backward). The input is a 256-dimensional feature vector output from the feature extraction layer, which is processed through time-step expansion of 24-hour time-series data. The bidirectional structure can simultaneously consider past and future information; for example, when predicting electricity load, it can utilize information from similar periods of the previous day and expected changes the following day, improving prediction accuracy. In practical applications, a sliding window processing method is applied to the historical data from the previous week, with a window size of 168 hours and a step size of 1 hour, enabling the model to fully learn the periodic patterns of microgrid operation data.
[0075] The attention layer employs a multi-head attention mechanism to weight the output data of the time-dependent layer. Eight attention heads are set up, each with a 32-dimensional query, key, and value matrix. By calculating the correlation between different time steps, the importance of features at each time step is dynamically adjusted. For example, when predicting photovoltaic power generation, historical data from cloudy and sunny days should be assigned different weights; when predicting electricity load, the data patterns of weekdays and weekends differ significantly, and the attention mechanism can automatically identify and assign appropriate weights. In practical applications, the attention score is calculated through a dot product, normalized using softmax, and then weighted and summed with the value vector to obtain a weighted feature representation.
[0076] The output data of the conditional variational autoencoder is input into a Gaussian mixture model. This model consists of five Gaussian components, each characterized by three parameters: mean, covariance, and mixture weights. The expectation-maximization (EM) algorithm is used to optimize these parameters, with 100 iterations and a convergence threshold of 0.001. The E-step calculates the posterior probability of each data point belonging to each Gaussian component; the M-step updates the parameters of each component based on the posterior probabilities. For example, for photovoltaic power generation data of 300 kW at a certain moment, the calculated probability might be 0.7 for the first component, 0.2 for the second, and 0.1 for any other component. When updating the parameters, all data points are weighted and averaged according to their posterior probabilities to obtain new mean, covariance, and mixture weights. The E-step and M-step are performed alternately until the parameter changes are minimal or the maximum number of iterations is reached. After convergence, the optimal Gaussian mixture parameters are obtained and used to generate initial prediction results. For example, when predicting photovoltaic power generation for the next 24 hours, a probability distribution is output for each hour, which includes both point prediction values and uncertainty information.
[0077] The Bayesian neural network employs a three-layer structure. The number of nodes in the input layer corresponds to the output dimension of the Gaussian mixture model, the number of nodes in the hidden layer is 64, and the number of nodes in the output layer corresponds to the predicted target dimension (power generation, power load, and energy storage status). Unlike traditional neural networks, the weights in a Bayesian neural network are random variables rather than deterministic values, following a probability distribution. The prior distribution of the weights is set to a Gaussian distribution with a mean of 0 and a variance of 0.1. The posterior distribution is approximated using variational inference methods (specifically, the variational Bayesian algorithm), and then 50 random samples are performed using the Monte Carlo method to estimate the prediction uncertainty. Cognitive uncertainty and accidental uncertainty quantify prediction uncertainty from two different sources:
[0078] Cognitive uncertainty reflects the prediction variation caused by the uncertainty of model parameters. The calculation steps are as follows: randomly sample 50 different sets of network weight parameters from the approximate posterior distribution of the weights. For the same input data, calculate the predicted value using these 50 sets of weights respectively. The variance of these 50 prediction results is the cognitive uncertainty. For example, for the photovoltaic power generation at a certain moment, the 50 sampled predicted values are 495 kW, 510 kW, 485 kW, etc., and the calculated variance is 225 kW. 2 This indicates that the model's cognitive uncertainty regarding the prediction is 225 kilowatts. 2 Such uncertainty is particularly pronounced when training data is insufficient or of poor quality.
[0079] Random uncertainty: reflects the randomness of the data itself. The calculation steps are as follows: the Bayesian neural network is designed with a dual-output structure, one output predicting the mean μ, and the other output predicting the log-variance log(σ). 2 ) through exponential transformation exp(log(σ) 2 The variance value σ is obtained. 2 This variance is the random uncertainty. For example, for a load forecast at a certain moment, if the network output mean is 800 kW and the logarithmic variance is 4.605, then the random uncertainty is exp(4.605) = 100 kW. 2 This means that even if the model is perfect, the randomness of the data itself will cause the predicted value to fluctuate around the mean, with a standard deviation of about 10 kilowatts.
[0080] The prediction bias at the current time step is obtained by adding cognitive uncertainty and random uncertainty. For example, if the cognitive uncertainty of wind power prediction at a certain moment is 0.05 and the random uncertainty is 0.08, then the total prediction bias is 0.13. A prediction confidence interval is constructed based on the prediction bias, with a confidence level set at 95%. The upper and lower bounds of the prediction confidence interval are dynamically optimized by minimizing the deviation between the prediction interval coverage and the preset confidence level. In specific implementation, a sliding window method is used with a window size of 72 hours. The proportion of predicted values falling into the confidence interval in the past 72 hours is calculated and compared with the target confidence level of 0.95. If the actual coverage is lower than 0.95, the confidence interval is expanded; if it is higher than 0.95, the confidence interval is appropriately narrowed, with the adjustment magnitude proportional to the bias.
[0081] The parameters of the state prediction model are updated using an adaptive learning rate strategy. The base learning rate is set to 0.001 and dynamically adjusted based on the magnitude of the prediction deviation. When the prediction deviation is large, the learning rate is increased to accelerate model convergence; when the prediction deviation is small, the learning rate is decreased to improve stability. Specifically, when the prediction deviation is greater than 0.2, the learning rate is adjusted to 0.005; when the prediction deviation is less than 0.05, the learning rate is adjusted to 0.0005. The model update uses the mini-batch gradient descent method with a batch size of 32 and 50 training epochs.
[0082] Based on the optimized prediction confidence intervals, the state prediction model outputs predicted power generation, power load, and energy storage status. The prediction results include both point predictions and corresponding uncertainty metrics. For example, at a certain moment, the predicted photovoltaic power generation is 500 kW, with a 95% confidence interval of [450 kW, 550 kW]; the predicted power load is 800 kW, with a 95% confidence interval of [760 kW, 840 kW]; and the predicted energy storage status is 70%, with a 95% confidence interval of [65%, 75%]. These prediction results will be used for subsequent energy mutual aid identification and optimized scheduling.
[0083] This scheme achieves high-precision prediction of microgrid group status by combining a multi-task shared conditional variational autoencoder with a mixture of Gaussian distribution models and Bayesian neural networks, while quantifying the uncertainty of the prediction. It distinguishes between cognitive uncertainty and accidental uncertainty, dynamically optimizes the prediction confidence interval, and improves the reliability and adaptability of the prediction results.
[0084] Optionally,
[0085] Based on the output and prediction deviation of the state prediction model, the overall power surplus and energy deficit of the microgrid group are calculated, and a resource state matrix containing the generation capacity, energy storage regulation space, and transferable load of each microgrid is generated. The steps of matching and identifying energy mutual assistance opportunities based on the resource state matrix and the fast scenario library include:
[0086] The corrected power generation, corrected load demand, and corrected energy storage capacity of the microgrid group are calculated using the output results and prediction deviation of the state prediction model, and the power surplus value and energy deficit value are calculated.
[0087] Clustering historical operating data yields multiple typical scenarios, and the scenario weights of these typical scenarios are calculated. Based on the corrected power generation, corrected load demand, and corrected energy storage capacity, a current state vector is constructed. The best matching scenario is determined based on the similarity between the current state vector and the typical scenarios, as well as the scenario weights.
[0088] A resource state matrix for a microgrid cluster is constructed, wherein the power generation capacity sub-matrix includes the corrected power generation capacity and the power surplus value, the energy storage regulation sub-matrix includes the corrected energy storage capacity, the maximum charging power, and the maximum discharging power, and the transferable load sub-matrix includes the corrected load demand and the energy deficit value; the power and capacity parameters in the resource state matrix are dynamically corrected based on the optimal matching scenario;
[0089] The energy complementarity and resource matching degree between any two microgrids are calculated based on the corrected resource state matrix. The energy complementarity is calculated by the inner product of the power surplus value and the energy deficit value, and the resource matching degree is calculated by the ratio of the power generation capacity submatrix to the energy storage regulation submatrix. The product of the energy complementarity, resource matching degree and the similarity of the optimal matching scenario is used as the energy mutual assistance feasibility index. Based on the energy mutual assistance feasibility index, energy mutual assistance opportunities of microgrid groups are identified.
[0090] For example, the corrected power generation is calculated by subtracting the upper bound of the confidence interval of the prediction deviation from the predicted power generation value output by the state prediction model, using a conservative estimate to ensure that the power generation meets actual demand. For instance, if the predicted photovoltaic power generation of a microgrid is 500 kW and the 95% confidence interval is [450 kW, 550 kW], then the corrected power generation is 450 kW. The corrected load demand is calculated by adding the upper bound of the confidence interval of the prediction deviation to the predicted electricity load value, ensuring that the maximum possible load demand is met. For instance, if the predicted electricity load of a microgrid is 800 kW and the 95% confidence interval is [760 kW, 840 kW], then the corrected load demand is 840 kW. The corrected energy storage capacity is determined based on the lower bound of the confidence interval of the predicted energy storage state value, ensuring the reliable execution of the energy storage dispatch scheme. For instance, if the predicted energy storage state value of a microgrid is 70% and the 95% confidence interval is [65%, 75%], then the corrected energy storage capacity is 65% multiplied by the rated capacity.
[0091] The power surplus is calculated by subtracting the corrected load demand from the corrected generation capacity. A positive value indicates a power surplus, which can be supplied to other microgrids; a negative value indicates a power shortage, requiring input from other microgrids. The power surplus is accumulated over 24 hours to obtain the energy surplus / deficit. For example, if a microgrid has a corrected generation capacity of 450 kW and a corrected load demand of 840 kW, then the power surplus is -390 kW, indicating a power deficit for the microgrid. After 24 hours of accumulation, the energy deficit is 9360 kWh.
[0092] Several typical scenarios were obtained by clustering historical operating data. Operating data from the most recent 30 days, including time-series data on power generation, load demand, and energy storage status, were selected and clustered using the K-means clustering algorithm, with 10 clusters formed. Each cluster center represents a typical scenario, describing the power distribution and energy storage status under a specific operating mode. The scenario weight is calculated based on the frequency of the scenario's occurrence in the historical data. For example, if a typical scenario occurs in 20% of the historical data, its scenario weight is 0.2.
[0093] A current state vector is constructed based on the adjusted power generation, adjusted load demand, and adjusted energy storage capacity. This vector has 72 dimensions: 24 hours × 3 states (power generation, load, and energy storage). For example, the first 24 dimensions of the current state vector represent the adjusted power generation over 24 hours, the middle 24 dimensions represent the adjusted load demand over 24 hours, and the last 24 dimensions represent the adjusted energy storage capacity over 24 hours.
[0094] The optimal matching scenario is determined based on the similarity between the current state vector and typical scenarios, and the scenario weights. The similarity is calculated by taking the cosine similarity between the current state vector and each typical scenario vector, with a value ranging from -1 to 1; a higher value indicates a higher similarity. The similarity is then multiplied by the scenario weight to obtain a comprehensive score, and the typical scenario with the highest score is selected as the optimal matching scenario. For example, if the similarity between the current state vector and a typical scenario is 0.85, and the scenario weight is 0.2, the comprehensive score is 0.17; if this score is the highest among all scenarios, then that scenario is the optimal matching scenario.
[0095] A resource state matrix for the microgrid cluster is constructed, comprising three sub-matrices: a generation capacity sub-matrix, an energy storage regulation sub-matrix, and a transferable load sub-matrix. The generation capacity sub-matrix includes corrected generation power and power surplus values, and its size is (number of microgrids × 24 hours × 2 states). The energy storage regulation sub-matrix includes corrected energy storage capacity, maximum charging power, and maximum discharging power, and its size is (number of microgrids × 24 hours × 3 states). The transferable load sub-matrix includes corrected load demand and energy deficit values, and its size is (number of microgrids × 24 hours × 2 states).
[0096] Assuming a microgrid group comprises 3 microgrids, the resource state matrix has a size of 3×24×7, where each microgrid has 7 state parameters at each time step. For example, for microgrid 1 at time step t=1, the state parameters include: corrected generation power 450 kW, power surplus -390 kW, corrected energy storage capacity 1300 kWh (65% of the rated capacity of 2000 kWh), maximum charging power 200 kW, maximum discharging power 300 kW, corrected load demand 840 kW, and energy deficit 9360 kWh.
[0097] Analyze the historical variation patterns of each parameter under the optimal matching scenario, extract the trends and patterns, and adjust the parameters in the current resource state matrix. For example, if the optimal matching scenario shows that the wind farm will typically experience power fluctuations and decreases in the next 6 hours, the corrected power generation of microgrid 1 can be further reduced by 10% during these 6 hours to further ensure the reliability of dispatch.
[0098] The energy complementarity and resource matching degree between any two microgrids are calculated based on the corrected resource state matrix. Energy complementarity is calculated by the inner product of the power surplus value and the energy deficit value, which involves multiplying corresponding elements of the two vectors and then summing the results. Specifically, the inner product is calculated by combining the 24-hour power surplus value vector of one microgrid with the 24-hour energy deficit value vector of the other microgrid. A positive inner product result indicates that the two microgrids are energy complementary; the larger the value, the stronger the complementarity. For example, if the power surplus value vector of microgrid 1 is [-390, -410, -380, ...] kW, and the energy deficit value vector of microgrid 2 is [-5000, -4800, -4600, ...] kWh, since both microgrids have energy deficits, the inner product result is positive, indicating that they are not complementary. The power surplus vector of microgrid 3 is [200, 220, 180, ...] kW. Its inner product with the energy deficit vector of microgrid 1 yields a positive value, indicating that microgrid 3 can provide energy support to microgrid 1. The resource matching degree is calculated as the ratio of the generation capacity submatrix to the energy storage regulation submatrix. Specifically, the ratio of the total power surplus of one microgrid to the energy storage regulation capacity of another microgrid is calculated to assess the matching degree of resource allocation between the two microgrids. For example, if the total power surplus of microgrid 3 is 4800 kWh and the energy storage regulation capacity of microgrid 1 is 700 kWh (maximum charging capacity), then the resource matching degree is 6.85, indicating that the surplus power of microgrid 3 is much greater than the energy storage regulation capacity of microgrid 1, and the two are not resource-matched.
[0099] The product of energy complementarity, resource matching degree, and the similarity of the optimal matching scenario is used as the energy mutual assistance feasibility index. Based on this index, energy mutual assistance opportunities within a microgrid cluster are identified. For example, if the energy complementarity between microgrid 3 and microgrid 1 is 0.8, the resource matching degree score is 0.3 (after normalization), and the similarity of the optimal matching scenario is 0.85, then the energy mutual assistance feasibility index is 0.8 × 0.3 × 0.85 = 0.204. If this index is higher than a preset threshold (e.g., 0.2), then a mutual assistance opportunity is identified where microgrid 3 provides energy support to microgrid 1.
[0100] The energy sharing feasibility indices of all microgrid pairs are ranked, and the pairs with the highest indices are selected as candidate energy sharing schemes and input into the subsequent optimization allocation stage. For example, if the energy sharing feasibility indices of microgrid 3 to microgrid 1, microgrid 3 to microgrid 2, and microgrid 2 to microgrid 1 are 0.204, 0.156, and 0.105 respectively, and the threshold is 0.15, then the energy sharing opportunity of microgrid 3 providing energy support to microgrid 1 is identified.
[0101] This scheme, through correcting the output of the state prediction model and combining historical typical scenario matching with dynamic correction of the resource state matrix, achieves accurate identification of energy mutual assistance opportunities in microgrid clusters. It comprehensively considers energy complementarity, resource matching degree, and historical scenario similarity, forming a feasibility assessment mechanism for energy mutual assistance with practical application value. Compared with traditional methods, this scheme can more effectively tap the energy complementarity potential within microgrid clusters, improve energy utilization efficiency, reduce system operating costs, and provide reliable decision support for subsequent optimized scheduling.
[0102] Optionally,
[0103] Based on the energy mutual aid opportunities and resource constraints identified by the resource state matrix, an adaptive game equilibrium algorithm is used to solve for the optimal energy allocation scheme. The steps of inputting the optimal allocation scheme into a reinforcement learning model, dynamically adjusting the allocation weights based on historical execution results, and outputting a final scheduling strategy considering execution reliability include:
[0104] The energy mutual assistance opportunity is used as the basis for selecting game participants. The mutual assistance weights among participants are calculated based on the energy mutual assistance feasibility index. A utility function containing mutual assistance benefit, operating cost, and load deviation is constructed. The product of the mutual assistance weight and the calculation result of the utility function is used as the weighted utility value.
[0105] Establish game constraints, including mutual capacity constraints and matching degree constraints. The mutual capacity constraints are determined based on the power surplus value and energy gap value, and the matching degree constraints are determined based on the resource matching degree. The Nash bargaining solution method is used to calculate the game equilibrium solution, and the energy optimization allocation scheme is obtained by maximizing the product of the difference between the weighted utility value and the retention utility value.
[0106] Construct a state vector containing power generation, load demand, energy storage capacity, and mutual assistance power, and an action vector containing mutual assistance power adjustment and energy storage adjustment; design a reward function, which includes an economic benefit term, a reliability index term, and an execution deviation term; use the energy optimization allocation scheme as the initial strategy for reinforcement learning, and train a reinforcement learning model based on the state vector, action vector, and reward function;
[0107] The execution success rate and actual execution deviation of historical scheduling schemes are statistically analyzed, and an execution reliability index is calculated based on the execution success rate and the actual execution deviation. The execution reliability index is combined with the Q-value update result to generate allocation weights, and the energy optimization allocation scheme is adjusted using the allocation weights to output the final scheduling strategy.
[0108] For example, for each identified pair of microgrids with mutual assistance opportunities, a mutual assistance weight is assigned based on their energy mutual assistance feasibility index. The mutual assistance weight is obtained by normalizing the energy mutual assistance feasibility index, ensuring that the sum of the weights of all mutual assistance pairs is 1. For instance, if three pairs of mutual assistance opportunities are identified in a microgrid group, with energy mutual assistance feasibility indices of 0.204, 0.156, and 0.105 respectively, then the normalized mutual assistance weights are 0.438, 0.335, and 0.227 respectively. A higher mutual assistance weight indicates a higher priority for the mutual assistance pair in subsequent allocation.
[0109] The utility function is constructed, with the mutual benefit term referring to the economic benefit obtained through energy mutual benefit, calculated as the mutually benefited power multiplied by the electricity price difference. For example, if microgrid 3 provides 200 kW of power to microgrid 1, and microgrid 3 sells electricity at 0.4 yuan / kWh while microgrid 1 purchases electricity at 0.6 yuan / kWh, then the mutual benefit is 0.2 yuan / kWh × 200 kW = 40 yuan / hour. The operating cost term includes generation cost and energy storage loss cost. Taking microgrid 3 as an example, if the marginal cost of generating an additional 200 kW is 0.3 yuan / kWh, then the generation cost is 60 yuan / hour. If the energy storage charge / discharge efficiency is 90% and the stored energy is 100 kWh, then the energy storage loss cost is 10 kWh × 0.4 yuan / kWh = 4 yuan / hour. The load deviation term is a measure of the degree of load satisfaction after mutual benefit, calculated as the negative sum of the squares of the differences between the actual load and the expected load. For example, if the load deficit of microgrid 1 is 390 kW before mutual assistance and the deficit is reduced to 190 kW after mutual assistance, the load deviation is improved to 200 kW, which is included in the utility function.
[0110] The product of the mutual assistance weight and the calculated result of the utility function is used as the weighted utility value. For example, the mutual assistance weight from microgrid 3 to microgrid 1 is 0.438, and the calculated utility function result is 76 yuan / hour (mutual assistance benefit of 40 yuan / hour minus operating cost of 60 yuan / hour, plus the equivalent value of load deviation improvement of 96 yuan / hour). Then the weighted utility value is 0.438 × 76 = 33.29 yuan / hour.
[0111] Game-theoretic constraints are established. The mutual assistance capacity constraint is determined based on the power surplus and energy deficit values, ensuring that the mutual assistance power does not exceed the power surplus of the source microgrid, nor does it exceed the load deficit and receiving capacity of the target microgrid. For example, if microgrid 3 has a power surplus of 200 kW, microgrid 1 has a load deficit of 390 kW, and the power transmission line capacity is 250 kW, then the mutual assistance power constraint is 0 ≤ mutual assistance power ≤ 200 kW. The matching degree constraint is determined based on the resource matching degree, ensuring that the resource matching between the two parties in the mutual assistance is reasonable. For example, if the resource matching degree between microgrid 3 and microgrid 1 is 0.3 (after normalization), and a matching degree threshold of 0.2 is set, then the matching degree constraint is satisfied.
[0112] The Nash bargaining method is used to calculate the game equilibrium solution. The optimal energy allocation scheme is obtained by maximizing the product of the weighted utility value and the difference in retention utility. Retention utility refers to the basic utility of each microgrid when not participating in mutual assistance, and is generally set to 0. In specific implementation, the gradient ascent method is used to solve for the optimal mutual assistance power. The initial mutual assistance power is set to 0, the learning rate is set to 0.01, and the number of iterations is 100. In each iteration, the gradient of the objective function is calculated, and the mutual assistance power is updated along the gradient direction. The objective function is the product of the weighted utility and the difference in retention utility of all participating microgrids, i.e., (U1-d1)×(U2-d2), where U1 and U2 are the weighted utilities of microgrid 1 and microgrid 3, and d1 and d2 are their retention utilities. This product form ensures Pareto optimality of the benefits of each party, meaning that it is impossible to increase the benefit of one party without harming the benefit of another. For example, after solving the problem, the optimal mutual power from microgrid 3 to microgrid 1 is 180 kilowatts, which means that microgrid 3 will provide an average of 180 kilowatts of power to microgrid 1 per hour over the next 24 hours.
[0113] The state vector dimension is the number of microgrids × (3 + number of microgrids - 1), describing the current state of the microgrid group. For example, for 3 microgrids, the state vector dimension is 3 × 5 = 15, including the generation capacity, load demand, energy storage capacity, and mutual power adjustment with the other two microgrids for each microgrid. The action vector dimension is the number of microgrids × (number of microgrids - 1 + 1), describing the executable adjustment operations. For example, for 3 microgrids, the action vector dimension is 3 × 3 = 9, including the mutual power adjustment amount of each microgrid to other microgrids and its own energy storage adjustment amount.
[0114] The reward function is designed such that the calculation method for the economic benefit term is similar to that for the mutual benefit term in the utility function; the reliability index term measures the probability of successful execution of the scheduling strategy, obtained through statistical analysis of historical execution data; the execution deviation term is the penalty for the difference between the actual execution result and the expected goal, with a larger difference resulting in a larger penalty. For example, if the economic benefit of a scheduling strategy is 100 yuan / hour, the reliability index is 0.9, and the execution deviation is 20 kilowatts, then the reward value can be calculated as 100 × 0.9 - 20 × 0.5 = 85 yuan / hour (assuming the penalty coefficient for execution deviation is 0.5).
[0115] An energy optimization allocation scheme was used as the initial strategy for reinforcement learning, and a reinforcement learning model was trained based on state vectors, action vectors, and a reward function. A Deep Q-Network (DQN) was employed for reinforcement learning, consisting of four layers: the input layer dimension was the same as the state vector, the two hidden layers had 128 and 64 neurons respectively, and the output layer dimension was the same as the action space. Each hidden layer used a ReLU activation function, while the output layer had no activation function to directly predict the Q-value. In the training parameter settings, the discount factor was set to 0.95 to balance the importance of immediate and future rewards; the learning rate was set to 0.001 to control the network parameter update speed and ensure convergence stability; the experience replay buffer size was 10000 to store historical experience of the agent's interaction with the environment and to decipher the correlation between samples; the target network update frequency was 100 steps, and the training process was stabilized by delaying the update of the target network parameters; the training epochs were 1000 to ensure that the model fully learned the dynamic characteristics of the environment. The initial policy is generated from the game equilibrium solution. Through supervised learning, the knowledge of the game equilibrium solution is transformed into the network's initial parameters. For example, the decision of microgrid 3 to provide 180 kW of power to microgrid 1 is used as the initial behavioral preference, assigning a high initial Q-value estimate in the corresponding state. During training, an ε-greedy strategy is used to balance exploration and exploitation. The ε value gradually decreases linearly from an initial 0.3 to 0.05, ensuring sufficient exploration of the environment in the early stages and greater utilization of learned knowledge in the later stages. In each environmental interaction step, the agent observes the current state, selects an action, receives a reward, and observes the next state, storing this transition sample in the experience replay buffer. Each training batch randomly samples 64 samples from the experience buffer, calculates the target Q-value, and updates the network parameters by minimizing the temporal difference error. This method, combining prior knowledge of the game equilibrium solution with the adaptive capabilities of reinforcement learning, ensures that the final policy maintains theoretical optimality while adapting to various constraints and uncertainties in the actual execution environment.
[0116] The execution success rate refers to the proportion of times a scheduling strategy is successfully executed out of the total number of scheduling operations. For example, if the mutual assistance between microgrid 3 and microgrid 1 was successfully executed 92 times in the past 100 scheduling operations, the execution success rate is 0.92. The actual execution deviation is the root mean square of the difference between the actual mutual assistance power and the planned mutual assistance power. For example, if the planned mutual assistance power is 180 kW and the actual average mutual assistance power is 165 kW, the execution deviation is 15 kW. The execution reliability index is calculated by subtracting the normalized execution deviation from the execution success rate. For example, if the maximum allowable execution deviation is 50 kW, the normalized execution deviation is 15 / 50 = 0.3, and the execution reliability index is 0.92 - 0.3 = 0.62.
[0117] The allocation weights are generated by combining the execution reliability index with the Q-value update results. These weights are then used to adjust the energy optimization allocation scheme, outputting the final scheduling strategy. The allocation weights are calculated by weighting the execution reliability index and the normalized Q-value, with weight coefficients of 0.4 and 0.6, respectively. For example, if the execution reliability index of a certain scheduling action is 0.62 and the normalized Q-value is 0.8, then the allocation weight is 0.4 × 0.62 + 0.6 × 0.8 = 0.728. The final scheduling strategy is obtained by multiplying the original allocation scheme by the allocation weights. For example, if the original game equilibrium solution plans for microgrid 3 to provide 180 kW of power to microgrid 1, considering the allocation weight of 0.728, the final scheduling strategy is adjusted to 131 kW, thus reducing the mutual power supply to improve execution reliability.
[0118] This scheme achieves a dynamic decision-making process for the optimal energy allocation of microgrid groups by combining an adaptive game equilibrium algorithm and reinforcement learning. The game equilibrium algorithm ensures the balance of interests among the microgrids, while reinforcement learning improves the reliability and adaptability of the strategy through historical execution data. It comprehensively considers economic benefits, system constraints, and execution reliability, overcomes the shortcomings of traditional methods that ignore strategy execution deviations, and improves the practicality and robustness of collaborative optimal scheduling of microgrid groups.
[0119] Optionally,
[0120] The steps of using the energy optimization allocation scheme as the initial policy for reinforcement learning and training a reinforcement learning model based on the state vector, action vector, and reward function include:
[0121] A multi-dimensional state space is constructed, and the mutual power, energy storage state, and load allocation in the energy optimization allocation scheme are combined with the power change rate, energy storage change rate, and historical execution characteristics to form a time-series state vector; the time-series state vector is standardized to obtain a normalized state vector.
[0122] A hierarchical action space is constructed, with the mutual power adjustment amount and adjustment time window forming the main action space, and the energy storage adjustment amount and compensation coefficient forming the auxiliary action space; based on the main action space and the auxiliary action space, action constraints are constructed, and the action constraints are mapped to the feasible action space.
[0123] A dual experience pool is constructed: the state-action sequence corresponding to the energy optimization allocation scheme is stored in the game equilibrium solution experience pool, and the state-action sequence with a historical execution success rate greater than a preset success rate threshold is stored in the historical execution experience pool; a combined loss function is calculated based on the game equilibrium solution experience pool and the historical execution experience pool.
[0124] An embedded network structure is adopted. The game layer parameters are updated based on the game equilibrium loss, and the update magnitude is inversely proportional to the action deviation. The execution layer parameters are updated based on the execution deviation loss, and the update magnitude is directly proportional to the action deviation. In the initial training stage, the game equilibrium features are learned by using fixed sampling parameters. In the training transition stage, the sampling parameters are adjusted according to the cosine law to gradually introduce execution experience. In the training stabilization stage, a dual learning strategy with a fixed ratio is adopted.
[0125] For example, for each microgrid in a microgrid cluster, its mutual power, energy storage status, and load allocation data for the current moment and the previous 24 hours are extracted. The power change rate (power change between adjacent moments divided by the time interval) and energy storage change rate (energy storage capacity change between adjacent moments divided by the time interval) are calculated. Simultaneously, historical execution characteristics are extracted, including the execution success rate and average execution deviation of the past 10 scheduling operations. These characteristics are then combined in chronological order into a time-series state vector. For instance, for a system with three microgrids, each microgrid has five basic characteristics (mutual power, energy storage status, load allocation, power change rate, and energy storage change rate) and two historical execution characteristics at each moment. Considering the current moment and the previous 24 hours, the dimension of the time-series state vector is 3 × (5 + 2) × 25 = 525.
[0126] The time-series state vector is standardized to obtain a normalized state vector. The standardization process uses a maximum-minimum normalization method, mapping each feature value to the interval [0, 1]. For example, if the historical range of mutual aid power is [-200 kW, 200 kW], and the current value is 150 kW, then the normalized value is (150 - (-200)) / (200 - (-200)) = 0.875. For energy storage status, its range is [0, 1], representing the current proportion of stored energy to rated capacity, requiring no additional normalization. For historical execution features, such as the execution success rate, which is already within the [0, 1] interval, no additional normalization is needed. Through standardization, it is ensured that features with different dimensions can be compared and calculated on the same scale.
[0127] A hierarchical action space is constructed. In the main action space, the mutual assistance power adjustment ranges from -50 kW to 50 kW, discretely represented by 11 values: {-50, -40, -30, -20, -10, 0, 10, 20, 30, 40, 50}. The adjustment time window ranges from {1 hour, 2 hours, 4 hours, 6 hours}, representing the duration of the adjustment. In the auxiliary action space, the energy storage regulation ranges from -30 kW to 30 kW, discretely represented by 7 values: {-30, -20, -10, 0, 10, 20, 30}. The compensation coefficient ranges from {0.2, 0.5, 0.8, 1.0}, representing the compensation ratio of energy storage to the mutual assistance power adjustment. For example, if the mutual assistance power adjustment is a reduction of 20 kW with a compensation coefficient of 0.5, then energy storage needs to compensate 10 kW.
[0128] Action constraints are constructed based on the main action space and auxiliary action space. These constraints include: the adjusted mutual assistance power should not exceed the line capacity limit; the adjusted energy storage capacity should not exceed the upper and lower limits; and the adjusted energy balance should meet the load demand. These constraints are implemented using a mask matrix. Actions that do not meet the constraints have their Q-value set to negative infinity to ensure they are excluded during strategy selection. For example, if a microgrid's current energy storage capacity is 90%, and the energy storage adjustment is 20 kW, it will cause the energy storage capacity to exceed 100%, violating the constraints, and this action will be marked as infeasible. The feasible action space is a subset of actions that satisfy all constraints; actions can only be selected from this subset.
[0129] A dual experience pool is constructed. The state-action sequences corresponding to energy optimization allocation schemes are stored in the game equilibrium solution experience pool, while state-action sequences with a historical execution success rate greater than a preset success rate threshold are stored in the historical execution experience pool. The game equilibrium solution experience pool has a capacity of 10,000 and stores the scheduling strategies generated by the game equilibrium algorithm and their execution results. For example, the decision for microgrid 3 to provide 180 kW of power to microgrid 1 at a certain moment, along with its corresponding state vector and reward value, is stored as an experience in the game equilibrium solution experience pool. The historical execution experience pool also has a capacity of 10,000 and stores scheduling strategies with a historical execution success rate exceeding 0.85. For example, if a strategy has a success rate of 0.92 in past executions, which is higher than the threshold of 0.85, its corresponding state, action, and reward triplet is stored in the historical execution experience pool.
[0130] The combined loss function comprises two parts: game equilibrium loss and execution bias loss. Game equilibrium loss measures the deviation of the current strategy from the game equilibrium solution, calculated as the squared difference between the predicted Q-value and the Q-value of the game equilibrium solution. For example, for a given state, if the current strategy predicts a Q-value of 85 for a certain action, while the game equilibrium solution's Q-value is 90, then the game equilibrium loss for that sample is 25. This loss ensures that the learned strategy does not deviate excessively from the theoretically optimal game equilibrium solution, maintaining economic efficiency. Execution bias loss measures the deviation of the current strategy from historically successful execution strategies, calculated as the squared difference between the predicted Q-value and the historically executed Q-value. For example, for the same state, if the current strategy predicts a Q-value of 85, while the historically successful execution's Q-value is 80, then the execution bias loss is 25. This loss ensures that the learned strategy can effectively learn from historical successful execution experience, improving the reliability of actual execution. The combined loss function achieves comprehensive optimization through a weighted sum of these two losses, with the weights dynamically adjusted according to the training phase. In the initial training phase, the game equilibrium loss has a high weight, ensuring the model first learns the economically optimal strategy. During the transition phase, the weights smoothly transition according to a cosine law, gradually incorporating execution experience. In the stable training phase, the final weight allocation is determined based on the ratio of fitting indices, achieving dynamic equilibrium. The core role of the combined loss function is to guide the model to simultaneously learn the economics of the game equilibrium strategy and the reliability of historically successful execution strategies, providing a balanced gradient direction during model parameter updates. In this way, the reinforcement learning model can avoid performance degradation caused by overfitting to a single objective, finding the optimal balance between economic efficiency and execution reliability, and generating scheduling strategies that both conform to game equilibrium principles and have a high execution success rate.
[0131] An embedded network structure is adopted. Game layer parameters are updated based on game equilibrium loss, with the update magnitude inversely proportional to the action deviation. Execution layer parameters are updated based on execution deviation loss, with the update magnitude directly proportional to the action deviation. The embedded network includes a shared feature extraction layer and two parallel output layers: a game layer and an execution layer. The feature extraction layer consists of three fully connected layers with 256, 128, and 64 nodes, respectively, using ReLU activation. The game layer and execution layer each contain two fully connected layers with 32 nodes and an action space dimension, respectively, using linear activation functions. An action deviation adjustment factor is introduced when updating game layer parameters. Action deviation is defined as the normalized distance between the current action and the game equilibrium solution action, ranging from [0, 1]. The update magnitude is inversely proportional to the action deviation; that is, the larger the deviation, the smaller the update magnitude. This is achieved by using the reciprocal of the deviation as a weighting factor. For example, when the deviation is 0.2, the weighting factor is 1 / 0.2 = 5; when the deviation is 0.8, the weighting factor is 1 / 0.8 = 1.25. This mechanism ensures more cautious updates when the game equilibrium solution is significantly deviated from. When updating the execution layer parameters, the update magnitude is proportional to the action deviation, implemented using the deviation as a weighting factor. For example, when the deviation is 0.2, the weighting factor is 0.2; when the deviation is 0.8, the weighting factor is 0.8. This mechanism ensures more proactive learning from past successful execution strategies.
[0132] In the initial training phase, fixed sampling parameters are used to learn the game equilibrium characteristics. This phase primarily allows the model to learn the properties of the game equilibrium solution, ensuring the economy of the strategy. In the transitional training phase, the sampling parameters are adjusted according to the cosine law. This phase gradually introduces execution experience, balancing economy and reliability. In the stable training phase, a dual learning strategy with a fixed ratio is employed to ensure that the strategy possesses both economy and reliability.
[0133] Figure 2To compare the execution deviations of different scheduling strategies in actual microgrid clusters, the horizontal axis represents different microgrid cluster operating scenarios, including five typical scenarios: photovoltaic fluctuations, load surges, communication delays, energy storage constraints, and line congestion. The vertical axis represents the percentage of execution deviation, ranging from 0% to 20%. The lower the value, the closer the actual execution effect is to the scheduling command, and the better the performance. As can be seen from the figure, the present invention exhibits the lowest execution deviation in all operating scenarios, with a deviation of only 5.8% in the communication delay scenario, 7.5% in the load surge scenario, 8.2% in the photovoltaic fluctuation scenario, 6.9% in the energy storage constraints scenario, and 7.2% in the line congestion scenario. In contrast, the execution deviation of traditional reinforcement learning methods is significantly higher. The performance of the distributed optimization method falls between the two, with execution deviations of 12.3%, 14.7%, 13.5%, 16.8%, and 15.4% in each scenario, respectively. This indicates that the dual experience pool and embedded network structure adopted in this invention significantly improve the reliability and robustness of the scheduling strategy. In particular, it has obvious advantages over traditional methods when facing complex scenarios such as communication delays and limited energy storage, reducing the average execution deviation by about 60% and providing more reliable technical support for the energy optimization allocation of microgrid groups.
[0134] This scheme constructs a multi-dimensional state space and a hierarchical action space, combining a dual experience pool and an embedded network structure to achieve effective fusion learning of game equilibrium solutions and historical execution experience. This method not only inherits the economic advantages of game equilibrium solutions but also improves the reliability and adaptability of the scheduling strategy through historical execution experience. The dynamically adjusted training strategy ensures the stability and efficiency of the learning process, while the embedded network structure achieves synergistic optimization of economy and reliability. Compared with traditional methods, this scheme significantly improves the execution reliability and practicality of energy optimization allocation in microgrid clusters while maintaining economic benefits.
[0135] Optionally,
[0136] The steps of learning game equilibrium features using fixed sampling parameters in the initial training phase, gradually introducing execution experience by adjusting the sampling parameters according to the cosine law in the transition training phase, and employing a fixed-proportion dual learning strategy in the stable training phase include:
[0137] The root mean square deviation of the Q-values of the samples in the game equilibrium solution experience pool is calculated as the game equilibrium metric. When the game equilibrium metric meets the preset conditions, the training initial stage is entered, and training data is sampled from the two experience pools at a fixed ratio.
[0138] The rate of change of the parameter update amplitude is used as a training stability index. When the training stability index and the game equilibrium measurement index simultaneously meet the preset conditions, the training transition phase is entered. The sampling weight adjustment coefficient is calculated based on the training round. The sampling weight adjustment coefficient gradually transitions from the initial weight to the target weight according to the cosine decreasing law with the training round.
[0139] The exponential moving average of the prediction error of historical execution samples is calculated as the execution fit index; when the execution fit index and the training stability index simultaneously meet the preset conditions, the training stability phase is entered, and the fixed sampling ratio of dual learning is determined according to the ratio of the game equilibrium metric index and the execution fit index.
[0140] The game equilibrium metric, the training stability metric, and the execution fitting metric are monitored in real time. When any metric exceeds the corresponding threshold, the training phase is rolled back to the previous phase. The corresponding preset threshold is dynamically adjusted based on the difference between the metrics before and after the rollback.
[0141] For example, 100 samples are randomly selected from the experience pool of game equilibrium solutions. The currently trained reinforcement learning model is used to predict the Q-values of these sample states, and the difference between the predicted Q-value and the Q-value of the game equilibrium solution is calculated. The squares of all the differences are squared, the average is calculated, and the square root is taken to obtain the root mean square deviation of the Q-value. For instance, in the 100 samples, the predicted Q-value of the first sample is 85, the game equilibrium Q-value is 90, and the difference is -5; the predicted Q-value of the second sample is 78, the game equilibrium Q-value is 80, and the difference is -2; and so on. The sum of the squares of all the differences is calculated, divided by the number of samples, and the square root is taken to obtain the root mean square deviation of the Q-value, which is 4.3.
[0142] The training begins when the game equilibrium metric meets preset conditions. These conditions include a root mean square deviation of Q-value greater than an initial threshold of 10.0, indicating a significant gap between the model and the game equilibrium solution, necessitating priority learning of game equilibrium features. During the initial training phase, a fixed sampling ratio is used: 0.9 probabilities for sampling from the game equilibrium solution experience pool and 0.1 probabilities for sampling from the historical execution experience pool. Each training batch size is set to 64, meaning 57 samples are sampled from the game equilibrium solution experience pool and 7 samples are sampled from the historical execution experience pool each time.
[0143] The rate of change of parameter update magnitude is calculated as a training stability metric. Parameter update magnitude is defined as the average change in network parameters after each backpropagation, while the rate of change is defined as the percentage change in parameter update magnitude over 100 consecutive training batches. The absolute changes in all network parameters after each training iteration are recorded, and the average is calculated as the parameter update magnitude for the current batch. For example, if the parameter update magnitude is 0.0025 on the 500th training iteration and 0.0020 on the 600th, then the rate of change of parameter update magnitude is (0.0020 - 0.0025) / 0.0025 = -0.2, indicating that the parameter update magnitude decreased by 20%.
[0144] When both the training stability metric and the game equilibrium metric meet preset conditions, the training transition phase begins. These preset conditions are: the absolute value of the rate of change of parameter update amplitude is less than 0.1, indicating that training is stabilizing; and the root mean square deviation of the Q-value is less than the transition threshold of 5.0, indicating that the model has initially grasped the game equilibrium characteristics. During the training transition phase, the sampling weight adjustment coefficient is calculated using a cosine function to smoothly transition the sampling probability of the game equilibrium solution experience pool from 0.9 to 0.5, and the sampling probability of the historical execution experience pool from 0.1 to 0.5.
[0145] For example, if the total number of training transition phases is 4000 and the number of training transition phases currently performed is t, then the sampling weight adjustment coefficient is 0.5 + 0.4 × cosine value (t × π ÷ 4000). For example, when t = 1000, the cosine value is 0.7071, and the sampling weight adjustment coefficient is 0.5 + 0.4 × 0.7071 = 0.7828. Therefore, the sampling probability of the game equilibrium solution experience pool is 0.7828, and the sampling probability of the historical execution experience pool is 0.2172. When t = 2000, the cosine value is 0, and the sampling weight adjustment coefficient is 0.5. Therefore, the sampling probability of both experience pools is 0.5. When t = 3000, the cosine value is -0.7071, and the sampling weight adjustment coefficient is 0.5 + 0.4 × (-0.7071) = 0.2172. Therefore, the sampling probability of the game equilibrium solution experience pool is 0.2172, and the sampling probability of the historical execution experience pool is 0.7828.
[0146] The exponential moving average of the prediction error of historical execution samples is calculated as the execution fit index. 100 samples are randomly selected from the historical execution experience pool, and the Q-value of the state of these samples is predicted using the currently trained reinforcement learning model. The absolute value of the difference between the predicted Q-value and the historical execution Q-value is calculated. An exponential moving average is calculated for these absolute differences, with a smoothing coefficient set to 0.1. For example, if the previously calculated execution fit index was 3.8, and the average absolute difference of the currently selected samples is 3.2, then the updated execution fit index is 3.8 × (1 - 0.1) + 3.2 × 0.1 = 3.74.
[0147] The training stabilizes when both the performance fit metric and the training stability metric meet preset conditions. These preset conditions are: the performance fit metric is less than a stability threshold of 3.0, indicating the model has well-fitted historical performance experience; and the absolute value of the rate of change of parameter update amplitude is less than 0.05, indicating very stable training. During the training stabilizes phase, the final fixed sampling ratio is determined based on the ratio of the game equilibrium metric to the performance fit metric.
[0148] The ratio r is calculated as follows: R = Game Equilibrium Metric ÷ Performance Fit Metric. For example, if the current Game Equilibrium Metric is 2.5 and the performance fit metric is 2.8, then r = 2.5 ÷ 2.8 = 0.893. The fixed sampling ratio is adjusted based on the value of r: If r > 1.2, it indicates a poor fit of the model to the game equilibrium features, so the sampling probability of the game equilibrium solution experience pool is set to 0.7, and the sampling probability of the historical performance experience pool is set to 0.3; if 0.8 ≤ r ≤ 1.2, it indicates a close fit between the two features, so the sampling probability of both experience pools is set to 0.5; if r < 0.8, it indicates a poor fit of the model to the historical performance features, so the sampling probability of the game equilibrium solution experience pool is set to 0.3, and the sampling probability of the historical performance experience pool is set to 0.7. In the example above, r = 0.893, which falls under the second case, therefore the fixed sampling ratio is 0.5 for each.
[0149] The system monitors game equilibrium metrics, training stability metrics, and execution fit metrics in real time. These three metrics are calculated every 100 training batches and compared to the thresholds for each stage. For example, during the training stability stage, if the game equilibrium metric suddenly increases to 6.0, exceeding the transition threshold of 5.0, it indicates a decline in the model's fit to the game equilibrium features. In this case, the training stage is rolled back to the transition stage, and the sampling ratio is readjusted. The corresponding preset thresholds are dynamically adjusted based on the difference in metrics before and after the rollback. The magnitude of the change in metrics before and after the rollback is calculated, and the thresholds are fine-tuned based on the magnitude of the change. For example, if the game equilibrium metric was 6.0 before the rollback and decreased to 4.2 after 1000 training rounds, the magnitude of the change is (6.0-4.2)÷6.0=0.3, indicating a 30% improvement. Based on this, the transition threshold is adjusted from 5.0 to 5.0×(1+0.3×0.2)=5.3, increasing the tolerance by 6% and improving the algorithm's robustness. Similarly, the thresholds for training stability metrics and execution fit metrics are also dynamically adjusted.
[0150] This scheme achieves fine-grained, phased control of the reinforcement learning training process by introducing game equilibrium metrics, training stability metrics, and execution fit metrics. The initial phase focuses on economical learning, the transition phase smoothly integrates execution experience, and the stable phase dynamically balances the two learning objectives, forming a complete progressive learning framework. It effectively solves the contradiction between game equilibrium solutions and actual execution experience, avoids overfitting caused by a single learning objective, and improves training efficiency and model generalization ability.
[0151] Optionally,
[0152] According to the final scheduling strategy, the steps for generating control commands for each microgrid using a hierarchical consensus mechanism include:
[0153] A power setting value is generated based on the final scheduling strategy; the response time requirement is calculated based on the difference between the power setting value and the current power; and the execution priority is determined based on the adjustment amplitude of the power setting value.
[0154] A power consistency constraint is established based on the power setpoint, which requires that the power setpoint deviation between adjacent microgrids within the consensus subnet be less than a preset power deviation threshold; a timing coordination constraint is established based on the response time requirement, which ensures that the instruction execution time of adjacent microgrids meets the communication delay requirement; and control instructions for the microgrid group are deployed hierarchically based on the execution priority.
[0155] A time-varying adjacency matrix is constructed by obtaining the connection status between microgrids, and a link weight matrix is constructed based on a comprehensive evaluation of link delay and bandwidth; the communication path with minimal delay is calculated according to the time-varying adjacency matrix and the link weight matrix.
[0156] A comprehensive evaluation index is obtained by calculating the reciprocal of link delay, bandwidth utilization, and link reliability. The link state transition probability is updated based on the difference between the comprehensive evaluation index and the average link quality. The communication path is optimized based on the link state transition probability, and the control commands are transmitted to each microgrid according to the optimized communication path. Command execution data of each microgrid is collected in real time. When the execution deviation exceeds a preset deviation threshold, the execution data is input into the state prediction model for online learning to dynamically optimize the execution parameters of the scheduling strategy.
[0157] For example, the mutual assistance power in the final dispatch strategy is used as the power setpoint. For each microgrid in the microgrid group, the difference between its power setpoint and the current actual power is calculated. For instance, if microgrid 1's current actual output power is 120 kW and the power setpoint in the final dispatch strategy is 180 kW, then the power difference is 60 kW. The response time requirement is determined based on the magnitude of the power difference; the larger the difference, the longer the response time requirement. The response time requirement is determined using a piecewise function: 5 seconds for a power difference between 0-20 kW; 10 seconds for 20-50 kW; 20 seconds for 50-100 kW; and 30 seconds for over 100 kW. In the example above, the power difference is 60 kW, and the response time requirement is 20 seconds.
[0158] Execution priority is determined based on the adjustment amplitude of the power setpoint. The adjustment amplitude is defined as the percentage of the difference between the power setpoint and the current power relative to the current power. For example, if the current power of microgrid 1 is 120 kW and the power setpoint is 180 kW, the adjustment amplitude is (180-120) / 120 = 50%. Execution priority is determined by the magnitude of the adjustment amplitude; the smaller the adjustment amplitude, the higher the execution priority. Specifically, the priorities are: adjustment amplitude less than 10% is the highest priority (Level 1); 10-30% is high priority (Level 2); 30-50% is medium priority (Level 3); and greater than 50% is low priority (Level 4). In the example above, the adjustment amplitude is 50%, and the execution priority is Level 3 (medium priority).
[0159] Power consistency constraints are established based on power setpoints. These constraints require that the power setpoint deviation between adjacent microgrids within a consensus subgrid be less than a preset power deviation threshold. A consensus subgrid refers to a collection of directly connected microgrids within a microgrid group. The power deviation threshold is determined based on the microgrid's capacity, typically set at 5% of its rated capacity. For example, microgrid 1 and microgrid 2 belong to the same consensus subgrid, both with a rated capacity of 500 kW, and a power deviation threshold of 25 kW. If the power setpoint of microgrid 1 is 180 kW and that of microgrid 2 is 150 kW, the power deviation is 30 kW, exceeding the 25 kW threshold and failing to meet the power consistency constraint, requiring adjustment. The adjustment method involves distributing the deviation according to the capacity ratio of the two microgrids. For instance, if their capacities are the same, the deviation is distributed evenly. After adjustment, the power setpoint of both microgrid 1 and microgrid 2 is 165 kW.
[0160] Timing coordination constraints are established based on response time requirements to ensure that the command execution time of adjacent microgrids meets the communication delay requirements. Communication delay refers to the time required for a control command to be transmitted from one microgrid to another, and it is related to network conditions. For example, if the communication delay between microgrid 1 and microgrid 2 is 2 seconds, the response time requirement for microgrid 1 is 20 seconds, and the response time requirement for microgrid 2 is 10 seconds, then to ensure consistency, the command execution time of microgrid 1 should be at least 2 seconds later than that of microgrid 2. That is, the command execution time of microgrid 1 is set as the command execution time of microgrid 2 plus the communication delay, which is 12 seconds. If the original response time requirement of microgrid 1 (20 seconds) is greater than the calculated result (12 seconds), the original value is maintained; otherwise, the calculated result is used as the new response time requirement.
[0161] Control commands for the microgrid cluster are deployed hierarchically based on execution priority, with higher-priority commands sent first and lower-priority commands sent later. Specifically, four command queues are set up, each corresponding to one of the four priority levels. All microgrid control commands are placed into the appropriate queue according to priority, with commands in the higher-priority queue being processed first. For example, if there are 10 control commands at a given time, with 2 at priority level 1, 3 at priority level 2, 4 at priority level 3, and 1 at priority level 4, these commands are processed sequentially in the order of priority level 1, 2, 3, and 4. Commands within the same priority level are processed in ascending order of response time requirements.
[0162] The time-varying adjacency matrix describes the connectivity between microgrids, with a value of 1 indicating a direct connection and 0 indicating no connection. The link weight matrix describes the quality of the connections; a smaller weight value indicates better link quality. Link weights are calculated as a weighted combination of link delay and bandwidth, with delay weighted at 0.7 and bandwidth weighted at 0.3. For example, if the link delay between microgrid 1 and microgrid 2 is 2 seconds and the bandwidth utilization is 40% (with a bandwidth margin of 60%), then the link weight is 0.7 × 2 + 0.3 × (1 - 0.6) = 1.52. Similarly, the link weights between all directly connected microgrids are calculated to form the link weight matrix.
[0163] The communication path with minimal delay is calculated based on the time-varying adjacency matrix and link weight matrix. Dijkstra's algorithm is used to calculate the shortest path between any two microgrids, with the link weights serving as the path cost. For example, the shortest path from microgrid 1 to microgrid 4 is calculated as follows: First, identify all neighboring microgrids of microgrid 1 (assume microgrids 2 and 3), and calculate the link weights from microgrid 1 to these neighboring microgrids (assume they are 1.52 and 2.05, respectively). Then, identify the neighboring microgrids of these neighboring microgrids (assume microgrids 3 and 4 are the neighboring microgrids of microgrid 2, and microgrid 4 is the neighboring microgrid of microgrid 3), and calculate the cumulative link weights. This process is iterated until the shortest path from microgrid 1 to microgrid 4 is found. Assuming the calculated total weight of the path from microgrid 1 to microgrid 2 to microgrid 4 is 3.71, and the total weight of the path from microgrid 1 to microgrid 3 to microgrid 4 is 4.23, the former is selected as the optimal communication path.
[0164] A comprehensive evaluation index is obtained by calculating the reciprocal of link delay, bandwidth utilization, and link reliability. The reciprocal of link delay represents the link response speed, and a higher value is better. Bandwidth utilization represents the link load, and a lower value is better. Link reliability is quantified by the historical communication success rate, calculated by dividing the number of successful transmissions in the past 100 communications by the total number of transmissions, with a value ranging from 0 to 1; a higher value indicates a more stable and reliable link. The comprehensive evaluation index is calculated by weighting these three factors, with weights of 0.4, 0.3, and 0.3, respectively. For example, if a link has a delay of 2 seconds (reciprocal of delay is 0.5), a bandwidth utilization of 40%, and a link reliability of 0.95, then the comprehensive evaluation index is 0.4 × 0.5 + 0.3 × (1 - 0.4) + 0.3 × 0.95 = 0.485. The comprehensive evaluation index for all links is calculated to obtain the average value, for example, 0.42. The link state transition probability is updated based on the difference between the comprehensive evaluation index of each link and the average value. If the overall evaluation index is greater than the average, it indicates that the link quality is good and the state transition probability increases; conversely, it decreases. For example, the overall evaluation index of the above link is 0.485, which is 0.065 higher than the average of 0.42, so its state transition probability increases by 10%.
[0165] Link state transition probabilities are used to select the optimal path from multiple possible paths. For example, there are two paths from microgrid 1 to microgrid 4: microgrid 1→microgrid 2→microgrid 4 and microgrid 1→microgrid 3→microgrid 4. The original optimal path is the former, but considering the link state transition probabilities, if the latter has better overall quality, it may be chosen as the optimized communication path. Control commands are encapsulated into data packets and transmitted sequentially according to the optimized communication path. The transmission time and path information are recorded each time the data passes through a microgrid for subsequent evaluation and optimization.
[0166] The steps for real-time acquisition of command execution data from each microgrid and dynamic optimization of scheduling strategy execution parameters include: real-time acquisition of command execution data from each microgrid; when an execution deviation exceeds a preset deviation threshold, inputting the execution data into a state prediction model for online learning to dynamically optimize the scheduling strategy execution parameters. Command execution data includes information such as actual response time, actual power adjustment, and execution status. The preset deviation threshold is 10% of the power setpoint. For example, if the power setpoint for microgrid 1 is 180 kW, and the actual power after execution is 160 kW, the execution deviation is 20 kW, accounting for 11.1% of the power setpoint, exceeding the preset deviation threshold of 10%, requiring online learning and adjustment. Through online learning, model parameters are updated to improve prediction accuracy. Based on the prediction results, execution parameters are dynamically adjusted, such as sending commands in advance or increasing the power setpoint margin, to reduce execution deviation.
[0167] This scheme generates control commands through a hierarchical consensus mechanism, achieving coordinated and consistent control of the microgrid group; power consistency constraints and timing coordination constraints ensure a smooth transition between adjacent microgrids, avoiding system fluctuations caused by sudden changes; a priority-based hierarchical deployment strategy improves the execution efficiency of key commands, and a dynamic path optimization mechanism overcomes the impact of communication network instability, achieving reliable transmission of control commands.
[0168] In a second aspect, a computer-readable storage medium is provided, having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
[0169] Thirdly, an electronic device is provided, comprising:
[0170] processor;
[0171] Memory used to store processor-executable instructions;
[0172] The processor is configured to invoke instructions stored in the memory to execute the aforementioned method.
Claims
1. An AI-driven collaborative optimization scheduling and demand response method for microgrid groups, characterized in that, include: Operational data from multiple microgrids are acquired to establish a state prediction model for the microgrid cluster, outputting predicted values for power generation, load, and energy storage status. The prediction deviation is calculated in real-time using a recursive Bayesian estimation method. Based on the output of the state prediction model and the prediction deviation, the overall power surplus and energy deficit of the microgrid cluster are calculated, generating a resource state matrix. Energy sharing opportunities are identified using a fast scenario library matching method. Based on these energy sharing opportunities and resource constraints, an adaptive game equilibrium algorithm is employed to solve for an optimal energy allocation scheme. The optimal allocation scheme is input into a reinforcement learning model, which outputs the final scheduling strategy. A hierarchical consensus mechanism is used to generate control commands for each microgrid. Command execution data from each microgrid is collected in real-time, and the execution parameters of the scheduling strategy are dynamically optimized.
2. The method according to claim 1, characterized in that, The steps of establishing a state prediction model for a microgrid cluster using a deep probabilistic modeling method, outputting predicted values for power generation, load, and energy storage status, and dynamically updating the parameters of the state prediction model using a recursive Bayesian estimation method to calculate the prediction deviation in real time include: A multi-task shared conditional variational autoencoder is constructed as the basic architecture of the state prediction model. The conditional variational autoencoder includes a feature extraction layer, a temporal dependency layer, and an attention layer. The feature extraction layer uses one-dimensional convolution to extract features from the running data. The temporal dependency layer uses a bidirectional long short-term memory network to process the output data of the feature extraction layer. The attention layer uses a multi-head attention mechanism to assign weights to the output data of the temporal dependency layer. The output data of the conditional variational autoencoder is input into the Gaussian mixture model, and the distribution parameters of the Gaussian mixture model are optimized by the expectation-maximization algorithm to obtain the initial prediction results. A Bayesian neural network is used to perform recursive Bayesian estimation on the initial prediction result. At each time step, cognitive uncertainty and random uncertainty are calculated through probability weight distribution. The cognitive uncertainty is calculated by the variance of the weight posterior distribution, and the random uncertainty is calculated by the variance of the likelihood function. The cognitive uncertainty and random uncertainty are added together to obtain the prediction bias at the current time step. Based on the prediction deviation, a prediction confidence interval is constructed. By minimizing the deviation between the prediction interval coverage and the preset confidence level, the upper and lower bounds of the prediction confidence interval are dynamically optimized, and the parameters of the state prediction model are updated according to the optimization results of the prediction confidence interval. Based on the optimization results of the prediction confidence interval, the state prediction model outputs the predicted values of power generation, power load, and energy storage status.
3. The method according to claim 1, characterized in that, Based on the output and prediction bias of the state prediction model, the steps of calculating the overall power surplus and energy deficit of the microgrid group, generating a resource state matrix, and identifying energy mutual assistance opportunities by combining a fast scenario library include: The corrected power generation, corrected load demand, and corrected energy storage capacity of the microgrid group are calculated using the output results and prediction deviation of the state prediction model, and the power surplus value and energy deficit value are calculated. Clustering historical operating data yields multiple typical scenarios, and scenario weights for these typical scenarios are calculated. A current state vector is constructed based on the corrected power generation, corrected load demand, and corrected energy storage capacity. The best matching scenario is determined based on the similarity between the current state vector and the typical scenarios, as well as the scenario weights. A resource state matrix for a microgrid cluster is constructed, wherein the power generation capacity sub-matrix includes the corrected power generation capacity and the power surplus value, the energy storage regulation sub-matrix includes the corrected energy storage capacity, the maximum charging power, and the maximum discharging power, and the transferable load sub-matrix includes the corrected load demand and the energy deficit value; the power and capacity parameters in the resource state matrix are dynamically corrected based on the optimal matching scenario; The energy complementarity and resource matching degree between any two microgrids are calculated based on the corrected resource state matrix. The energy complementarity is calculated by the inner product of the power surplus value and the energy deficit value, and the resource matching degree is calculated by the ratio of the power generation capacity submatrix to the energy storage regulation submatrix. The product of the energy complementarity, resource matching degree and the similarity of the optimal matching scenario is used as the energy mutual assistance feasibility index. Based on the energy mutual assistance feasibility index, energy mutual assistance opportunities of microgrid groups are identified.
4. The method according to claim 3, characterized in that, Based on the energy mutual aid opportunities and resource constraints, an adaptive game equilibrium algorithm is used to solve for the optimal energy allocation scheme; the steps of inputting the optimal allocation scheme into the reinforcement learning model and outputting the final scheduling strategy include: The energy mutual assistance opportunity is used as the basis for selecting game participants. The mutual assistance weights among participants are calculated based on the energy mutual assistance feasibility index. A utility function containing mutual assistance benefit, operating cost, and load deviation is constructed. The product of the mutual assistance weight and the calculation result of the utility function is used as the weighted utility value. Establish game constraints, including mutual capacity constraints and matching degree constraints. The mutual capacity constraints are determined based on the power surplus value and energy gap value, and the matching degree constraints are determined based on the resource matching degree. The Nash bargaining solution method is used to calculate the game equilibrium solution, and the energy optimization allocation scheme is obtained by maximizing the product of the difference between the weighted utility value and the retention utility value. Construct a state vector containing power generation, load demand, energy storage capacity, and mutual assistance power, and an action vector containing mutual assistance power adjustment and energy storage adjustment; design a reward function, which includes an economic benefit term, a reliability index term, and an execution deviation term; use the energy optimization allocation scheme as the initial strategy for reinforcement learning, and train a reinforcement learning model based on the state vector, action vector, and reward function; The execution success rate and actual execution deviation of historical scheduling schemes are statistically analyzed, and an execution reliability index is calculated based on the execution success rate and the actual execution deviation. The execution reliability index is combined with the Q-value update result to generate allocation weights, and the energy optimization allocation scheme is adjusted using the allocation weights to output the final scheduling strategy.
5. The method according to claim 4, characterized in that, The steps of using the energy optimization allocation scheme as the initial policy for reinforcement learning and training a reinforcement learning model based on the state vector, action vector, and reward function include: A multi-dimensional state space is constructed, and the mutual power, energy storage state, and load allocation in the energy optimization allocation scheme are combined with the power change rate, energy storage change rate, and historical execution characteristics to form a time-series state vector; the time-series state vector is standardized to obtain a normalized state vector. A hierarchical action space is constructed, with the mutual power adjustment amount and adjustment time window forming the main action space, and the energy storage adjustment amount and compensation coefficient forming the auxiliary action space; based on the main action space and the auxiliary action space, action constraints are constructed, and the action constraints are mapped to the feasible action space. A dual experience pool is constructed: the state-action sequence corresponding to the energy optimization allocation scheme is stored in the game equilibrium solution experience pool, and the state-action sequence with a historical execution success rate greater than a preset success rate threshold is stored in the historical execution experience pool; a combined loss function is calculated based on the game equilibrium solution experience pool and the historical execution experience pool. An embedded network structure is adopted. The game layer parameters are updated based on the game equilibrium loss, and the update magnitude is inversely proportional to the action deviation. The execution layer parameters are updated based on the execution deviation loss, and the update magnitude is directly proportional to the action deviation. In the initial training stage, the game equilibrium features are learned by using fixed sampling parameters. In the training transition stage, the sampling parameters are adjusted according to the cosine law to gradually introduce execution experience. In the training stabilization stage, a dual learning strategy with a fixed ratio is adopted.
6. The method according to claim 5, characterized in that, The steps of learning game equilibrium features using fixed sampling parameters in the initial training phase, gradually introducing execution experience by adjusting the sampling parameters according to the cosine law in the transition training phase, and employing a fixed-proportion dual learning strategy in the stable training phase include: The root mean square deviation of the Q-values of the samples in the game equilibrium solution experience pool is calculated as the game equilibrium metric. When the game equilibrium metric meets the preset conditions, the training initial stage is entered, and training data is sampled from the two experience pools at a fixed ratio. The rate of change of the parameter update amplitude is used as a training stability index. When the training stability index and the game equilibrium measurement index simultaneously meet the preset conditions, the training transition phase is entered. The sampling weight adjustment coefficient is calculated based on the training round. The sampling weight adjustment coefficient gradually transitions from the initial weight to the target weight according to the cosine decreasing law with the training round. The exponential moving average of the prediction error of historical execution samples is calculated as the execution fitting index; when the execution fitting index and the training stability index simultaneously meet the preset conditions, the training stabilization phase is entered, and the fixed sampling ratio of dual learning is determined according to the ratio of the game equilibrium metric index and the execution fitting index. The game equilibrium metric, the training stability metric, and the execution fitting metric are monitored in real time. When any metric exceeds the corresponding threshold, the training phase is rolled back to the previous phase. The corresponding preset threshold is dynamically adjusted based on the difference between the metrics before and after the rollback.
7. The method according to claim 1, characterized in that, According to the final scheduling strategy, the steps for generating control commands for each microgrid using a hierarchical consensus mechanism include: A power setting value is generated based on the final scheduling strategy; the response time requirement is calculated based on the difference between the power setting value and the current power; and the execution priority is determined based on the adjustment amplitude of the power setting value. A power consistency constraint is established based on the power setpoint, which requires that the power setpoint deviation between adjacent microgrids within the consensus subnet be less than a preset power deviation threshold; a timing coordination constraint is established based on the response time requirement, which ensures that the instruction execution time of adjacent microgrids meets the communication delay requirement; and control instructions for the microgrid group are deployed hierarchically based on the execution priority. A time-varying adjacency matrix is constructed by obtaining the connection status between microgrids, and a link weight matrix is constructed based on a comprehensive evaluation of link delay and bandwidth; the communication path with minimal delay is calculated according to the time-varying adjacency matrix and the link weight matrix. A comprehensive evaluation index is obtained by calculating the reciprocal of link delay, bandwidth utilization, and link reliability. The link state transition probability is updated based on the difference between the comprehensive evaluation index and the average link quality. The communication path is optimized based on the link state transition probability, and the control command is transmitted to each microgrid according to the optimized communication path.
8. The method according to claim 1, characterized in that, The steps for real-time acquisition of command execution data from each microgrid and dynamic optimization of scheduling strategy execution parameters include: The system collects command execution data from each microgrid in real time. When an execution deviation is detected to exceed a preset deviation threshold, the execution data is input into the state prediction model for online learning, and the execution parameters of the scheduling strategy are dynamically optimized.
9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 7.
10. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to invoke instructions stored in the memory to execute the method according to any one of claims 1 to 7.