Distributed energy transaction intelligent scheduling method, system and device based on prediction algorithm and medium
By combining multi-source data fusion and deep feature extraction techniques with long short-term memory networks and reinforcement learning algorithms, the problems of insufficient prediction accuracy and adaptive capability in distributed energy trading systems have been solved, achieving maximum trading returns and controllable risks in complex market environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- STATE GRID LIAONING ECONOMIC TECHN INST
- Filing Date
- 2025-11-28
- Publication Date
- 2026-05-08
AI Technical Summary
Existing distributed energy trading systems rely on a single data source and simple statistical forecasting methods, resulting in insufficient forecast accuracy, inability to capture multi-scale fluctuation patterns, and a lack of quantification and adaptive capabilities for forecast uncertainty, leading to high trading risks and poor returns.
By using multi-source data fusion and deep feature extraction techniques, a multi-dimensional feature extraction and long short-term memory network model is constructed. Combined with reinforcement learning algorithms, a probabilistic prediction model and an adaptive trading strategy optimization algorithm are established to achieve dynamic adjustment of distributed energy output prediction and trading strategies.
It achieves maximum trading profits and controllable risks in complex market environments. Through multi-step long-output prediction and real-time risk monitoring, it dynamically balances profits and risks, improving the trading system's adaptability and prediction accuracy.
Smart Images

Figure CN121998277A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of distributed energy trading and scheduling technology, and in particular to a method, system, device and medium for intelligent scheduling of distributed energy trading based on prediction algorithms. Background Technology
[0002] As the penetration rate of distributed energy resources in the power system continues to increase, the intermittency and volatility of their output pose significant challenges to electricity market trading. Existing distributed energy trading systems primarily rely on simple statistical forecasting methods, which have the following drawbacks: Traditional forecasting methods rely on a single data source, leading to insufficient accuracy. Existing distributed energy output forecasting primarily employs time series analysis methods, such as autoregressive moving average models and exponential smoothing. These methods lack the ability to extract features across different time scales and fail to capture the multi-scale fluctuations in distributed energy output. Strategy optimization models fail to consider uncertainty, resulting in high trading risk. Existing energy trading and scheduling methods often employ deterministic optimization models, treating forecast values as fixed quantities for trading plan formulation. When market prices fluctuate drastically, fixed trading plans can lead to significant losses. Existing methods lack modeling of the probability distribution of forecast errors, making it impossible to quantify trading risk or formulate risk mitigation strategies. Fixed trading strategies lack adaptability, resulting in suboptimal returns. Existing trading systems often employ rule-based fixed strategies, such as simple threshold strategies of buying low and selling high. They fail to consider the differences in market characteristics at different times and lack targeted optimization for typical periods such as morning and evening peaks and midday troughs. Even with large forecast errors, aggressive strategies are still implemented, indicating insufficient risk control capabilities. Summary of the Invention
[0003] In view of the aforementioned existing problems, the present invention is proposed.
[0004] Therefore, the technical problem solved by this invention is: how to achieve distributed energy output prediction in a distributed energy trading environment through multi-source data fusion and deep feature extraction technology. A probabilistic prediction model is constructed to quantify prediction uncertainty, and an adaptive trading strategy optimization algorithm is designed to maximize trading profits under controllable risk.
[0005] To address the aforementioned technical problems, this invention provides the following technical solution: a distributed energy trading intelligent scheduling method based on a prediction algorithm, comprising, Establish a multi-source data acquisition system to collect operational data from distributed energy systems and preprocess the data to obtain operational datasets. A multidimensional feature extraction process is used to extract features from the running dataset, and a feature fusion algorithm is combined to obtain a fused feature sequence. A multi-step long output prediction model is established using a long short-term memory network, and the input is a fused feature sequence, which outputs the output prediction interval. Based on the power output prediction range, a trading strategy optimization model is established using a reinforcement learning algorithm to output the optimal trading strategy. Based on the output optimal trading strategy, establish a risk value calculation formula and set trading limits; Establish a real-time risk monitoring model to calculate transaction risk indicators and issue early warnings based on these indicators.
[0006] As a preferred embodiment of the distributed energy trading intelligent scheduling method based on prediction algorithms described in this invention, the method employs a multi-dimensional feature extraction process to extract features from the running dataset, combined with a feature fusion algorithm to obtain a fused feature sequence, including: A multidimensional feature extraction process is used to extract features from the running dataset; Establish an attention weight calculation formula to calculate the weights of the extracted features; The calculated feature weights are fused using a feature fusion algorithm to obtain a fused feature sequence.
[0007] This invention constructs a multi-dimensional feature space and implements a dynamic weight fusion mechanism to structurally represent the temporal fluctuation patterns, periodic characteristics, statistical distribution features, and complex correlations between multiple data sources inherent in the original operating data. The attention-weighted feature fusion algorithm can adaptively adjust the weights of each data source based on different prediction scenarios, thereby forming a fused feature sequence with higher information density and more complete feature dimensions.
[0008] As a preferred embodiment of the distributed energy trading intelligent scheduling method based on prediction algorithms described in this invention, the method employs a long short-term memory network to establish a multi-step long-output prediction model, inputting a fused feature sequence and outputting an output prediction interval, including: A multi-step long output prediction model is established using a long short-term memory network; Establish a loss function to train a multi-step output prediction model; Based on the trained multi-step output prediction model, the input fused feature sequence outputs the output prediction range.
[0009] This invention mines and characterizes the dynamic characteristics of distributed energy output contained in the fused feature sequence by constructing a multi-step output prediction model. It can capture the long-term dependencies and short-term fluctuation patterns of output data over time, and make coherent predictions of output changes over multiple future periods. This multi-step prediction structure enables the system to obtain a complete trajectory of output changes.
[0010] As a preferred embodiment of the distributed energy trading intelligent scheduling method based on prediction algorithms described in this invention, the method includes: establishing a trading strategy optimization model using a reinforcement learning algorithm based on the output prediction interval, and outputting the optimal trading strategy, including: Based on the output prediction range, a trading strategy optimization model is established using a reinforcement learning algorithm, expressed as: , in, The instantaneous reward at time t. For the first l Electricity price for a specific time period For the first l Trading volume during the period For the first l Actual power generation during the period The default price is the cost incurred when the traded electricity volume exceeds the actual electricity generated. This indicates taking the absolute value. The risk aversion coefficient reflects the risk preference of decision-makers. The standard deviation of the portfolio Represents total transaction revenue. Indicates the total cost of default. Indicates risk penalty; An experience replay mechanism is used to train the trading strategy optimization model; The mean squared error is used to update the trading strategy optimization model, expressed as follows: in, For Q network loss, To evaluate the network output, For the state of the k-th sample, The action selected for the k-th sample. Let Q be the target Q value for the k-th sample.
[0011] This invention constructs the distributed energy trading decision-making process as a sequential decision problem and employs an optimization algorithm with autonomous learning capabilities, achieving dynamic strategy optimization in a market environment. Based on the probabilistic information provided by the prediction interval, the algorithm can autonomously explore the trading decision space under different risk preferences, gradually approaching the optimal strategy through repeated trial and error and value function iteration.
[0012] This invention provides a distributed energy trading intelligent scheduling system based on a prediction algorithm.
[0013] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a distributed energy trading intelligent scheduling system based on prediction algorithms, comprising: a data acquisition module, a feature extraction module, an output prediction module, a strategy optimization module, a limit setting module, and a risk warning module; The acquisition module establishes a multi-source data acquisition system to collect operational data from the distributed energy system and preprocesses it to obtain an operational dataset. The feature extraction module uses a multi-dimensional feature extraction process to extract features from the running dataset and combines it with a feature fusion algorithm to obtain a fused feature sequence. The output prediction module uses a long short-term memory network to establish a multi-step long output prediction model, and inputs a fused feature sequence to output an output prediction range. The strategy optimization module establishes a trading strategy optimization model based on the power output prediction range using a reinforcement learning algorithm, and outputs the optimal trading strategy. The limit setting module sets the trading limit based on the output optimal trading strategy and establishes a risk value calculation formula. The risk warning module establishes a real-time risk monitoring model to calculate transaction risk indicators and issues warnings based on these indicators.
[0014] The present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, characterized in that the processor executes the computer program to implement the steps of the intelligent scheduling method for distributed energy trading based on a prediction algorithm.
[0015] The present invention provides a computer-readable storage medium having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it implements the steps of the intelligent scheduling method for distributed energy trading based on a prediction algorithm.
[0016] The beneficial effects of this invention are as follows: This invention establishes a complete technical system from data acquisition to risk management. It strengthens the input information of the prediction model through multi-source data fusion and deep feature extraction, quantifies output uncertainty using probabilistic prediction, achieves adaptive optimization of trading strategies based on reinforcement learning, and forms a closed-loop risk management system by combining risk value calculation and real-time monitoring. This enables the distributed energy trading system to autonomously balance returns and risks in complex market environments. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a schematic diagram of the overall process of a distributed energy trading intelligent scheduling method based on a prediction algorithm, according to an embodiment of the present invention. Detailed Implementation
[0019] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.
[0020] Example 1, referring to Figure 1 This is one embodiment of the present invention, which provides a distributed energy trading intelligent scheduling method based on a prediction algorithm, comprising: It should be noted that as the penetration rate of distributed energy resources in the power system continues to increase, the intermittency and volatility of their output pose significant challenges to electricity market trading. Traditional forecasting methods rely on a single data source and lack multi-scale feature extraction capabilities, resulting in insufficient forecast accuracy. Deterministic optimization models do not consider forecast uncertainty, making trading plans face higher risks during periods of sharp market price fluctuations. Meanwhile, fixed trading strategies lack the ability to adapt to market characteristics at different times, making it difficult to achieve a dynamic balance between returns and risks in complex market environments.
[0021] Therefore, to address the aforementioned issues of insufficient prediction accuracy, lack of quantification of prediction uncertainty, and lack of adaptive capability in trading strategies, the following steps (S1-S6) are implemented: collecting and preprocessing operational data from the distributed energy system; performing feature extraction and fusion algorithms to obtain a fused feature sequence; and establishing a multi-step output prediction model to output the output prediction range. This resolves the problems of existing methods failing to quantify prediction uncertainty and having insufficient prediction accuracy. Furthermore, a trading strategy optimization model is established to output the optimal trading strategy, a risk value calculation formula is established to set trading limits, and early warnings are issued based on trading risk indicators. This resolves the problem of existing methods lacking adaptive capability in trading strategies.
[0022] S1: Establish a multi-source data acquisition system to collect operational data from distributed energy systems and preprocess it to obtain an operational dataset; S2: Use a multi-dimensional feature extraction process to extract features from the running dataset and combine it with a feature fusion algorithm to obtain a fused feature sequence; S3: A multi-step long output prediction model is established using a long short-term memory network, and the input is a fused feature sequence, which is then used to output the output prediction interval. S4: Based on the power output prediction range, a reinforcement learning algorithm is used to establish a trading strategy optimization model and output the optimal trading strategy; S5: Based on the output optimal trading strategy, establish a risk value calculation formula and set trading limits; S6: Establish a real-time risk monitoring model to calculate transaction risk indicators and issue early warnings based on these indicators.
[0023] Example 2, an embodiment of the present invention, provides a distributed energy trading intelligent scheduling method based on a prediction algorithm, based on the previous embodiment, comprising: In step S1, a multi-source data acquisition system is established to collect operational data from the distributed energy system and preprocess it to obtain an operational dataset, including the following steps A1-A3: A1: Establish a multi-source data acquisition system to collect operational data from distributed energy systems.
[0024] The system collects operational data from four data sources: a distributed energy management system, a meteorological monitoring station, a power market platform, and a distribution automation system. The distributed energy management system collects data every 5 seconds on the output power of the photovoltaic inverter, the output power of the wind turbine, the state of charge of the energy storage system, and its charging and discharging power; this data is transmitted to the edge controller via industrial Ethernet. The meteorological monitoring station collects six meteorological parameters per minute: irradiance, temperature, humidity, wind speed, wind direction, and air pressure, and uploads this data to the cloud server via 4G wireless communication. The power market platform publishes real-time electricity prices and day-ahead forecast prices every 15 minutes, pushing them to the system database via a dedicated data interface. The distribution automation system collects operational parameters per second, including feeder voltage, current, power factor, and load power; this data is stored on a local data server.
[0025] A2: Perform data cleaning on the operational data of distributed energy systems.
[0026] Furthermore, data cleaning includes outlier detection and missing value imputation.
[0027] Furthermore, outlier detection employs a box plot method to calculate the data quartiles and interquartile ranges, marking data exceeding the upper and lower limits as outliers. The expression is: , in, Given an abnormal data set, where x is a single data point. This is the first quartile, or the 25th quartile. The interquartile range is defined as , It is the third quartile, or 75th quartile.
[0028] Furthermore, data points marked as outliers are replaced using linear interpolation of data from the preceding and following time points. For missing value imputation, cubic spline interpolation is used for data with consecutive missing values less than 5 minutes, while the median of historical data from the same period is used for imputation of missing values longer than 5 minutes.
[0029] A3: Normalize the cleaned distributed energy system operation data to obtain the operation dataset.
[0030] Data normalization maps data of different dimensions to the interval between 0 and 1. The expression is: in, For normalized data, This is the historical minimum. This is the historical maximum value.
[0031] It should be noted that normalization can eliminate the influence of dimensions and accelerate the convergence of neural network training.
[0032] In step S2, a multidimensional feature extraction process is used to extract features from the running dataset and combine it with a feature fusion algorithm to obtain a fused feature sequence, including the following steps B1-B3: B1: Use a multidimensional feature extraction process to extract features from the running dataset.
[0033] Furthermore, the multidimensional feature extraction process extracts four types of feature vectors from the running dataset: time-domain features, frequency-domain features, statistical features, and correlation features.
[0034] Furthermore, time-domain features include the mean, maximum, minimum, variance, skewness, and kurtosis within the sliding window.
[0035] For example, taking photovoltaic power as an example, statistical characteristics are calculated for 12 five-minute sampling points over the past hour. The sliding window average reflects the current power output level, the variance reflects the degree of fluctuation, the skewness reflects the asymmetry of the distribution, and the kurtosis reflects the frequency of extreme values.
[0036] Furthermore, the frequency domain features are transformed into the frequency domain using a Fast Fourier Transform (FFT) to extract the amplitude and phase of the dominant frequency components and identify periodic patterns. A FFT is then applied to the 24-hour photovoltaic power output sequence to extract the energy at the corresponding daily frequency, reflecting the intensity of intraday fluctuations.
[0037] Further statistical features include quantiles, range, and coefficient of variation for the data within the sliding window. Quantile features are extracted at the 5th, 25th, 50th, 75th, and 95th percentiles to characterize the data distribution. The coefficient of variation, the ratio of standard deviation to mean, reflects the relative fluctuation range.
[0038] Furthermore, correlation characteristics are used to calculate Pearson correlation coefficients and mutual information among different variables, identifying linear and nonlinear relationships between variables. Correlation coefficients between photovoltaic power and irradiance and temperature are calculated to quantify the impact of meteorological factors on power output. Mutual information is calculated using joint probability distributions and marginal probability distributions to capture nonlinear correlations.
[0039] B2: Establish an attention weight calculation formula to calculate the weights of the extracted features.
[0040] B3: Combine the calculated feature weights with the feature fusion algorithm to obtain the fused feature sequence.
[0041] Furthermore, the fused feature vector is a weighted sum of the value vectors from each data source, expressed as: in, This is the fused feature vector, where M represents the total number of data sources, with a value of 4 including weather, power output, load, and price. Let j be the attention weight of the j-th data source. Let j be the value vector of the j-th data source.
[0042] It should be noted that the attention mechanism enables the model to automatically learn which data sources to focus on under different circumstances, thereby improving its feature representation capabilities.
[0043] The specific steps for calculating the weights of the extracted features in step B2 of this application embodiment are as follows: Furthermore, different data sources contribute differently to the prediction results and their contributions change dynamically over time. An attention mechanism is used to dynamically allocate the weights of each data source. The attention weight calculation is based on three parts: the query vector, the key vector, and the value vector. The target to be predicted at the current moment is taken as the query, and the feature vectors of each data source are taken as the keys. Similarity is calculated through a dot product, and the similarity is normalized using softmax to obtain the attention weight, expressed as: , in, Let j be the attention weight of the j-th data source. It is an exponential function. This indicates the transpose of the query vector. Let d be the key vector of the j-th data source, d be the vector dimension, and M be the total number of data sources. The sum of the denominators ensures that the sum of all weights is 1.
[0044] In an optional implementation, step B2, which calculates the weights of the extracted features, can also employ the entropy weighting method. This involves normalizing the feature data sequences, calculating the proportion of each feature in all samples, and forming a probability distribution matrix. The information entropy value of each feature is then calculated using the information entropy formula; a higher entropy value indicates a higher degree of disorder in the feature data. The difference coefficient is obtained by calculating the complementary value of the entropy values, and the ratio of this difference coefficient to the sum of the difference coefficients of all features is the final weight.
[0045] In another alternative implementation, the weight calculation of the extracted features in step B2 can also employ grey relational analysis. First, a reference sequence (usually the target output sequence as the standard) and a comparison sequence (each feature data sequence) are determined. The correlation coefficient between each feature and the reference sequence at each time step is calculated; the correlation coefficient calculation depends on determining the minimum and maximum differences between the two levels. The average of the correlation coefficients at each time step is taken to obtain the correlation degree, which is then normalized to form the feature weight.
[0046] It should be noted that this invention employs an attention mechanism to dynamically calculate the weights of the extracted features. By constructing an interactive calculation between the query vector and the feature vectors of each data source, the importance weights of features from different data sources can be adaptively evaluated and assigned based on the specific prediction objective and temporal context. This dynamic weighting method enables the model to automatically focus on the key features most relevant to the current prediction when facing different weather patterns, operating conditions, and market periods.
[0047] In step S3, a multi-step long output prediction model is established using a long short-term memory network. The input is a fused feature sequence, and the output is an output prediction interval, including the following steps C1-C3: C1: A multi-step long output prediction model is established using a long short-term memory network.
[0048] C2: Establish a loss function to train the multi-step output prediction model.
[0049] Furthermore, the training of the multi-step output prediction model uses mean squared error as the loss function, expressed as: in, The loss function is the mean squared error, where N is the number of training samples and S is the prediction step size, which is 16. For the nth sample at the s-th step, This corresponds to the predicted value.
[0050] Furthermore, the optimization algorithm employs the Adam optimizer, with an initial learning rate of 0.001. The learning rate is reduced to 0.5 times its original value when the validation set loss does not decrease for five consecutive epochs. The training batch size is 64, the maximum number of training epochs is 200, and an early stopping strategy is used: training stops when the validation set loss does not decrease for ten consecutive epochs. The model with the smallest validation set loss is selected as the final model.
[0051] C3: Based on the trained multi-step output prediction model, input the fused feature sequence and output the output prediction interval.
[0052] Furthermore, based on point prediction, quantile regression is used to output prediction intervals at different confidence levels. Quantile regression estimates different quantiles of the conditional distribution by minimizing the quantile loss function. For Quantiles, the loss function is defined as: in, for Quantile loss, Let u be the quantile loss function, and u be the predicted residual. For indicator functions, The target quantile, taking values from 0 to 1. For the first Quantile predictions.
[0053] It should be noted that the loss is when the predicted value is higher than the actual value. The loss is when the residual is less than the true value. The residual is twice the value.
[0054] Furthermore, the system outputs five quantile predictions: the 10th quantile, 25th quantile, 50th quantile, 75th quantile, and 90th quantile. The 50th quantile, which is the median, is used as the point prediction value. The 10th to 90th quantiles constitute the 80% prediction interval, and the 25th to 75th quantiles constitute the 50% prediction interval.
[0055] It should be noted that the width of the prediction interval reflects the magnitude of uncertainty; the wider the interval, the greater the uncertainty. Through probability prediction, decision-makers can choose conservative or aggressive strategies based on their risk appetite. Those with a high risk appetite use the 50th percentile to formulate trading plans, while those with a low risk appetite use the 25th percentile to ensure a high probability of completing the trade.
[0056] In this embodiment of the application, the specific steps for establishing the multi-step output prediction model in step C1 are as follows: Furthermore, a multi-step prediction model is established using a Long Short-Term Memory (LSTM) network. The input is a fused feature sequence from the past 24 hours, and the output is the output prediction every 15 minutes for the next 4 hours, for a total of 16 prediction steps. The LSM unit selectively retains and updates historical information through three gating mechanisms: a forget gate, an input gate, and an output gate, overcoming the gradient vanishing problem of traditional recurrent neural networks. The forget gate determines which historical information needs to be forgotten; its expression is: , in, The output of the forget gate at time t. It uses the sigmoid activation function, and its output value is between 0 and 1. Here is the forget gate weight matrix. This is the hidden state from the previous moment. For the current input features, Forget gate bias vector, express and Vector concatenation operation.
[0057] It should be noted that the input gate determines which new information needs to be stored, the output gate determines which information is currently output, and the three gates work together to achieve long-term memory of time series dependencies.
[0058] Furthermore, the network structure comprises three Long Short-Term Memory (LSTM) layers and two fully connected layers. The first LSM layer contains 128 hidden units, receiving the fused feature sequence and extracting primary temporal features. The second layer contains 64 hidden units, further abstracting the temporal pattern. The third layer contains 32 hidden units, outputting a compressed high-level feature representation. Each LSM layer is followed by a dropout layer, randomly discarding some neurons to prevent overfitting. The first fully connected layer contains 64 neurons and uses the ReLU activation function to introduce non-linearity. The second fully connected layer outputs the output values of 16 neurons corresponding to 16 prediction steps.
[0059] In an alternative implementation, the multi-step output prediction model established in step C1 can also employ gated recurrent units (GRUs) to construct an encoder-decoder structure containing multiple GRU layers. The encoder progressively encodes the input sequence into a fixed-dimensional context vector. The decoder then progressively generates multi-step prediction results based on this vector. During the training phase, a teacher-forced strategy is employed, using the true value as the input to the decoder at the next time step to accelerate convergence.
[0060] In another alternative implementation, the multi-step output prediction model established in step C1 can also employ a temporal convolutional network. A stack of convolutional layers with an exponentially growing inflation coefficient is designed so that each output time step depends only on the current and historical inputs. Residual connections are introduced between convolutional layers to mitigate gradient vanishing and maintain network training stability. Parallel computation is achieved through a fully convolutional architecture, using single-step convolutions at the output layer to convert feature maps into multi-step predictions.
[0061] It should be noted that the multi-step output prediction model constructed in this invention forms a synergistically enhanced prediction architecture by integrating the gated temporal dependency modeling capability of Long Short-Term Memory networks, the local feature extraction capability of multi-scale temporal convolution, and the key information focusing capability of attention mechanisms. The multi-step output prediction model can capture the long-term periodicity, medium-term trend changes, and short-term fluctuation characteristics inherent in the output sequence of distributed energy resources, achieving coherent prediction of the output trajectory for multiple consecutive future periods.
[0062] In step S4, based on the power output prediction range, a reinforcement learning algorithm is used to establish a trading strategy optimization model and output the optimal trading strategy, including the following steps D1-D3: D1: Based on the output prediction range, a trading strategy optimization model is established using a reinforcement learning algorithm.
[0063] D2: The trading strategy optimization model is trained using an experience replay mechanism; Furthermore, training employs an experience replay mechanism. The four-tuple of state, action, reward, and next state generated by the agent's interaction with the environment is stored in an experience pool with a capacity of 10,000 entries. During each training session, experiences of size 32 are randomly sampled from the experience pool to calculate the temporal difference objective, expressed as: in, For the first k The target Q value for each sample For instant rewards, The discount factor, set to 0.99, is determined based on the time-series characteristics of electricity trading. Considering the trading cycle of the next 4 hours, the discount factor needs to both emphasize near-term returns and reflect an appropriate decay of long-term rewards. Through grid search testing within the range [0.95, 0.99], the strategy converges fastest and achieves optimal cumulative returns when γ = 0.99. The Q value output by the target network. Indicates the next state. This is an optional action for the next state. This indicates taking the maximum value for all actions.
[0064] D3: Calculate the mean squared error to update the trading strategy optimization model.
[0065] Furthermore, the evaluation network updates its parameters by minimizing the mean squared error between the predicted Q-value and the target Q-value, as expressed by: in, For Q network loss, To evaluate the network output, For the state of the k-th sample, The action selected for the k-th sample. Let Q be the target Q value for the k-th sample.
[0066] Furthermore, the optimization algorithm employs the Adam optimizer with a learning rate of 0.0001. The exploration strategy uses a greedy approach, with probabilistic probability... Randomly select actions for exploration, based on probability. Choose the action with the highest Q value and explore rate. The value decreases linearly from 1 to 0.1, balancing exploration and utilization.
[0067] In this embodiment of the application, the specific steps for establishing the trading strategy optimization model in step S4 are as follows: Furthermore, the energy trading problem is modeled as a Markov decision process, and a deep Q-network algorithm is used to learn the optimal trading strategy. The state space contains the median, 10th percentile, and 90th percentile of the power output forecast for 16 time periods over the next 4 hours, totaling 48 predicted values, plus the electricity price forecast for the 16 time periods, as well as the current state of charge of energy storage, sold but undelivered electricity, and market supply and demand index, resulting in a state vector dimension of 67. The action space consists of the trading electricity for each of the 16 time periods, with each time period's trading electricity discretized into 5 levels: no trading, trading 25% of the predicted power output, trading 50% of the predicted power output, trading 75% of the predicted power output, and trading 100% of the predicted power output. The total action space size is... .
[0068] Furthermore, the reward function comprehensively considers three factors: transaction gains, default penalties, and risk costs, and its expression is: in, The instantaneous reward at time t. For the first l Electricity price for a specific time period For the first l Trading volume during the period For the first l Actual power generation during the period The default price is the cost incurred when the traded electricity volume exceeds the actual electricity generated. This indicates taking the absolute value. The risk aversion coefficient reflects the risk preference of decision-makers. The standard deviation of the portfolio represents the trading risk. Represents total transaction revenue. Indicates the total cost of default. This represents risk and penalty, and three factors that balance returns and risks.
[0069] It should be noted that the Deep Q-Network employs a dual-network structure, including an evaluation network and a target network. The two networks have identical structures but independent parameters. The evaluation network updates in real-time, while the target network copies parameters from the evaluation network every 100 steps, providing a slow update to improve training stability. The network structure is a four-layer fully connected network. The input layer has 67 neurons corresponding to the state dimension, the first hidden layer has 128 neurons, the second hidden layer has 64 neurons, and the number of neurons in the output layer equals the size of the action space. Due to the large action space, continuous action space modeling is used. The 16 neurons in the output layer output the transaction volume for 16 time periods, with values from 0 to 1 representing the predicted transaction proportion.
[0070] In an optional implementation, the trading strategy optimization model established in step S4 can also employ a stochastic programming method. This involves generating a large number of typical scenarios with probability weights based on historical data, including uncertainties such as output fluctuations and price changes. Subsequently, a mixed-integer programming model is established with the objective of maximizing expected return, subject to equipment operation constraints and risk limitations. This model is then solved using mathematical optimization algorithms such as branch and bound or Benders decomposition.
[0071] In another optional implementation, the trading strategy optimization model established in step S4 can also employ fuzzy logic control. Input variables (such as predicted output, market price, and inventory status) are transformed into fuzzy linguistic variables using a membership function. A preset fuzzy rule base is then invoked for inference. The output is converted into trading instructions through a defuzzification interface.
[0072] It should be noted that this invention constructs the complex energy trading decision-making process as a Markov decision process and employs a deep reinforcement learning algorithm for autonomous optimization. The trading strategy optimization model fully encapsulates multi-dimensional information such as output prediction intervals, market price signals, and system operating states through its state space, enabling strategy evaluation from a panoramic perspective. The discretized action space design ensures decision feasibility while controlling the complexity of strategy search. A multi-objective reward function integrating economic returns, default costs, and risk penalties guides the algorithm to autonomously balance short-term gains and long-term risks during the learning process, outputting a trading strategy that conforms to a preset risk preference.
[0073] In step S5, based on the output optimal trading strategy, a risk value calculation formula is established to set trading limits, including the following steps E1-E3: E1: Based on the output optimal trading strategy, establish a risk value calculation formula through random simulation.
[0074] Furthermore, based on the output optimal trading strategy, the Value at Risk (VaR) of the trading strategy is calculated using Monte Carlo simulation. 1000 possible scenarios are sampled from the prediction distribution, each scenario containing output values for 16 time periods. For each scenario, the revenue is calculated based on the traded electricity volume and the actual output. When the traded electricity volume exceeds the actual output, a default cost is paid, and the revenue is the trading revenue minus the default cost. The revenues of the 1000 scenarios are sorted from highest to lowest, and the loss value corresponding to the 5th percentile is defined as the Value at Risk (VaR) at the 95% confidence level, expressed as: in, Value at risk at a 95% confidence level. Value at Risk (VaR) is the 5th percentile of returns, which is the 50th smallest return value out of 1000 scenarios. VaR represents the percentage of losses that will not exceed this value in 95% of cases.
[0075] Furthermore, the conditional value at risk (CVaR) is defined as the average loss exceeding the value at risk, expressed as: in, Value at risk at a 95% confidence level. Let i be the i-th smallest profit value, where i ranges from 1 to 50, corresponding to the worst 5% scenario.
[0076] It should be noted that conditional value at risk reflects the average loss under extreme conditions and is more conservative than value at risk.
[0077] E2: Calculate the risk value of a trading strategy using the Value at Risk (VaR) formula.
[0078] E3: Set trading limits for energy transactions based on the calculated risk value.
[0079] In this embodiment of the application, the specific steps for setting the transaction limit in step S5 are as follows: Furthermore, based on the calculated value at risk, a trading limit is set for energy transactions, requiring that the value at risk at a 95% confidence level does not exceed 30% of the expected return, expressed as: in, The expected value of revenue for 1000 scenarios is the average revenue.
[0080] It should be noted that if a trading strategy violates this constraint, the trading volume will be reduced until the risk limit is met. This risk constraint helps prevent excessive aggressiveness from leading to significant losses and ensures trading security.
[0081] In an optional implementation, setting the trading limit in step S5 can also employ historical simulation, selecting representative historical data, including complete time-series data of key variables such as output, price, and load. The current holdings or planned trading strategy are mapped to the data scenario of each historical day, calculating the daily return distribution of the strategy under various historical market conditions. The return distribution is sorted, and a specific quantile is taken as an estimate of the value at risk. Based on this value at risk and the company's risk tolerance, an appropriate trading limit is set.
[0082] In another optional implementation, setting the trading limit in step S5 can also employ stress testing to identify key risk factors affecting trading returns. Different levels of stress scenarios are designed, including mild, moderate, and severe stress. The potential maximum loss under each stress scenario is calculated based on the current trading strategy. The loss value under the moderate stress scenario is used as the core trading limit, and the loss value under the severe stress scenario is used as the emergency stop-loss line.
[0083] It should be noted that the trading limit setting mechanism constructed in this invention is based on the complete distribution characteristics of probabilistic prediction output. Through Monte Carlo simulation, it generates a large number of possible scenarios that conform to actual statistical laws, thereby fully exposing the risk exposure of trading strategies under various market conditions before decision-making. This ensures that the setting of risk limits no longer relies on simple extrapolation of historical data or subjective judgment, but is based on a rehearsal of future risks.
[0084] In step S6, a real-time risk monitoring model is established to calculate transaction risk indicators, and early warnings are issued based on these indicators, including the following steps F1-F3: F1: Establish a real-time risk monitoring model based on the trading strategy output process.
[0085] Furthermore, the system establishes a real-time risk monitoring model that calculates three risk indicators every minute: prediction deviation, trading deviation, and price fluctuation. Prediction deviation is defined as the ratio of the difference between actual output and the predicted median to the rated capacity, expressed as: in, The percentage of prediction deviation. To contribute practically, To predict the median, This is the rated capacity.
[0086] Furthermore, a yellow alert is triggered when the forecast deviation exceeds 10%, and a red alert is triggered when it exceeds 15%. Trading deviation is defined as the difference between sold electricity and remaining generation capacity; an alert is triggered when sold electricity exceeds 80% of the remaining capacity. Price fluctuations are assessed by calculating the standard deviation of prices over the most recent hour; an alert is triggered when the standard deviation exceeds 20% of the average price.
[0087] F2: Calculate transaction risk indicators based on the real-time risk monitoring model.
[0088] F3: Issue early warnings based on transaction risk indicators and activate the emergency response mechanism.
[0089] Furthermore, an emergency response mechanism is activated when any of the three transaction risk indicators triggers a red alert. The emergency response is divided into three levels: Level 1: Suspends new transactions and only executes existing contracts to reduce risk exposure. Level 2: Actively repurchases a portion of the sold electricity and fulfills contracts through market transactions or by utilizing energy storage discharge to reduce defaults. Level 3: Triggers maximum power discharge of energy storage and simultaneously activates interruptible loads to fully guarantee contract performance; if necessary, penalties are paid to terminate part of the contract. The emergency response decision tree automatically selects the response level and specific measures based on the combination of the three risk indicators, with a response time of less than one minute.
[0090] It should also be noted that the system of this invention adopts a three-layer architecture of cloud-edge-terminal to achieve hierarchical scheduling. The cloud server is deployed in the data center and configured with a high-performance computing cluster, including a 16-core CPU, 64GB of memory, and 4 GPU accelerator cards, to run deep learning training and global optimization programs. The cloud performs daily day-ahead trading plan optimization at midnight, with the input being the output forecast, load forecast, and price forecast for the next 24 hours, and the output being the benchmark trading electricity for 96 15-minute time periods. The trading plan is then distributed to each edge controller via a 4G private network.
[0091] Furthermore, edge controllers are deployed in substations or central control centers, configured with industrial control computers, and run real-time forecasting and rolling optimization programs. Every 15 minutes, the edge controller collects distributed energy output, weather, and load data within its jurisdiction, runs a multi-step output forecasting model, and outputs an output forecast for the next 4 hours. Based on the output forecast, it corrects the trading plan issued from the cloud, performing rolling optimization with an optimization window of 4 hours and a rolling step of 15 minutes. The goal of edge optimization is to track the cloud trading plan while responding to local fluctuations; the objective function expression is: in, For the transaction volume of the edge layer in time period s, Values are sent from the cloud. To ensure the tracking weight is set to 0.6, the weight allocation is based on the cloud-edge collaborative control principle. The tracking weight (0.6) for the cloud plan is slightly higher than the matching weight (0.4) for the local prediction, ensuring the dominance of the global plan while reserving 40% adaptive adjustment space to cope with local fluctuations. A weight ratio of 6:4, after simulation testing, reduced the default rate at the edge layer by approximately 15% while maintaining overall network coordination. For predicting the output in time period s, The matching weight is set to 0.4, and... The weighting ratio is 6:4. This ratio was determined through multi-scenario simulation optimization: when When the value is less than 0.3, insufficient local adaptability leads to increased defaults due to prediction bias. A value >0.5 indicates that over-tracking local predictions weakens global coordination. A value of 0.4 strikes an optimal balance between global consistency and local flexibility. Two weights sum to 1 to balance global consistency and local adaptability. Edge optimization computation takes approximately 30 seconds, and the optimization results are distributed to the terminal device via industrial Ethernet.
[0092] It should be noted that the terminal equipment includes photovoltaic inverters, energy storage converters, and controllable load controllers, with embedded controllers deployed. The terminal receives power setpoints from the edge layer and tracks these setpoints through closed-loop feedback control. When a sudden power output change or grid disturbance is detected, the energy storage system responds within 100 milliseconds and compensates for the power deviation, smoothing out fluctuations. The terminal layer does not perform optimization calculations but only executes commands and local feedback control. This three-layer collaboration achieves progressive control from day-ahead planning to intraday adjustment to real-time tracking, balancing optimization and real-time performance.
[0093] In summary, this invention characterizes the output properties of distributed energy sources through multi-source data fusion and deep feature extraction techniques. By constructing probabilistic prediction and multi-step output prediction models, it addresses the issues of insufficient prediction accuracy and lack of quantification of uncertainty inherent in traditional methods. Furthermore, by establishing an adaptive trading strategy optimization mechanism based on reinforcement learning, it achieves dynamic decision optimization in volatile market environments. Finally, by introducing a risk management system that combines risk value calculation with real-time monitoring, it overcomes the limitations of existing technologies that rely on fixed rules and lack dynamic risk response capabilities.
[0094] Example 3 is an embodiment of the present invention, which provides a distributed energy trading intelligent scheduling system based on a prediction algorithm, including: a data acquisition module, a feature extraction module, an output prediction module, a strategy optimization module, a limit setting module, and a risk warning module; The acquisition module establishes a multi-source data acquisition system to collect operational data from the distributed energy system and preprocesses it to obtain an operational dataset. The feature extraction module uses a multi-dimensional feature extraction process to extract features from the running dataset and combines it with a feature fusion algorithm to obtain a fused feature sequence. The output prediction module uses a long short-term memory network to establish a multi-step long output prediction model, and inputs a fused feature sequence to output an output prediction range. The strategy optimization module establishes a trading strategy optimization model based on the power output prediction range using a reinforcement learning algorithm, and outputs the optimal trading strategy. The limit setting module sets the trading limit based on the output optimal trading strategy and establishes a risk value calculation formula. The risk warning module establishes a real-time risk monitoring model to calculate transaction risk indicators and issues warnings based on these indicators.
[0095] This embodiment also provides an electronic device applicable to a distributed energy trading intelligent scheduling method based on a prediction algorithm, comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the distributed energy trading intelligent scheduling method based on a prediction algorithm proposed in the above embodiment.
[0096] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, it implements a distributed energy trading intelligent scheduling method based on a prediction algorithm as proposed in the above embodiment.
[0097] The storage medium proposed in this embodiment and the method for implementing a distributed energy trading intelligent scheduling method based on prediction algorithms proposed in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.
[0098] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.
[0099] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A distributed energy trading intelligent scheduling method based on prediction algorithms, characterized in that: include, Establish a multi-source data acquisition system to collect operational data from distributed energy systems and preprocess the data to obtain operational datasets. A multidimensional feature extraction process is used to extract features from the running dataset, and a feature fusion algorithm is combined to obtain a fused feature sequence. A multi-step long output prediction model is established using a long short-term memory network, and the input is a fused feature sequence, which outputs the output prediction interval. Based on the power output prediction range, a trading strategy optimization model is established using a reinforcement learning algorithm to output the optimal trading strategy. Based on the output optimal trading strategy, establish a risk value calculation formula and set trading limits; Establish a real-time risk monitoring model to calculate transaction risk indicators and issue early warnings based on these indicators.
2. The distributed energy trading intelligent scheduling method based on prediction algorithms as described in claim 1, characterized in that: The establishment of a multi-source data acquisition system to collect operational data from distributed energy systems and preprocess the data to obtain an operational dataset includes: Establish a multi-source data acquisition system to collect operational data from distributed energy systems; Data cleaning of distributed energy system operation data; The cleaned distributed energy system operation data is normalized to obtain the operation dataset.
3. The distributed energy trading intelligent scheduling method based on prediction algorithms as described in claim 2, characterized in that: The process of using a multidimensional feature extraction engineering method to extract features from the running dataset and then combining this with a feature fusion algorithm to obtain a fused feature sequence includes: A multidimensional feature extraction process is used to extract features from the running dataset; Establish an attention weight calculation formula to calculate the weights of the extracted features; The calculated feature weights are fused using a feature fusion algorithm to obtain a fused feature sequence.
4. The intelligent scheduling method for distributed energy trading based on prediction algorithms as described in claim 3, characterized in that: The method employs a long short-term memory network to establish a multi-step long output prediction model, which inputs a fused feature sequence and outputs an output prediction interval, including: A multi-step long output prediction model is established using a long short-term memory network; Establish a loss function to train a multi-step output prediction model; Based on the trained multi-step output prediction model, the input fused feature sequence outputs the output prediction range.
5. The distributed energy trading intelligent scheduling method based on prediction algorithms as described in claim 4, characterized in that: Based on the power output prediction range, a reinforcement learning algorithm is used to establish a trading strategy optimization model, which outputs the optimal trading strategy, including: Based on the output prediction range, a trading strategy optimization model is established using a reinforcement learning algorithm, expressed as: , in, The instantaneous reward at time t. For the first l Electricity price for a specific time period For the first l Trading volume during the period For the first l Actual power generation during the period The default price is the cost incurred when the traded electricity volume exceeds the actual electricity generated. This indicates taking the absolute value. The risk aversion coefficient reflects the risk preference of decision-makers. The standard deviation of the portfolio Represents total transaction revenue. Indicates the total cost of default. Indicates risk penalty; An experience replay mechanism is used to train the trading strategy optimization model; The mean squared error is used to update the trading strategy optimization model, expressed as follows: , in, For Q network loss, To evaluate the network output, For the state of the k-th sample, The action selected for the k-th sample Let Q be the target Q value for the k-th sample.
6. The intelligent scheduling method for distributed energy trading based on a prediction algorithm as described in claim 5, characterized in that: The process of establishing a risk value calculation formula and setting trading limits based on the output optimal trading strategy includes: Based on the output optimal trading strategy, a formula for calculating Value at Risk (VaR) is established using a stochastic simulation method. The expression is as follows: , , in, Value at risk at a 95% confidence level. The 5th percentile of earnings. Value at risk at a 95% confidence level. The i-th value after sorting the profit values from smallest to largest; The risk value of a trading strategy is calculated using the value at risk formula. The calculated risk value is used to set trading limits for energy transactions, expressed as follows: , in, This represents the average return.
7. The intelligent scheduling method for distributed energy trading based on a prediction algorithm as described in claim 6, characterized in that: The establishment of a real-time risk monitoring model to calculate transaction risk indicators and to issue early warnings based on these indicators includes: Based on the trading strategy output process, a real-time risk monitoring model is established, expressed as: , in, The percentage of prediction deviation. To contribute practically, To predict the median, Rated capacity; Calculate transaction risk indicators based on a real-time risk monitoring model; Early warnings will be issued based on transaction risk indicators, and an emergency response mechanism will be activated.
8. A distributed energy trading intelligent scheduling system based on a prediction algorithm, employing the distributed energy trading intelligent scheduling method based on a prediction algorithm as described in any one of claims 1-7, characterized in that, include: The system includes a data acquisition module, a feature extraction module, a power output prediction module, a strategy optimization module, a quota setting module, and a risk warning module. The acquisition module establishes a multi-source data acquisition system to collect operational data from the distributed energy system and preprocesses it to obtain an operational dataset. The feature extraction module uses a multi-dimensional feature extraction process to extract features from the running dataset and combines it with a feature fusion algorithm to obtain a fused feature sequence. The output prediction module uses a long short-term memory network to establish a multi-step long output prediction model, and inputs a fused feature sequence to output an output prediction range. The strategy optimization module establishes a trading strategy optimization model based on the power output prediction range using a reinforcement learning algorithm, and outputs the optimal trading strategy. The limit setting module sets the trading limit based on the output optimal trading strategy and establishes a risk value calculation formula. The risk warning module establishes a real-time risk monitoring model to calculate transaction risk indicators and issues warnings based on these indicators.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the distributed energy trading intelligent scheduling method based on the prediction algorithm as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the distributed energy trading intelligent scheduling method based on the prediction algorithm as described in any one of claims 1 to 7.