Distributed power battery energy transaction and scheduling method and system for smart power grid
By building a federated learning node network and credit evaluation mechanism, combining space-time correlation diagrams and improved particle swarm algorithms, the precise matching and risk control of distributed power battery energy transactions are achieved, the transaction and scheduling problems in the existing technology are solved, and the operation efficiency and security of the smart grid are improved.
Patent Information
- Application Number
- CN202510408230.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2045-04-02
AI Technical Summary
The energy trading and scheduling of distributed power batteries in existing smart grids have problems such as insufficient consideration of real-time status and geographical location, information security risks of centralized transaction models, and difficulty in taking into account transaction returns and grid scheduling costs.
By collecting the load distribution data of smart grid and real-time state information of power batteries, a federated learning node network is built, a gradient improvement decision tree algorithm is used to calculate the credit evaluation score, a spatio-temporal correlation diagram is built, and a graph attention algorithm is used to extract the power demand dependency relationship, and combined with the improved particle swarm algorithm to optimize the charge and discharge scheduling instructions, realizing accurate matching and risk control of power batteries.
It improves transaction success rate and system security, reduces economic losses caused by transaction failure, improves grid operation efficiency and reliability, and ensures maximum transaction returns and minimizes grid scheduling costs.
Smart Images

Figure CN120262388A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of smart grids, and particularly to a distributed power battery energy trading and scheduling method and system for a smart grid. Background Art
[0002] As an important development direction of modern power systems, smart grids can achieve efficient utilization and flexible scheduling of power resources. With the popularization of electric vehicles, distributed power batteries, as mobile energy storage units, are playing an increasingly important role in smart grids; Currently, there are still problems in the energy trading and scheduling of distributed power batteries in smart grids, such as lack of consideration for the real-time state and geographical location of power batteries, information security risks in the centralized trading mode, and only considering a single objective, making it difficult to simultaneously optimize trading benefits and grid scheduling costs; Therefore, there is an urgent need for a solution to solve the problems existing in the prior art. Summary of the Invention
[0003] Embodiments of the present invention provide a distributed power battery energy trading and scheduling method and system for a smart grid, which can at least solve some of the problems existing in the prior art.
[0004] In the first aspect of the embodiments of the present invention, a distributed power battery energy trading and scheduling method for a smart grid is provided, including: Collecting smart grid load distribution data and real-time state information of distributed power batteries, calculating the power consumption demand curve of each region according to the smart grid load distribution data, where the real-time state information includes the remaining battery power, charge and discharge power, and geographical location information, and dividing the power batteries into multiple power battery trading groups according to the charge and discharge power, remaining battery power, and geographical location based on the real-time state information and the power consumption demand curve; Constructing a federated learning node network based on the power battery trading groups, taking the historical response time, battery health status, and transaction completion rate of both the buyer and the seller as operation data, inputting them into a pre-trained multi-layer neural network for feature extraction, calculating a credit evaluation score using the gradient boosting decision tree algorithm, and setting different trading quotas and credit thresholds for the buyer and the seller within the power battery trading group based on the credit evaluation score; Constructing a spatio-temporal association graph based on the power consumption demand curve and historical transaction data, using the graph attention algorithm to extract the power demand dependency relationship between regions, combining a recurrent neural network to model the time series features, outputting the optimal trading price interval for each trading group in the next 24 hours by time period, and generating a risk-controlled trading matching strategy according to the optimal trading price interval and the credit threshold; According to the differentiated trading quotas, optimal trading price ranges, and trading matching strategies, while considering maximizing trading benefits and minimizing grid dispatching costs, an improved particle swarm optimization algorithm is used to optimize and calculate the charging and discharging scheduling instructions including charging and discharging periods, charging and discharging powers, and target electricity quantities, and the charging and discharging scheduling instructions are issued and trading settlements are executed.
[0005] In an alternative implementation, Collect the intelligent grid load distribution data and the real-time status information of distributed power batteries. Calculate the electricity demand curves of each region according to the intelligent grid load distribution data. The real-time status information includes the remaining battery power, charging and discharging powers, and geographical location information. Based on the real-time status information and the electricity demand curves, the power batteries are divided into multiple power battery trading groups according to charging and discharging powers, remaining battery powers, and geographical locations, including: Collect the intelligent grid load distribution data, including the real-time load rates of regional distribution transformers, historical electricity load curves, and time-of-use electricity price information. According to the intelligent grid load distribution data, a method combining Fourier series decomposition and wavelet transform is used to perform periodic analysis and trend extraction on the historical electricity load curves, and calculate the sub-period electricity demand curves of each region for the next 24 hours; Obtain the real-time status information of distributed power batteries. The real-time status information includes the remaining battery power, charging and discharging powers, and geographical location information. The charging and discharging powers include the maximum charging power, maximum discharging power, and charging and discharging efficiency. Calculate the electricity quantity available for participating in electricity trading according to the remaining battery power and charging and discharging efficiency; Based on the electricity demand curves and real-time status information, calculate the geographical distances and transmission losses between the power batteries and the load centers of each region. Combining the matching degree between the tradable electricity quantities of the power batteries and the regional electricity demands, an improved hierarchical clustering algorithm is used to adaptively group the power batteries. Among them, the charging and discharging characteristics deviation of the power batteries within the same group does not exceed 5% and the geographical location distribution does not exceed the preset maximum grouping distance, and the number of groups is dynamically adjusted according to real-time trading demands.
[0006] In an alternative implementation, Based on the power battery trading groups, construct a federated learning node network. Take the historical response times, battery health statuses, and transaction completion rates of both the buyer and the seller as operation data and input them into a pre-trained multi-layer neural network for feature extraction. Use the gradient boosting decision tree algorithm to calculate the credit assessment scores. Based on the credit assessment scores, set differentiated trading quotas and credit thresholds for both the buyer and the seller within the power battery trading groups, including: Construct a federated learning node network based on the power battery trading group. Take the buyers and sellers in the power battery trading group as independent federated learning nodes. The federated learning nodes maintain historical response time, battery health status, and transaction completion rate. The battery health status includes capacity retention rate, internal resistance growth rate, and voltage consistency; Perform normalization and standardization preprocessing on the historical response time, the battery health status, and the transaction completion rate. Use a sliding time window to segment and sample the preprocessed data to generate a training sample set, and form the running data with the training sample set; Input the running data into a pre-trained multi-layer neural network for feature extraction. The multi-layer neural network consists of an input layer, a first hidden layer, a second hidden layer, a third hidden layer, and an output layer. The first hidden layer, the second hidden layer, and the third hidden layer use a rectified linear unit activation function with a random inactivation mechanism. The output layer generates a feature vector. Construct a multi-objective loss function based on the Euclidean distance between the feature vector and the target feature vector and the one-norm of the network weights; Execute federated average training in the federated learning node network. Each federated learning node calculates local gradients based on local data, encrypts the local gradients using a differential privacy mechanism, and transmits the encrypted local gradients to an aggregation server. The aggregation server performs weighted averaging on the local gradients according to the sample numbers and data quality scores of each federated learning node to obtain global gradients, and updates the global model parameters based on the global gradients; Input the enhanced feature vector into a gradient boosting decision tree algorithm. The gradient boosting decision tree algorithm uses a second-order derivative optimization algorithm to fit a decision tree through negative gradient iteration and minimizing a pre-constructed progressive constraint loss function. In the leaf node region of the decision tree, calculate the optimal prediction value based on Newton's method and the Hessian matrix, and dynamically adjust the learning rate based on the convergence speed of the loss function, and output a credit assessment score; Based on the credit assessment score, set different transaction quotas and credit thresholds for the buyers and sellers within the power battery trading group.
[0007] In an alternative embodiment, Input the enhanced feature vector into a gradient boosting decision tree algorithm. The gradient boosting decision tree algorithm uses a second-order derivative optimization algorithm to fit a decision tree through negative gradient iteration and minimizing a pre-constructed progressive constraint loss function. Calculating the optimal prediction value based on Newton's method and the Hessian matrix in the leaf node region of the decision tree includes: Construct a hierarchical feature enhancement network to enhance the input feature vector through a basic feature layer, an interaction feature layer, and a fusion feature layer. Calculate the statistical distribution information of the original features in the basic feature layer, generate a feature interaction matrix based on the statistical distribution information and extract the high-order association patterns between features in the interaction feature layer, and adaptively fuse the statistical distribution information and the high-order association patterns in the fusion feature layer to output an enhanced feature vector; Construct a prediction objective function based on the enhanced feature vector, perform first-order and second-order Taylor expansions on the prediction objective function to obtain the gradient information and Hessian matrix of the objective function, construct a regularization loss function for the prediction objective according to the gradient information and Hessian matrix, dynamically adjust the regularization strength of the regularization loss function according to the statistical distribution information to obtain an adaptive regularization loss term, calculate a feature association consistency score based on the feature interaction matrix to obtain a feature association constraint term, and combine the gradient information of the objective function, the adaptive regularization loss term, and the feature association constraint term to form a progressive constraint loss function; Input the enhanced feature vector into the gradient boosting decision tree algorithm, use the second-order derivative optimization algorithm to calculate the first-order derivative of the objective function to obtain the negative gradient direction, calculate the second-order derivative of the objective function and construct a Hessian matrix, and reconstruct the feature gradient in combination with the feature interaction matrix to obtain a feature association-aware gradient; Calculate the data density and distribution offset degree of the candidate split points based on the statistical distribution information and combine them with the feature association-aware gradient to construct a distribution-aware split criterion, and select the optimal split point according to the distribution-aware split criterion to perform node splitting to construct a decision tree; In the leaf node region of the decision tree, calculate the second-order partial derivatives between feature pairs based on the feature interaction matrix to construct a second-order Hessian matrix, generate a feature association tensor based on the high-order association pattern, calculate the local distribution covariance in combination with the statistical distribution information, and use the Newton method to optimize and calculate the second-order Hessian matrix and the local distribution covariance to minimize the progressive constraint loss function to obtain the optimal prediction value considering feature association.
[0008] In an optional implementation manner, Construct a spatio-temporal association graph based on the electricity demand curve and historical transaction data, use the graph attention algorithm to extract the electricity demand dependence relationship between regions, model the time series features in combination with a recurrent neural network, and output the optimal trading price intervals for each trading group in the next 24 hours by time period. The risk-controlled trading matching strategy generated according to the optimal trading price interval and the credit threshold includes: Construct the electricity demand curve obtained in advance into an electricity demand matrix, extract the transaction price, transaction volume, default situation, electricity consumption fluctuation, and peak-valley electricity consumption characteristics in the historical transaction data to construct a transaction feature matrix, and construct the adjacency matrix of the spatio-temporal association graph based on the geographical distance attenuation coefficient and electricity consumption pattern similarity between trading groups; The eigenvectors of the nodes in the spatio-temporal correlation graph are linearly transformed to obtain query vectors, key vectors, and value vectors. The inner product of the query vectors and the key vectors is calculated and normalized to obtain an attention weight matrix. The attention weight matrix is multiplied by the value vectors to obtain weighted features. Multiple groups of weighted features are concatenated and non-linearly transformed to obtain the electricity demand dependence relationship; The electricity demand dependence relationship is input into a recurrent neural network. The fusion ratio of historical state information and current input information is controlled by a reset gate and an update gate. The reset historical state and the current input are non-linearly transformed to obtain a candidate state, and adaptive fusion is performed based on the update gate to obtain time series features; Feature fusion is performed on the time series features and the historical price series to obtain price prediction features. A mixed probability distribution model including a Gaussian distribution and a skewed distribution is constructed based on the price prediction features. Iterative optimization is performed through the expectation-maximization algorithm to determine the optimal number of distributions, and the determined multiple probability distributions are weighted and combined to obtain the conditional probability distribution of the price; The quantile of the specified confidence interval is calculated based on the conditional probability distribution to obtain the optimal trading price interval. The default probability is calculated based on the credit score of the trading group and compared with the credit threshold to determine the overlap of the price intervals of the trading groups that meet the credit constraints, and a risk-controlled trading matching strategy is output.
[0009] In an alternative embodiment, According to the differentiated trading quota, the optimal trading price interval, and the trading matching strategy, while considering maximizing trading revenue and minimizing grid dispatching costs, an improved particle swarm algorithm is used for optimization calculation to obtain a charging and discharging scheduling instruction including charging and discharging time periods, charging and discharging power, and target electricity quantity. Issuing the charging and discharging scheduling instruction and performing trading settlement includes: Construct a charging and discharging scheduling instruction vector, which includes charging and discharging time periods, charging and discharging power, and target electricity quantity. Calculate the difference between trading revenue and grid dispatching costs based on the charging and discharging power, and construct an objective function for maximizing trading revenue by combining battery loss costs. Calculate the power regulation cost and the power fluctuation cost based on the charging and discharging power, and construct an objective function for minimizing grid dispatching costs with the power regulation cost and the power fluctuation cost; Taking the objective function for maximizing trading revenue and the objective function for minimizing grid dispatching costs as optimization objectives, constraint conditions are imposed on the charging and discharging scheduling instruction vector. Among them, the constraint conditions include a quota constraint for limiting the sum of the absolute values of the charging and discharging power based on the differentiated trading quota, a price interval constraint for limiting the trading price based on the optimal trading price interval, and an operating constraint for limiting the charging and discharging power and the state of charge based on the trading matching strategy; Encode the charge-discharge scheduling instruction vector with constraints as the particle positions in the particle swarm, adaptively adjust the inertia weight coefficient based on the current iteration progress, dynamically update the learning factors according to the particle fitness differences, update the particle velocities using the inertia weight coefficient and the dynamic learning factors, and apply the non-linear perturbation generated by the chaotic mapping to the particle position update process to obtain the updated particle swarm; Evaluate the updated particle swarm, perform non-dominated sorting on the particles using the fast hierarchical method of dominance counting to obtain particle layers of different ranks, calculate the crowding degree of the particles based on the normalized distance of the objective function values within the particle layers of the same rank, and combine the non-dominated sorting result and the crowding degree calculation result to generate the optimal solution set; Based on the preset decision preference weights, comprehensively evaluate the solutions in the optimal solution set, select the solution with the optimal comprehensive evaluation value as the final charge-discharge scheduling instruction, extract the charge-discharge time period, charge-discharge power, and target power parameter according to the charge-discharge scheduling instruction, and issue the charge-discharge scheduling instruction and execute the transaction settlement.
[0010] In an alternative embodiment, Adapting the inertia weight coefficient based on the current iteration progress, dynamically updating the learning factors according to the particle fitness differences, updating the particle velocities using the inertia weight coefficient and the dynamic learning factors, and applying the non-linear perturbation generated by the chaotic mapping to the particle position update process to obtain the updated particle swarm includes: For the current particle swarm, calculate the particle swarm diversity index, obtain the aggregation degree of the particle swarm at the current iteration progress based on the first Euclidean distance between each particle in the particle swarm and the average position of the particle swarm, dynamically adjust the inertia weight base value through a non-linear function according to the aggregation degree of the particle swarm, and increase the inertia weight parameter when the aggregation degree of the particle swarm decreases; Calculate the second Euclidean distance between each particle in the particle swarm and the global optimal solution, and adaptively adjust the particle fitness differences based on the second Euclidean distance using an exponential function, where the particle fitness differences dynamically adjust the cognitive term parameter and the social term parameter with the change of the second Euclidean distance, the cognitive term parameter increases with the increase of the second Euclidean distance, and the social term parameter decreases with the increase of the second Euclidean distance; Combine the Logistic mapping and the tent mapping to generate a chaotic sequence, where the weight coefficient of the chaotic sequence linearly decays with the iteration, and map the chaotic sequence to the boundary range of the particle swarm search space to form a non-linear perturbation term; Select the particle with the highest fitness from the particle swarm as the high-quality particle, and apply a local search perturbation based on the random difference vector to the high-quality particle to obtain a candidate solution, where the random difference vector is composed of the product of the difference between the positions of two randomly selected particles in the particle swarm and the adaptive search radius; Calculate the distribution entropy based on the fitness distribution of each particle in the particle swarm, dynamically adjust the structural characteristics of the particle swarm according to the magnitude of the distribution entropy, adopt the structural characteristics of global transfer when the distribution entropy is greater than the preset distribution entropy threshold, adopt the structural characteristics of local transfer when the distribution entropy is less than the preset distribution entropy threshold, and adaptively adjust the transfer probability between particles; Apply the inertia weight parameter, dynamic learning factor, non-linear perturbation term, local search result and structural characteristics to the position and velocity update process of the particle swarm to obtain the updated particle swarm.
[0011] In the second aspect of the embodiments of the present invention, there is provided a distributed power battery energy trading and scheduling system for an intelligent power grid, including: A first unit, configured to collect intelligent power grid load distribution data and real-time state information of distributed power batteries, calculate the power consumption demand curve of each region according to the intelligent power grid load distribution data, where the real-time state information includes the remaining battery power, charge and discharge power, and geographical location information, and divide the power batteries into multiple power battery trading groups according to the charge and discharge power, remaining battery power, and geographical location based on the real-time state information and the power consumption demand curve; A second unit, configured to construct a federated learning node network based on the power battery trading groups, input the historical response time, battery health status, and transaction completion rate of the buyer and seller as operation data into a pre-trained multi-layer neural network for feature extraction, calculate a credit assessment score using the gradient boosting decision tree algorithm, and set different transaction quotas and credit thresholds for the buyer and seller within the power battery trading group based on the credit assessment score; A third unit, configured to construct a spatio-temporal association graph based on the power consumption demand curve and historical transaction data, extract the power demand dependence relationship between regions using the graph attention algorithm, model the time series features in combination with a recurrent neural network, output the optimal transaction price interval for each trading group in the next 24 hours by time period, and generate a risk-controlled transaction matching strategy according to the optimal transaction price interval and the credit threshold; A fourth unit, configured to optimize and calculate a charge and discharge scheduling instruction including the charge and discharge time period, charge and discharge power, and target power according to the different transaction quotas, optimal transaction price interval, and transaction matching strategy, while considering maximizing transaction revenue and minimizing grid scheduling costs, issue the charge and discharge scheduling instruction and perform transaction settlement.
[0012] In the third aspect of the embodiments of the present invention, There is provided an electronic device, including: A processor; A memory for storing instructions executable by the processor; Wherein, the processor is configured to call the instructions stored in the memory to execute the method described above.
[0013] In the fourth aspect of the embodiments of the present invention, a computer-readable storage medium is provided, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the method described above is implemented.
[0014] In the present invention, by constructing a federated learning node network and a credit assessment mechanism, accurate matching and risk control of power battery transactions are achieved, effectively improving the transaction success rate and system security, reducing the economic losses caused by transaction failures, using a spatio-temporal correlation graph and a graph attention algorithm to capture the power demand dependence relationship between regions, and combining a recurrent neural network to model the time series features, the optimal transaction price interval for each time period can be accurately predicted, improving the price prediction accuracy and enhancing the decision-making confidence of both trading parties. An improved particle swarm algorithm is used to simultaneously consider maximizing transaction benefits and minimizing grid dispatching costs, generating charge and discharge scheduling instructions that take into account both economic benefits and grid stability. While improving the utilization rate of distributed power battery resources, it effectively suppresses grid load fluctuations and improves the operating efficiency and reliability of the smart grid. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 is a schematic flow chart of the distributed power battery energy trading and scheduling method of the smart grid according to the embodiments of the present invention; Figure 2 is a comparison chart of the feature processing accuracy rates corresponding to the distributed power battery energy trading and scheduling method of the smart grid according to the embodiments of the present invention; Figure 3 is a multi-scenario performance evaluation radar chart corresponding to the distributed power battery energy trading and scheduling method of the smart grid according to the embodiments of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0016] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0017] The technical solutions of the present invention will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.
[0018] Figure 1This is a schematic flowchart of the distributed power battery energy trading and scheduling method for the smart grid in the embodiment of the present invention. As Figure 1 shown, the method includes: Collect the smart grid load distribution data and the real-time status information of distributed power batteries. Calculate the power consumption demand curves of each region according to the smart grid load distribution data. The real-time status information includes the remaining battery power, charging and discharging power, and geographical location information. Based on the real-time status information and the power consumption demand curves, divide the power batteries into multiple power battery trading groups according to the charging and discharging power, remaining battery power, and geographical location; Construct a federated learning node network based on the power battery trading groups. Take the historical response time, battery health status, and transaction completion rate of both the buyer and the seller as operation data and input them into a pre-trained multi-layer neural network for feature extraction. Use the gradient boosting decision tree algorithm to calculate the credit evaluation score. Set different transaction quotas and credit thresholds for the buyer and the seller within the power battery trading group based on the credit evaluation score; Construct a spatio-temporal correlation graph based on the power consumption demand curves and historical transaction data. Use the graph attention algorithm to extract the power demand dependency relationships between regions. Combine with a recurrent neural network to model the time series features. Output the optimal transaction price intervals for each trading group in the next 24 hours by time period. Generate a risk-controlled transaction matching strategy according to the optimal transaction price intervals and credit thresholds; According to the different transaction quotas, optimal transaction price intervals, and transaction matching strategies, while considering maximizing transaction benefits and minimizing grid scheduling costs, use an improved particle swarm optimization algorithm to optimize and calculate the charging and discharging scheduling instructions including the charging and discharging time periods, charging and discharging power, and target power. Issue the charging and discharging scheduling instructions and perform transaction settlement.
[0019] In an alternative embodiment, Collect the smart grid load distribution data and the real-time status information of distributed power batteries. Calculate the power consumption demand curves of each region according to the smart grid load distribution data. The real-time status information includes the remaining battery power, charging and discharging power, and geographical location information. Divide the power batteries into multiple power battery trading groups according to the charging and discharging power, remaining battery power, and geographical location includes: Collect the smart grid load distribution data, including the real-time load rate of regional distribution transformers, historical power consumption load curves, and time-of-use electricity price information. According to the smart grid load distribution data, use a method combining Fourier series decomposition and wavelet transform to perform periodic analysis and trend extraction on the historical power consumption load curves, and calculate the power consumption demand curves of each region in the next 24 hours by time period; Obtain the real-time status information of distributed power batteries. The real-time status information includes the remaining battery power, charge and discharge power, and geographical location information. Among them, the charge and discharge power includes the maximum charging power, maximum discharge power, and charge and discharge efficiency. Calculate the electricity that can be used for participating in electricity trading according to the remaining battery power and charge and discharge efficiency; Based on the electricity demand curve and real-time status information, calculate the geographical distance and transmission loss between the power battery and each regional load center. Combining the matching degree between the tradable electricity of the power battery and the regional electricity demand, use an improved hierarchical clustering algorithm to adaptively group the power batteries. Among them, the deviation of the charge and discharge characteristics of the power batteries within the same group does not exceed 5%, and the geographical location distribution does not exceed the preset maximum grouping distance, and the number of groups is dynamically adjusted according to real-time trading requirements.
[0020] Collect the load distribution data of the smart grid, including the real-time load rate of regional distribution transformers, historical electricity load curves, and time-of-use electricity price information. Taking Area A of a certain city as an example, collect the real-time load rate data of 10 distribution transformer nodes in this area, collect it once every 5 minutes, and record the historical load rate data of the most recent 7 days. At the same time, obtain the time-of-use electricity price information of this area. For example, the electricity price during peak hours (10:00 - 15:00, 18:00 - 21:00) is 1.2 yuan / kWh, the electricity price during normal hours (7:00 - 10:00, 15:00 - 18:00, 21:00 - 23:00) is 0.8 yuan / kWh, and the electricity price during valley hours (23:00 - 7:00 the next day) is 0.4 yuan / kWh.
[0021] Conduct periodic analysis and trend extraction on the historical electricity load curve. First, use the Fourier series decomposition method to decompose the historical load curve into multiple frequency components, and extract the daily cycle, weekly cycle, and seasonal cycle characteristics. For example, for the No. 1 transformer node in Area A, through analysis, it is found that the load peaks on weekdays appear at 9:00 - 11:00 and 19:00 - 21:00, and the load peaks on weekends are mainly concentrated at 10:00 - 14:00. Then, use the wavelet transform method to conduct multi-scale analysis on the load curve, and separate the trend term, cycle term, and random term. Through the analysis of wavelet coefficients, identify the mutation points and outliers in the load curve, such as the sudden increase in electricity load under special weather conditions.
[0022] Based on the analysis results, combined with external factors such as weather forecast data, holiday information, and regional activity arrangements, calculate the sub-period electricity demand curves for the next 24 hours in each region. For example, predict that the electricity demand of the No. 1 transformer node in Area A from 7:00 to 8:00 the next day is 320 kW, and from 8:00 to 9:00 is 450 kW, and so on to complete the prediction for 24 hours of the whole day.
[0023] Obtain real-time status information of distributed power batteries. Taking electric vehicles in the city as an example, the battery status information of electric vehicles is collected in real time through the vehicle networking platform, including: remaining battery power (SOC), maximum charging power, maximum discharging power, charge and discharge efficiency, and GPS positioning information. For example, for the electric vehicle numbered EV001, the current SOC is 75%, the battery capacity is 60 kWh, the maximum charging power is 7 kW, the maximum discharging power is 10 kW, the charging efficiency is 92%, the discharging efficiency is 95%, and the current location is longitude 116.3° and latitude 39.9°.
[0024] Calculate the electricity that can be used for participating in electricity trading based on the remaining battery power and charge and discharge efficiency. For the electric vehicle numbered EV001, considering that the minimum SOC set by the owner is 20%, the available discharging electricity is (75% - 20%) × 60 kWh × 95% = 31.35 kWh; if the owner plans to charge to 90%, the available charging electricity is (90% - 75%) × 60 kWh ÷ 92% = 9.78 kWh.
[0025] Based on the electricity demand curve and the real-time status information of the power battery, divide the power battery trading groups. Calculate the geographical distance and transmission loss between the power battery and each regional load center. Taking the No. 1 transformer in Area A as an example, its location is longitude 116.32° and latitude 39.91°, and the distance from the electric vehicle numbered EV001 is about 2.5 kilometers. Calculated according to the transmission loss rate of 0.5% per kilometer, the expected transmission loss is 1.25%.
[0026] Evaluate the matching degree between the tradable electricity of the power battery and the regional electricity demand. For example, during the predicted peak electricity consumption period from 19:00 to 21:00, the load rate of the No. 1 transformer in Area A reaches 85% and additional power supply support is needed. The discharging power and electricity that EV001 can provide can meet part of the demand, and the matching degree score is 85 points (out of 100).
[0027] Use an improved hierarchical clustering algorithm to adaptively group the power batteries. First, set the clustering parameters: the deviation of the charge and discharge characteristics of the power batteries within the same group does not exceed 5%, and the geographical location distribution does not exceed the preset maximum grouping distance (such as 5 kilometers). Taking Area A as an example, the initial number of groups is set to 5, and through a bottom-up hierarchical clustering process, similar power batteries are gradually merged.
[0028] During the clustering process, similarity metrics between power batteries are defined, including: charging and discharging power similarity, SOC level similarity, geographical proximity, and overlapping available time periods. For example, for electric vehicles numbered EV001 and EV008, the maximum discharging powers are 10kW and 9.5kW respectively (with a 5% deviation), the SOCs are 75% and 72% respectively (with a 4% deviation), the geographical distance is 1.2 kilometers, and both can participate in discharging during the period from 18:00 to 22:00. The similarity score is 92 points, so they are classified into the same group.
[0029] Dynamically adjust the number of groups according to real-time trading requirements. For example, during peak electricity consumption periods, the system detects that the load rates of multiple transformers in Area A exceed 90%. At this time, the number of discharging groups is increased to 8 to provide more refined power support; while during off-peak electricity consumption periods, they are merged into 3 charging groups to centrally arrange charging plans.
[0030] Form dynamically adjusted power battery trading groups. Taking the time period of 19:00 on a certain day as an example, 3 discharging groups and 2 charging groups are formed in Area A: Discharging Group 1 contains 15 electric vehicles with a total available discharging power of 145kW, mainly supporting Transformers 1 and 2; Discharging Group 2 contains 12 electric vehicles with a total available discharging power of 118kW, mainly supporting Transformers 3 and 4; Discharging Group 3 contains 18 electric vehicles with a total available discharging power of 172kW, mainly supporting Transformers 5 to 7; Charging Groups 1 and 2 are respectively arranged to charge in areas with lower loads on Transformers 8 to 10.
[0031] In this embodiment, multiple periodic features in the load curve are identified through Fourier series decomposition method, and multi-scale analysis is carried out using wavelet transform to effectively separate the trend term, periodic term, and random term, which can accurately grasp the regional electricity consumption law, improve the accuracy of load prediction, group power batteries using an improved hierarchical clustering algorithm, and ensure the homogeneity of power batteries within the same group by setting the deviation threshold of charging and discharging characteristics and the maximum grouping distance limit, improving the accuracy and efficiency of group scheduling. Through reasonable group division and dynamic adjustment, the optimal allocation of electric energy in the time and space dimensions is achieved, effectively improving the operation efficiency and reliability of the distribution network.
[0032] In an alternative implementation Based on the power battery trading group, construct a federated learning node network. Input the historical response time, battery health status, and transaction completion rate of both buyers and sellers as operation data into a pre-trained multi-layer neural network for feature extraction, calculate the credit assessment score using the gradient boosting decision tree algorithm, and set differentiated trading quotas and credit thresholds for both buyers and sellers within the power battery trading group, including: Construct a federated learning node network based on the power battery trading group, taking the buyers and sellers in the power battery trading group as independent federated learning nodes. The federated learning nodes maintain historical response time, battery health status, and transaction completion rate. The battery health status includes capacity retention rate, internal resistance growth rate, and voltage consistency. Perform normalization and standardization preprocessing on the historical response time, the battery health status, and the transaction completion rate. Use a sliding time window to segment and sample the preprocessed data to generate a training sample set, and form the running data with the training sample set. Input the running data into a pre-trained multi-layer neural network for feature extraction. The multi-layer neural network consists of an input layer, a first hidden layer, a second hidden layer, a third hidden layer, and an output layer. The first hidden layer, the second hidden layer, and the third hidden layer use a rectified linear unit activation function with a random inactivation mechanism. The output layer generates a feature vector, and construct a multi-objective loss function based on the Euclidean distance between the feature vector and the target feature vector and the one-norm of the network weights. Execute federated average training in the federated learning node network. Each federated learning node calculates local gradients based on local data, encrypts the local gradients using a differential privacy mechanism, and transmits the encrypted local gradients to the aggregation server. The aggregation server performs weighted averaging on the local gradients according to the sample quantity and data quality score of each federated learning node to obtain global gradients, and updates the global model parameters based on the global gradients. Enhance the feature vector and then input it into the gradient boosting decision tree algorithm. The gradient boosting decision tree algorithm uses a second-order derivative optimization algorithm, fits decision trees through negative gradient iteration and minimizing a pre-constructed progressive constraint loss function. In the leaf node region of the decision tree, calculate the optimal prediction value based on Newton's method and the Hessian matrix, and dynamically adjust the learning rate based on the convergence speed of the loss function, and output the credit evaluation score. Based on the credit evaluation score, set different transaction quotas and credit thresholds for the buyers and sellers within the power battery trading group.
[0033] Construct a federated learning node network based on the power battery trading group. In practical applications, a certain battery trading platform includes 100 trading entities, and each entity serves as an independent federated learning node, maintaining its own historical response time, battery health status, and transaction completion rate data. Among them, the battery health status specifically includes three indicators: capacity retention rate, internal resistance growth rate, and voltage consistency. For example, node A records its transaction data in the past 90 days: the average response time is 2.5 hours, the capacity retention rate is 92%, the internal resistance growth rate is 5%, the voltage consistency is 98%, and the transaction completion rate is 95%.
[0034] Preprocess the original data. The system uses the min-max normalization method to map each index to the interval [0, 1], and then performs Z-score standardization to make the data have a mean of 0 and a standard deviation of 1. For example, the response time of node A, which is 2.5 hours, becomes 0.25 after normalization (assuming the maximum value is 10 hours and the minimum value is 0 hours), and may become -0.8 after standardization (indicating faster than the average level). The system adopts a sliding window mechanism with a window length of 30 days and a step size of 5 days to generate 12 training samples from 90 days of data to form the operation data of node A.
[0035] Input the preprocessed operation data into a pre-trained multi-layer neural network for feature extraction. The network includes an input layer (15 neurons, corresponding to the 3-day average of 5 indicators), a first hidden layer (64 neurons), a second hidden layer (32 neurons), a third hidden layer (16 neurons), and an output layer (8 neurons, generating an 8-dimensional feature vector). Each hidden layer uses the ReLU activation function with a 25% random inactivation rate to prevent overfitting. For example, a piece of data of node A may generate a feature vector [0.72, 0.85, 0.63, 0.91, 0.77, 0.82, 0.69, 0.88] after being processed by the network. The system constructs a multi-objective loss function by calculating the Euclidean distance between this feature vector and a preset high-credit target feature vector [0.9, 0.9, 0.8, 0.95, 0.85, 0.9, 0.8, 0.95] and combining the first norm of the network weights.
[0036] In the federated learning training stage, each node calculates the local gradient using local data. To protect data privacy, the system adds noise that follows a Laplace distribution (mean of 0, scale parameter of 0.1) to the local gradient to achieve differential privacy protection. For example, a certain parameter gradient value of 0.35 calculated by node A may become 0.32 after adding noise. Each node transmits the encrypted local gradient to the aggregation server. The aggregation server performs weighted averaging based on the sample quantity and data quality score of each node. For example, if the sample number of node A is 100 and the quality score is 0.9, the weight may be 0.045. The aggregation server aggregates the weighted gradients of all nodes to obtain the global gradient, and then updates the global model parameters accordingly and distributes the updated model to each node.
[0037] After feature extraction is completed, the system performs enhancement processing on the feature vector, concatenating the original feature vector with its historical mean, variance, maximum value, and minimum value to form an extended feature vector. For example, the 8-dimensional feature vector of node A is extended to a 40-dimensional feature vector. The enhanced feature vector is input into the gradient boosting decision tree algorithm for credit assessment.
[0038] Using the XGBoost framework and the second-order derivative optimization algorithm, 100 decision trees with a maximum depth of 5 are constructed. Through the negative gradient iteration method, the logarithmic likelihood loss function is minimized. In the leaf node region of the decision tree, the optimal prediction value is calculated based on Newton's method and the Hessian matrix. The initial learning rate is set to 0.1 and adjusted dynamically according to the convergence rate of the loss function. When the loss reduction in 5 consecutive iterations is less than 0.01%, the learning rate is reduced to 0.8 times the original. Finally, a credit assessment score between 0 and 100 is output. For example, the credit assessment score of node A is 87.5.
[0039] Differentiated trading quotas and credit thresholds are set based on the credit assessment score. Among them, for users with a credit score of 90 - 100, the single-day trading quota is unlimited, and the minimum credit threshold for trading counterparts is 60; for users with a credit score of 80 - 89, the single-day trading quota is 1 million yuan, and the minimum credit threshold for trading counterparts is 65; for users with a credit score of 70 - 79, the single-day trading quota is 500,000 yuan, and the minimum credit threshold for trading counterparts is 70; for users with a credit score of 60 - 69, the single-day trading quota is 200,000 yuan, and the minimum credit threshold for trading counterparts is 75; for users with a credit score below 60, the single-day trading quota is 50,000 yuan, and the minimum credit threshold for trading counterparts is 80.
[0040] In this embodiment, a sliding window mechanism is used for data sampling, which not only retains the time series characteristics of historical trading behaviors but also can timely reflect the dynamic changes in the credit status of trading entities. Based on the combination of the federated learning architecture and the differential privacy mechanism, the secure sharing of trading data is achieved. By adding Laplace noise to the local gradient, while protecting the privacy of individual data, the effectiveness of model training is ensured. Through the combined application of feature enhancement and the gradient boosting decision tree algorithm, accurate credit scoring is achieved. The differentiated trading quota and credit threshold system effectively balances the relationship between trading activity and risk control, provides reasonable trading permissions for trading entities with different credit levels, and significantly improves the security and reliability of the entire trading system.
[0041] In an alternative embodiment, After enhancing the feature vector, it is input into the gradient boosting decision tree algorithm. The gradient boosting decision tree algorithm uses the second-order derivative optimization algorithm and fits the decision tree through negative gradient iteration and minimizing a pre-constructed progressive constraint loss function. In the leaf node region of the decision tree, the optimal prediction value calculated based on Newton's method and the Hessian matrix includes: Construct a hierarchical feature enhancement network to enhance the input feature vector through a basic feature layer, an interaction feature layer, and a fusion feature layer. Calculate the statistical distribution information of the original features in the basic feature layer, generate a feature interaction matrix based on the statistical distribution information and extract the high-order correlation patterns between features in the interaction feature layer, and adaptively fuse the statistical distribution information and the high-order correlation patterns in the fusion feature layer to output an enhanced feature vector; Construct a prediction objective function based on the enhanced feature vector, perform first-order and second-order Taylor expansions on the prediction objective function to obtain the gradient information and Hessian matrix of the objective function, construct a regularization loss function for the prediction objective according to the gradient information and Hessian matrix, dynamically adjust the regularization strength of the regularization loss function according to the statistical distribution information to obtain an adaptive regularization loss term, calculate the feature correlation consistency score based on the feature interaction matrix to obtain a feature correlation constraint term, and combine the gradient information of the objective function, the adaptive regularization loss term, and the feature correlation constraint term to form a progressive constraint loss function; Input the enhanced feature vector into the gradient boosting decision tree algorithm, use the second derivative optimization algorithm to calculate the first derivative of the objective function to obtain the negative gradient direction, calculate the second derivative of the objective function and construct the Hessian matrix, and reconstruct the feature gradient in combination with the feature interaction matrix to obtain a feature correlation-aware gradient; Calculate the data density and distribution offset degree of the candidate split points based on the statistical distribution information and combine them with the feature correlation-aware gradient to construct a distribution-aware split criterion, and select the optimal split point according to the distribution-aware split criterion to perform node splitting to construct a decision tree; In the leaf node region of the decision tree, calculate the second-order partial derivatives between feature pairs based on the feature interaction matrix to construct a second-order Hessian matrix, generate a feature correlation tensor based on the high-order correlation pattern, calculate the local distribution covariance in combination with the statistical distribution information, and use the Newton method to optimize and calculate the second-order Hessian matrix and the local distribution covariance to minimize the progressive constraint loss function to obtain the optimal prediction value considering feature correlation.
[0042] Construct a hierarchical feature enhancement network, which includes a basic feature layer, an interaction feature layer, and a fusion feature layer. In the basic feature layer, perform statistical analysis on the input feature vector, and calculate the statistical distribution information such as the mean, variance, and quantiles of each feature. For example, for a vector containing features such as user age, consumption frequency, and browsing duration, calculate the mean age feature to be 32.5, the variance to be 8.7, the 25% quantile to be 26, and the 75% quantile to be 39; the mean consumption frequency is 5.2 times per month, the variance is 2.3, and the skewness is 0.8; the mean browsing duration is 45 minutes per day, and the standard deviation is 15 minutes.
[0043] At the interactive feature layer, a feature interaction matrix is generated based on statistical distribution information. The specific implementation is as follows: Calculate the correlation coefficients between feature pairs. For example, the correlation coefficient between age and consumption frequency is 0.35, the correlation coefficient between age and browsing duration is -0.28, and the correlation coefficient between consumption frequency and browsing duration is 0.62. Then, construct a feature interaction matrix based on the correlation coefficients and extract the high-order association patterns between features through a deep cross network. For example, identify the high-order association pattern that "users aged 25 - 35 with a browsing duration greater than 60 minutes usually have a consumption frequency 1.5 times higher than the average".
[0044] At the fused feature layer, an attention mechanism is used to adaptively fuse the statistical distribution information and high-order association patterns. Weights are assigned to each feature. For example, the weight of the age feature is 0.25, the weight of the consumption frequency feature is 0.40, and the weight of the browsing duration feature is 0.35. Weights are also assigned to the high-order association patterns. For example, the weight of the "age - browsing duration - consumption frequency" association pattern is 0.55. Through weighted fusion, an enhanced feature vector is output, and its dimension is expanded from the original n-dimensional to 2n-dimensional.
[0045] Construct a prediction objective function based on the enhanced feature vector. Perform first-order and second-order Taylor expansions on the prediction objective function to obtain the gradient information and Hessian matrix of the objective function. For example, for a binary classification problem, the objective function is the logarithmic loss function, and the calculated first-order gradient value is 0.28 and the second-order gradient value is 0.15. Construct a regularized loss function for the prediction target based on the gradient information and Hessian matrix, and set the initial regularization coefficient to 0.1.
[0046] Dynamically adjust the regularization strength of the regularized loss function according to the statistical distribution information. For features with a large variance (such as browsing duration), adjust the regularization coefficient to 0.08. For features with a skewed distribution (such as consumption frequency), adjust the regularization coefficient to 0.12 to obtain an adaptive regularized loss term. Calculate the feature association consistency score based on the feature interaction matrix. For example, the association consistency score between age and consumption frequency is 0.78 to obtain a feature association constraint term. Combine the gradient information of the objective function, the adaptive regularized loss term, and the feature association constraint term to form a progressive constraint loss function.
[0047] Input the enhanced feature vector into the gradient boosting decision tree algorithm. Use the second derivative optimization algorithm to calculate the first derivative of the objective function to obtain the negative gradient direction. For example, for sample 1, the negative gradient direction is -0.35. Calculate the second derivative of the objective function and construct the Hessian matrix. For example, for sample 1, the second derivative value is 0.22. Reconstruct the feature gradient in combination with the feature interaction matrix, and perform weighted combination on the gradient information of high-correlation feature pairs to obtain a feature association-aware gradient. For example, the association-aware gradient of the consumption frequency feature is adjusted from -0.35 to -0.42.
[0048] Calculate the data density and distribution offset degree of candidate split points based on statistical distribution information. For example, for the candidate split point with the age feature value of 30, the data density is 0.15 and the distribution offset degree is 0.08; combine it with the feature-correlation-aware gradient to construct a distribution-aware split criterion, and calculate the split gain as 0.28. Select the optimal split point according to the distribution-aware split criterion for node splitting to construct a decision tree. For example, select the split point with the age feature value of 32, and the split gain is 0.35, which is greater than other candidate split points.
[0049] In the leaf node region of the decision tree, calculate the second-order partial derivatives between feature pairs based on the feature interaction matrix to construct a second-order Hessian matrix. For example, the second-order partial derivative of the age and consumption frequency feature pair is 0.18, and a 3×3 second-order Hessian matrix is constructed. Generate a feature-correlation tensor based on the high-order correlation pattern. For example, the third-order correlation strength is 0.42. Combine the statistical distribution information to calculate the local distribution covariance. For example, the local covariance between age and consumption frequency in leaf node 1 is 0.25.
[0050] Use the Newton method to optimize and calculate the second-order Hessian matrix and the local distribution covariance. Set the initial step size to 0.1, and it converges after 5 iterations, minimizing the progressive constraint loss function. Finally, obtain the optimal prediction values considering feature correlation in leaf node 1 as 0.78, in leaf node 2 as 0.23, and in leaf node 3 as 0.45.
[0051] In this embodiment, the gradient information is adjusted through the feature interaction matrix, enabling node splitting to simultaneously consider the comprehensive influence of multiple related features. A distribution-aware split criterion is proposed, taking into account the data density and distribution offset information of features, improving the accuracy of split point selection. In the calculation of leaf node prediction values, by constructing a second-order Hessian matrix containing feature-correlation information and optimizing it in combination with the local distribution covariance, an accurate modeling of the sample distribution characteristics in the leaf node region is achieved; In the prior art, feature engineering usually adopts simple feature combinations or statistical feature extraction methods, which are difficult to fully explore the complex correlation relationships between features and cannot adapt to the dynamic changes of feature distributions. At the same time, traditional decision tree algorithms only consider the information gain of a single feature during node splitting, ignoring the interaction effects between features, resulting in limited model prediction accuracy. In addition, the prior art mostly uses simple averaging or linear regression methods when calculating leaf node prediction values, failing to fully utilize the local distribution characteristics of features and affecting the local prediction ability of the model; In the process of constructing the decision tree in this embodiment, the quality of node splitting is improved through the feature correlation perception mechanism, and the model's recognition ability of feature combination patterns is enhanced. In the leaf node prediction stage, the optimization calculation based on the distribution characteristics improves the local prediction accuracy of the model, significantly enhances the effect of feature engineering, enables the model to adaptively capture the complex correlation relationships between features, and while maintaining the interpretability of the model, significantly improves the prediction accuracy and has stronger feature adaptability and robustness.
[0052] Figure 2 This is a comparison chart of the feature processing accuracy rates corresponding to the distributed power battery energy trading and scheduling method of the smart grid in the embodiment of the present invention. As Figure 2 shown, the scatter line chart comprehensively shows the comparison of the prediction accuracy rates of this technical solution and three mainstream gradient boosting decision tree algorithms (XGBoost, LightGBM, and CatBoost) under different training sample scales. As the sample size increases from 1,000 to 50,000, this technical solution always maintains a significant leading advantage. When the sample size is 1,000, the accuracy rate of this technical solution is 71.2%, while that of XGBoost is 69.5%, LightGBM is 68.8%, and CatBoost is 70.0%; when the sample size is 5,000, the accuracy rate of this technical solution increases to 83.2%, far higher than 79.8% of XGBoost, 78.8% of LightGBM, and 80.8% of CatBoost; when the sample size reaches 10,000, the accuracy rate of this technical solution is 88.6%, while the other three algorithms are 84.5%, 83.2%, and 85.0% respectively; when the sample size is further increased to 20,000, this technical solution reaches an accuracy rate of 92.1%, leading XGBoost's 89.0%, LightGBM's 87.8%, and CatBoost's 89.6%; finally, when the sample size reaches 50,000, the accuracy rate of this technical solution climbs to 94.7%, which is 2.2 percentage points higher than the second-highest CatBoost (92.5%), 2.5 percentage points higher than XGBoost (92.2%), and 3.7 percentage points higher than LightGBM (91.0%); The comprehensive performance advantage stems from the hierarchical feature enhancement network adopted in this technical solution. By deeply mining the input features through the basic feature layer, interaction feature layer, and fusion feature layer, and then combining the second derivative optimization algorithm and feature correlation perception gradient, accurate modeling of complex feature relationships is achieved. It can also be seen from the figure that as the sample size increases, the performance gap between this technical solution and other algorithms gradually expands, indicating that this solution has stronger scalability and generalization ability in large-scale data scenarios, and is particularly suitable for high-accuracy requirement scenarios in practical business applications, such as precision medical diagnosis, financial risk assessment, and refined marketing.
[0053] In an alternative embodiment, Based on the electricity demand curve and historical transaction data, a spatio-temporal correlation graph is constructed. The graph attention algorithm is used to extract the electricity demand dependence relationship between regions. The recurrent neural network is combined to model the time series features, and the optimal trading price intervals for each trading group in the next 24 hours are output. Generating a risk-controlled trading matching strategy according to the optimal trading price interval and the credit threshold includes: Construct the pre-acquired electricity demand curve into an electricity demand matrix, extract the transaction price, transaction times, default situation, electricity consumption fluctuation and peak-valley electricity consumption characteristics in the historical transaction data to construct a transaction feature matrix, and construct the adjacency matrix of the spatio-temporal correlation graph based on the geographical distance attenuation coefficient and electricity consumption pattern similarity between trading groups; Perform a linear transformation on the feature vectors of the nodes in the spatio-temporal correlation graph to obtain query vectors, key vectors and value vectors. Calculate the inner product of the query vector and the key vector and normalize it to obtain an attention weight matrix. Multiply the attention weight matrix by the value vector to obtain weighted features, and splice and non-linearly transform multiple groups of weighted features to obtain the electricity demand dependence relationship; Input the electricity demand dependence relationship into the recurrent neural network, control the fusion ratio of historical state information and current input information through the reset gate and update gate, perform a non-linear transformation on the reset historical state and the current input to obtain a candidate state, and perform adaptive fusion based on the update gate to obtain time series features; Perform feature fusion on the time series features and the historical price sequence to obtain price prediction features. Based on the price prediction features, construct a mixed probability distribution model including Gaussian distribution and skewed distribution, perform iterative optimization through the expectation-maximization algorithm, determine the optimal number of distributions, and perform weighted combination on the determined multiple probability distributions to obtain the conditional probability distribution of the price; Calculate the quantiles of the specified confidence interval based on the conditional probability distribution to obtain the optimal trading price interval. Calculate the default probability according to the credit score of the trading group and compare it with the credit threshold to determine the overlap of the price intervals of the trading groups that meet the credit constraints, and output a risk-controlled trading matching strategy.
[0054] Obtain the electricity demand curves and historical transaction data of each trading group. The electricity demand curve is sampled once per hour with a 24-hour cycle to form a 24-dimensional vector. For n trading groups, an n×24 electricity demand matrix D is constructed. For example, the electricity demand of a certain trading group within 24 hours may be [10.2, 9.8, 9.5, 9.3, 9.0, 9.5, 10.5, 12.3, 13.5, 14.2, 14.8, 15.0, 14.5, 14.0, 13.8, 13.5, 13.2, 13.0, 12.8, 12.5, 12.0, 11.5, 11.0, 10.5] kWh.
[0055] Extract the transaction price, number of transactions, default situation, electricity consumption fluctuation, and peak-valley electricity consumption characteristics from historical transaction data. Calculate the average value, maximum value, minimum value, and standard deviation of the transaction price over the past 30 days; count the total transaction volume over the past 30 days for the number of transactions; record the number of defaults and the proportion of default amounts within the past 90 days for the default situation; calculate the ratio of the standard deviation to the mean for the electricity consumption fluctuation; calculate the ratio of peak electricity consumption to valley electricity consumption for the peak-valley electricity consumption characteristics. These characteristics are combined to form the transaction feature matrix F.
[0056] Construct the adjacency matrix A of the spatio-temporal correlation graph. Calculate the geographical distance between transaction groups, and use the Gaussian distance attenuation function to convert the physical distance into a weight coefficient. For example, when the distance between two groups is 50 kilometers, the attenuation coefficient may be 0.85; when the distance is 100 kilometers, the attenuation coefficient may drop to 0.65. Then calculate the similarity of electricity consumption patterns, and use the cosine similarity to measure the similarity of the electricity consumption curves of two groups. Combine the distance attenuation coefficient and the similarity of electricity consumption patterns through weighting to obtain the final adjacency relationship, forming an n×n adjacency matrix A.
[0057] In the graph attention algorithm, perform three independent linear transformations on the feature vector of each node to obtain the query vector Q, key vector K, and value vector V. For example, for the feature vector h_i of node i, perform transformations through three different weight matrices W_Q, W_K, and W_V: Q_i = h_i×W_Q, K_i = h_i×W_K, V_i = h_i×W_V.
[0058] When calculating the attention weights, for node i and all its neighbor nodes j, calculate the inner product of Q_i and K_j, and use the softmax function for normalization to obtain the attention weight matrix. For example, the attention weights of node 1 for nodes 2, 3, and 4 may be [0.4, 0.35, 0.25]. Multiply the attention weights by the value vector and sum them to obtain the weighted feature of the node. To capture the dependencies in different aspects, set 8 attention heads, each head independently calculates the weighted feature, and finally splice these features and pass them through a feed-forward network to obtain the feature matrix R representing the power demand dependencies.
[0059] Input the power demand dependency R into the gated recurrent unit network. For the input x_t at time step t and the previous state h_{t - 1}, calculate the reset gate r_t and update gate z_t. The reset gate controls the degree of retention of historical information, and the update gate controls the degree of incorporation of new information. For example, during the peak electricity consumption period, the update gate value may be relatively high (such as 0.8), indicating that the current input information has a greater weight; during the stable period, the update gate value may be relatively low (such as 0.3), indicating that the historical state information has a greater weight.
[0060] The reset historical state and the current input are subjected to a non - linear transformation to obtain a candidate state. Based on the value of the update gate, the candidate state and the previous - moment state are adaptively fused to obtain the state \(h_t\) at the current moment, representing the temporal - sequence feature. For example, the temporal - sequence feature of a certain trading group at a specific moment may be a 128 - dimensional vector, capturing the time - dynamic characteristics of the electricity demand of the group.
[0061] The temporal - sequence feature \(h_t\) and the historical price sequence are subjected to feature fusion to obtain the price - prediction feature \(p_t\). Based on \(p_t\), a mixture probability - distribution model is constructed, which includes a weighted combination of multiple Gaussian distributions and skewed distributions. For example, 3 Gaussian distributions and 2 skewed distributions can be initialized to capture different distribution characteristics of prices respectively. The distribution parameters and weights are iteratively optimized by the expectation - maximization algorithm until the log - likelihood function converges or reaches the maximum number of iterations (such as 100 times).
[0062] After determining the optimal number of distributions, multiple probability distributions are weighted - combined to obtain the conditional probability distribution of prices. Based on this distribution, the upper and lower quantiles of the 90% confidence interval are calculated to obtain the optimal trading - price interval \([P_{lower}, P_{upper}]\). For example, the optimal price interval of a certain trading group from 8:00 to 9:00 in the future may be \([0.52, 0.68]\) yuan per kilowatt - hour.
[0063] The default probability is calculated according to the credit score of the trading group. The credit score is comprehensively evaluated based on factors such as historical default records, trading frequency, and amount fluctuations, and ranges from 0 to 100. When the credit score is lower than the set threshold (such as 60 points), the price interval of the group is adjusted to increase the lower limit or decrease the upper limit to control risks. For example, for a group with a credit score of 55, the original price interval \([0.52, 0.68]\) may be adjusted to \([0.55, 0.65]\).
[0064] Check the overlap of price intervals among trading groups that meet the credit constraints, find the buyer and seller with overlapping price intervals, and generate a trading - matching strategy. For example, if the price interval of seller group A is \([0.55, 0.65]\) and the price interval of buyer group B is \([0.53, 0.62]\), then the match is successful, and the recommended trading price is the mid - point 0.585 yuan per kilowatt - hour of the overlapping interval.
[0065] In this embodiment, by constructing a spatio - temporal - associated electricity - trading price - prediction system, accurate matching and pricing among trading groups are realized. By constructing the adjacency matrix of the spatio - temporal - associated graph, the geographical - distance relationship and the similarity of electricity - consumption patterns among different trading groups are effectively described, enabling the system to accurately grasp the associated characteristics among groups. By introducing a credit - scoring mechanism to dynamically adjust the price interval, the credit - risk factors of trading entities are effectively incorporated into the pricing system, ensuring the interest balance of both trading parties and increasing the possibility of transaction completion.
[0066] In an alternative embodiment, According to the differentiated trading quotas, optimal trading price ranges, and trading matching strategies, while considering maximizing trading revenue and minimizing grid dispatching costs, an improved particle swarm optimization algorithm is used to optimize and calculate the charging and discharging scheduling instructions including charging and discharging time periods, charging and discharging powers, and target electricity quantities. Issuing the charging and discharging scheduling instructions and performing transaction settlement includes: Construct a charging and discharging scheduling instruction vector, which includes charging and discharging time periods, charging and discharging powers, and target electricity quantities. Based on the charging and discharging powers, calculate the difference between trading revenue and grid dispatching costs, and construct an objective function for maximizing trading revenue in combination with battery loss costs. Calculate the power regulation cost and power fluctuation cost based on the charging and discharging powers, and construct an objective function for minimizing grid dispatching costs with the power regulation cost and power fluctuation cost; Take the objective function for maximizing trading revenue and the objective function for minimizing grid dispatching costs as optimization objectives, and impose constraint conditions on the charging and discharging scheduling instruction vector. Among them, the constraint conditions include a quota constraint for restricting the sum of the absolute values of charging and discharging powers based on differentiated trading quotas, a price range constraint for restricting trading prices based on the optimal trading price range, and an operating constraint for restricting charging and discharging powers and state of charge based on the trading matching strategy; Encode the charging and discharging scheduling instruction vector with constraint conditions as the particle positions in the particle swarm, adaptively adjust the inertia weight coefficient based on the current iteration progress, dynamically update the learning factors according to the differences in particle fitness, update the particle velocities using the inertia weight coefficient and dynamic learning factors, and apply the non-linear perturbation generated by the chaotic mapping to the particle position update process to obtain the updated particle swarm; Evaluate the updated particle swarm, perform non-dominated sorting on the particles using the fast hierarchical method of dominance counting to obtain different levels of particle layers, calculate the crowding degree of the particles based on the normalized distance of the objective function values within the same level of particle layers, and combine the non-dominated sorting results and the crowding degree calculation results to generate the optimal solution set; Based on the preset decision preference weights, comprehensively evaluate the solutions in the optimal solution set, select the solution with the optimal comprehensive evaluation value as the final charging and discharging scheduling instruction, extract the charging and discharging time periods, charging and discharging powers, and target electricity quantity parameters according to the charging and discharging scheduling instruction, and issue the charging and discharging scheduling instruction and perform transaction settlement.
[0067] Construct a charge-discharge scheduling instruction vector, which contains three key parameters: charge-discharge period, charge-discharge power, and target power. The charge-discharge period is represented as a set of time intervals \(T = \{t_1, t_2, \ldots, t_n\}\), and the duration of each period is 1 hour; the charge-discharge power is represented as a sequence of power values \(P = \{p_1, p_2, \ldots, p_n\}\), with the unit of kilowatt, where a positive value indicates discharging and a negative value indicates charging; the target power is represented as a power value \(E\), with the unit of kilowatt-hour. Based on the charge-discharge power \(P\), calculate the difference \(D = R - C\) between the trading revenue \(R\) and the grid scheduling cost \(C\). The trading revenue \(R\) is calculated by the product of the electricity trading price and the trading power. For example, if the trading price at a certain period \(t\) is 0.8 yuan per kilowatt-hour and the discharging power is 100 kilowatts, then the trading revenue at this period is 80 yuan. At the same time, consider the battery loss cost \(L\), which is related to the charge-discharge depth and the number of cycles. For example, the loss cost of a lithium battery per complete cycle is about 0.05 yuan per kilowatt-hour. Combine the trading revenue and the battery loss cost to construct the objective function for maximizing the trading revenue \(F1 = R - L\).
[0068] Calculate the power regulation cost \(A\) and the power fluctuation cost \(B\) according to the charge-discharge power. The power regulation cost \(A\) reflects the cost generated by the grid for adjusting the output of the generating units, which is proportional to the power regulation amount, and the regulation coefficient is 0.15 yuan per kilowatt; the power fluctuation cost \(B\) represents the impact of the power change in adjacent periods on the grid stability, which is proportional to the power change rate, and the fluctuation coefficient is 0.08 yuan per kilowatt. Construct the objective function for minimizing the grid scheduling cost \(F2 = A + B\) with the power regulation cost and the power fluctuation cost.
[0069] Take the objective function \(F1\) for maximizing the trading revenue and the objective function \(F2\) for minimizing the grid scheduling cost as the optimization objectives, and impose three types of constraint conditions on the charge-discharge scheduling instruction vector: quota constraint, price interval constraint, and operation constraint. The quota constraint limits the sum of the absolute values of the charge-discharge power based on the differential trading quota. For example, the quota during the peak period is 300 kilowatts, the quota during the normal period is 200 kilowatts, and the quota during the valley period is 400 kilowatts; the price interval constraint limits the trading price based on the optimal trading price interval. For example, the lower limit of the discharging price is 0.75 yuan per kilowatt-hour, and the upper limit of the charging price is 0.45 yuan per kilowatt-hour; the operation constraint limits the charge-discharge power and the state of charge based on the trading matching strategy, including the upper and lower power limits (such as ±500 kilowatts) and the state of charge range constraint (such as 20% - 90%).
[0070] Encode the charge-discharge scheduling instruction vector with constraints into the particle positions in the particle swarm. The particle position is represented as X = {x1, x2,..., xn}, where xi corresponds to the charge-discharge power at time period i. Adaptively adjust the inertia weight coefficient w based on the current iteration progress k. When k is less than half of the total number of iterations K, w linearly decreases from 0.9 to 0.4; when k is greater than or equal to half of K, w remains 0.4. Dynamically update the learning factors c1 and c2 according to the particle fitness differences. For particles with good fitness, assign a larger cognitive learning factor c1 (such as 2.5) and a smaller social learning factor c2 (such as 1.5), and vice versa for particles with poor fitness. Update the particle velocity V using the inertia weight coefficient w and the dynamic learning factors c1 and c2. The velocity update formula is: new velocity = w × old velocity + c1 × r1 × (personal best position - current position) + c2 × r2 × (global best position - current position), where r1 and r2 are random numbers between 0 and 1. Apply the non-linear perturbation δ generated by the chaotic mapping to the particle position update process. The new position = old position + new velocity + δ, where the amplitude of δ gradually decreases with the iteration, with an initial value of 10% of the original position and finally decreasing to 1%.
[0071] Evaluate the updated particle swarm, and perform non-dominated sorting on the particles using the fast hierarchical method of dominance counting. The condition for particle i to dominate particle j is: F1(i) ≥ F1(j) and F2(i) ≤ F2(j), and at least one of the inequality signs holds. By calculating the dominance count and the dominated set of each particle, the particles are divided into different levels of particle layers. Within the same level of particle layer, calculate the crowding degree of the particles based on the normalized distance of the objective function values. The larger the crowding degree, the sparser the solution space around the particle. Combine the non-dominated sorting result with the crowding degree calculation result to generate the optimal solution set S.
[0072] Based on the preset decision preference weights w1 and w2, comprehensively evaluate the solutions in the optimal solution set S. The comprehensive evaluation value V = w1 × normalized value of F1 + w2 × (1 - normalized value of F2), where w1 + w2 = 1. For example, when the trading revenue and the grid dispatching cost are equally important, w1 = w2 = 0.5 can be set; when more attention is paid to the trading revenue, w1 = 0.7 and w2 = 0.3 can be set. Select the solution with the optimal comprehensive evaluation value V as the final charge-discharge scheduling instruction, and extract the charge-discharge time period, charge-discharge power, and target power parameter from it.
[0073] Exemplarily, a certain energy storage power station has a capacity of 1,000 kWh and a maximum charge-discharge power of ±500 kW. The 24-hour charge-discharge scheduling instructions calculated by this method are as follows: the charging powers from 1 to 6 are -300, -350, -400, -350, -250, -200 kW respectively; the discharging powers from 13 to 15 are 400, 450, 400 kW respectively; the discharging powers from 19 to 21 are 350, 400, 300 kW respectively; the power in the remaining periods is 0. The target power is 2,800 kWh, the expected trading revenue is 2,150 yuan, the grid dispatching cost is reduced by 320 yuan, the battery loss cost is 140 yuan, and the comprehensive revenue is 2,330 yuan. According to this scheduling instruction, the transaction settlement is executed, and the actual revenue is consistent with the expectation.
[0074] In this embodiment, an adaptive particle swarm optimization algorithm is used for solution. Through the dynamic adjustment of the inertia weight and the adaptive update of the learning factor, the convergence performance of the algorithm is significantly improved. The introduction of a chaotic map generates a non-linear perturbation, effectively avoiding the algorithm falling into a local optimum and enhancing the diversity of solutions. The fast hierarchical method of dominance counting is used for non-dominated sorting, and the crowding degree calculation is combined for solution screening, ensuring the quality and diversity of the final solution set. At the same time, multiple dimensions such as trading revenue, battery loss cost, and grid dispatching cost are considered. By designing a reasonable calculation method, the economic indicators of the energy storage system operation are accurately characterized, realizing the precise control of the charge-discharge scheduling of the energy storage system. While ensuring the safe and stable operation of the system, the economic benefits are significantly improved, providing effective technical support for the intelligent scheduling of the energy storage system.
[0075] In an alternative embodiment, Based on the current iteration progress, the inertia weight coefficient is adaptively adjusted, the learning factor is dynamically updated according to the particle fitness difference, the particle velocity is updated using the inertia weight coefficient and the dynamic learning factor, and the non-linear perturbation generated by the chaotic map is applied to the particle position update process to obtain the updated particle swarm, including: For the current particle swarm, calculate the particle swarm diversity index, obtain the aggregation degree of the particle swarm at the current iteration progress based on the first Euclidean distance between each particle in the particle swarm and the average position of the particle swarm, and dynamically adjust the inertia weight base value through a non-linear function according to the particle swarm aggregation degree. When the particle swarm aggregation degree decreases, increase the inertia weight parameter; Calculate the second Euclidean distance between each particle in the particle swarm and the global optimal solution. Based on the second Euclidean distance, adaptively adjust the particle fitness difference using an exponential function, where the particle fitness difference dynamically adjusts the cognitive term parameter and the social term parameter with the change of the second Euclidean distance. The cognitive term parameter increases with the increase of the second Euclidean distance, and the social term parameter decreases with the increase of the second Euclidean distance; Combine the Logistic map with the tent map to generate a chaotic sequence. Among them, the weight coefficient of the chaotic sequence decays linearly with iteration, and map the chaotic sequence to the boundary range of the particle swarm search space to form a non-linear perturbation term; Select the particle with the highest fitness from the particle swarm as the high-quality particle, and apply a local search perturbation based on the random difference vector to the high-quality particle to obtain a candidate solution. The random difference vector is composed of the product of the difference between the positions of two randomly selected particles in the particle swarm and the adaptive search radius; Calculate the distribution entropy based on the fitness distribution of each particle in the particle swarm, and dynamically adjust the structural characteristics of the particle swarm according to the size of the distribution entropy. When the distribution entropy is greater than the preset distribution entropy threshold, adopt the structural characteristics of global transfer; when the distribution entropy is less than the preset distribution entropy threshold, adopt the structural characteristics of local transfer, and adaptively adjust the transfer probability between particles; Apply the inertia weight parameter, dynamic learning factor, non-linear perturbation term, local search result and structural characteristics to the position and velocity update process of the particle swarm to obtain the updated particle swarm.
[0076] Initialize the particle swarm. Randomly generate N particles in the D-dimensional search space. Each particle contains a position vector and a velocity vector. The position vector represents the potential solution, and the velocity vector represents the moving direction and step size of the particle. For example, generate 50 particles in a 10-dimensional space, with the position range [-100, 100] and the initial velocity range [-10, 10].
[0077] Calculate the particle swarm diversity index. For the particle swarm in the current iteration, calculate the Euclidean distance between each particle and the average position of the particle swarm to obtain the aggregation degree of the particle swarm. Specifically, first calculate the average value of all particle positions, then calculate the Euclidean distance between each particle and the average position, and finally take the average of these distances as the particle swarm aggregation degree index. For example, when the index value is less than 0.5, it indicates that the particle swarm is over-aggregated.
[0078] Dynamically adjust the inertia weight based on the particle swarm aggregation degree. Use a non-linear function to achieve the adaptive adjustment of the inertia weight. Increase the inertia weight parameter when the particle swarm aggregation degree decreases, and vice versa. Specifically, the inertia weight base value can be set to 0.7. When the aggregation degree index is less than 0.3, adjust the inertia weight to 0.9; when the aggregation degree index is greater than 0.8, adjust the inertia weight to 0.4; linearly interpolate the inertia weight value in other cases.
[0079] Calculate the Euclidean distance between the particle and the global optimal solution. For each particle in the particle swarm, calculate the Euclidean distance between it and the current global optimal solution, which is used for subsequent dynamic adjustment of the learning factor. For example, for the i-th particle, calculate the Euclidean distance dist_i between it and the global optimal solution.
[0080] Adaptively adjust the learning factor based on the Euclidean distance. Use an exponential function to dynamically adjust the cognitive term parameter and the social term parameter, so that the cognitive term parameter increases as the Euclidean distance increases, and the social term parameter decreases as the Euclidean distance increases. In actual implementation, the base value of the cognitive term parameter c1 can be set to 1.5, and the base value of the social term parameter c2 can be set to 1.5. When the distance between the particle and the global optimal solution is greater than the threshold (e.g., 10), adjust c1 to 2.0 and c2 to 1.0; when the distance is less than the threshold (e.g., 2), adjust c1 to 1.0 and c2 to 2.0.
[0081] Generate a chaotic sequence as a non-linear perturbation. Combine the Logistic map and the tent map to generate a chaotic sequence. Select the initial value x0 = 0.7, and calculate the sequence {x1, x2,...} through iterative calculation of the Logistic map; then, input this sequence into the tent map to obtain the final chaotic sequence {y1, y2,...}. The weight coefficient of the chaotic sequence decays linearly with the number of iterations, with the initial weight being 0.1 and finally decaying to 0.01. Map the chaotic sequence to the range within the search space boundary to form a non-linear perturbation term.
[0082] Implement a local search strategy. Select the top 5% of the particles with the highest fitness in the particle swarm as high-quality particles, and apply a local search perturbation based on a random difference vector to each high-quality particle. Specifically, randomly select two particles from the particle swarm, calculate the difference between their positions, multiply it by an adaptive search radius (the initial value is 0.5 and decays linearly to 0.1 with iteration) to obtain a random difference vector, and add this vector to the position of the high-quality particle to obtain a candidate solution. If the fitness of the candidate solution is better than that of the original particle, replace the original particle with the candidate solution.
[0083] Dynamically adjust the particle swarm structure characteristics. Calculate the distribution entropy based on the fitness distribution of the particle swarm. The specific method is to normalize the fitness values and divide them into 10 intervals, count the proportion of the number of particles in each interval, and calculate the entropy value of these proportions. When the distribution entropy is greater than the preset threshold of 0.8, adopt a global transfer structure (each particle can interact with any other particle); when the distribution entropy is less than 0.8, adopt a local transfer structure (each particle only interacts with its neighboring particles). At the same time, adaptively adjust the transfer probability between particles according to the distribution entropy. The greater the distribution entropy, the higher the transfer probability.
[0084] Update the particle velocity and position. Considering the inertia weight parameter, dynamic learning factor, non - linear perturbation term, local search result and structural characteristics calculated above, update the velocity and position of the particle. When updating the velocity, the inertia term uses the adaptively adjusted inertia weight, and the cognitive term and social term use the dynamically adjusted learning factors c1 and c2 respectively. When updating the position, based on the standard position update formula, add the non - linear perturbation term generated by the chaotic sequence.
[0085] The experimental results on the test function Rastrigin show that when using the method of the present invention in the 30 - dimensional case, the optimal solution that can be achieved after 1000 iterations is 0.00021, while the optimal solution of the standard PSO algorithm is 0.15673, and the improvement effect is significant. On the Griewank function, the convergence speed of the method of the present invention is about 35% faster than that of the standard PSO.
[0086] In this embodiment, by introducing the particle swarm diversity index, the aggregation degree of the group is monitored in real - time, and the inertia weight is dynamically adjusted based on this index, effectively avoiding the premature convergence problem caused by the premature aggregation of the particle swarm. By calculating the Euclidean distance between the particle and the global optimal solution, the adaptive adjustment of the learning factor is realized, so that the particles far from the optimal solution pay more attention to individual cognition, and the particles close to the optimal solution pay more attention to social learning, enhancing the search ability of the algorithm; In the prior art, traditional particle swarm optimization algorithms often face problems such as slow convergence speed, easy to fall into local optimum, and difficult to maintain population diversity when solving complex optimization problems. Most of these problems are caused by fixed algorithm parameters, single particle update strategy, and static population structure, and cannot be adaptively adjusted according to the dynamic characteristics of the search process, reducing the search efficiency and solution quality of the algorithm; In this embodiment, the logistic mapping and tent mapping are combined to generate a chaotic sequence, which is introduced as a non - linear perturbation term into the particle position update process, improving the ability of the algorithm to jump out of the local optimum. By implementing a local search strategy based on the random difference vector for high - quality particles, the local fine - grained search ability of the algorithm is strengthened. A dynamic topology structure adjustment mechanism based on fitness distribution entropy is introduced, which adaptively switches between the global transfer and local transfer structures according to the population distribution characteristics, and dynamically adjusts the transfer probability between particles, optimizing the group information exchange efficiency, providing effective technical support for solving practical engineering optimization problems.
[0087] Figure 3 This is the multi - scenario performance evaluation radar chart corresponding to the distributed power battery energy trading and scheduling method of the smart grid in the embodiment of the present invention, as Figure 3As shown, the radar chart comprehensively presents the comparison of this technical solution with three representative particle swarm optimization algorithms (standard PSO, CLPSO, and APSO) in six key performance indicators. It can be clearly seen from the figure that this technical solution shows significant performance advantages in all evaluation dimensions.
[0088] In terms of optimization accuracy, this technical solution reaches an extremely high level of 95%, far exceeding 50% of the standard PSO, and also significantly higher than 70% of CLPSO and 80% of APSO. This accuracy advantage mainly stems from the synergistic effect of the adaptive learning factor adjustment mechanism and the local search strategy in this technical solution, enabling the algorithm to perform fine-grained searches after finding the global optimal region and achieving high-precision solutions.
[0089] In terms of convergence speed, this technical solution achieves a score of 90%, 30 percentage points higher than 60% of the standard PSO, 15 percentage points higher than 75% of CLPSO, and 10 percentage points higher than 80% of APSO. This benefits from the dynamic adjustment of the inertia weight based on the current iteration progress and the degree of particle swarm aggregation in this technical solution, accelerating the convergence process of the algorithm. At the same time, the chaotic sequence generated by the combination of the Logistic map and the tent map ensures that the algorithm can jump out of the local optimal trap.
[0090] In terms of anti-prematurity, this technical solution scores 85%, significantly better than 55% of the standard PSO, and also higher than 70% of CLPSO and 75% of APSO. The traditional PSO algorithm often exhibits premature convergence during the iteration process, while this technical solution effectively avoids the particle swarm from falling into the local optimum prematurely through the dynamic adjustment of the structural characteristics driven by distribution entropy and the introduction of a non-linear perturbation term.
[0091] The global search ability is one of the core indicators of the particle swarm algorithm. This technical solution reaches a score of 90% in this item, far exceeding 55% of the standard PSO, and also significantly higher than 75% of CLPSO and 80% of APSO. The excellent global search ability comes from the dynamic balance adjustment of the cognitive item parameter and the social item parameter in this technical solution, as well as the non-linear perturbation generated by the chaotic sequence, enabling the algorithm to conduct comprehensive and effective exploration in the solution space.
[0092] In terms of computational efficiency, this technical solution reaches a score of 85%, much higher than 55% of the standard PSO, and also better than 70% of CLPSO and 75% of APSO. The high efficiency is mainly attributed to the parameter adjustment strategy based on the particle fitness difference and the high-quality particle local search mechanism in this technical solution, reducing the number of iterations and computational overhead required for the algorithm to reach convergence.
[0093] Overall, through innovative mechanisms such as the adaptive adjustment of the inertia weight coefficient, the dynamic update of the learning factor based on the particle fitness difference, the generation of non-linear perturbations by chaotic mapping, the local search of high-quality particles, and the structure feature adjustment driven by distribution entropy, this technical solution has achieved a comprehensive improvement in the performance of the particle swarm optimization algorithm, providing a more efficient, stable, and accurate solution tool for complex optimization problems.
[0094] A distributed power battery energy trading and scheduling system for smart grids, comprising: A first unit for collecting the load distribution data of the smart grid and the real-time status information of distributed power batteries, calculating the power consumption demand curves of each region according to the load distribution data of the smart grid, where the real-time status information includes the remaining battery power, charge and discharge power, and geographical location information, and dividing the power batteries into multiple power battery trading groups according to the charge and discharge power, remaining battery power, and geographical location based on the real-time status information and the power consumption demand curves; A second unit for constructing a federated learning node network based on the power battery trading groups, taking the historical response time, battery health status, and transaction completion rate of both buyers and sellers as operation data to input into a pre-trained multi-layer neural network for feature extraction, calculating a credit assessment score using the gradient boosting decision tree algorithm, and setting differential trading quotas and credit thresholds for both buyers and sellers within the power battery trading groups based on the credit assessment score; A third unit for constructing a spatio-temporal correlation graph based on the power consumption demand curves and historical transaction data, using the graph attention algorithm to extract the power demand dependency relationships between regions, combining a recurrent neural network to model the temporal features, outputting the optimal trading price intervals for each trading group in the next 24 hours by time period, and generating a risk-controlled trading matching strategy according to the optimal trading price intervals and credit thresholds; A fourth unit for, according to the differential trading quotas, optimal trading price intervals, and trading matching strategies, while considering maximizing trading benefits and minimizing grid scheduling costs, using an improved particle swarm algorithm to optimize and calculate a charge and discharge scheduling instruction including the charge and discharge time periods, charge and discharge power, and target power, and issuing the charge and discharge scheduling instruction and performing transaction settlement.
[0095] In the third aspect of the embodiments of the present invention, There is provided an electronic device, comprising: A processor; A memory for storing instructions executable by the processor; Wherein, the processor is configured to call the instructions stored in the memory to execute the method described above.
[0096] In the fourth aspect of the embodiments of the present invention, Provided is a computer-readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the method described above.
[0097] The present invention may be a method, apparatus, system, and / or computer program product. The computer program product may include a computer-readable storage medium having thereon computer-readable program instructions for performing various aspects of the present invention.
[0098] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A distributed power battery energy trading and scheduling method for a smart grid, characterized in that, Including: Collecting the load distribution data of the smart grid and the real-time status information of distributed power batteries, calculating the power consumption demand curves of each region according to the load distribution data of the smart grid, where the real-time status information includes the remaining battery power, charging and discharging power, and geographical location information, and dividing the power batteries into multiple power battery trading groups based on the real-time status information and the power consumption demand curves according to the charging and discharging power, remaining battery power, and geographical location; Constructing a federated learning node network based on the power battery trading groups, taking the historical response time, battery health status, and transaction completion rate of both the buyer and the seller as operation data, inputting them into a pre-trained multi-layer neural network for feature extraction, calculating the credit assessment score using the gradient boosting decision tree algorithm, and setting different transaction quotas and credit thresholds for the buyer and the seller within the power battery trading group based on the credit assessment score; Constructing a spatio-temporal correlation graph based on the power consumption demand curves and historical transaction data, using the graph attention algorithm to extract the power demand dependency relationships between regions, combining with a recurrent neural network to model the time series features, outputting the optimal trading price intervals for each trading group in the next 24 hours by time period, and generating a risk-controlled trading matching strategy according to the optimal trading price intervals and credit thresholds; According to the different transaction quotas, optimal trading price intervals, and trading matching strategies, while considering maximizing the trading revenue and minimizing the grid dispatching cost, using an improved particle swarm optimization algorithm to optimize and calculate the charging and discharging scheduling instructions including the charging and discharging time periods, charging and discharging power, and target power, and issuing the charging and discharging scheduling instructions and performing transaction settlement.
2. The method according to claim 1, wherein Collecting the load distribution data of the smart grid and the real-time status information of distributed power batteries, calculating the power consumption demand curves of each region according to the load distribution data of the smart grid, where the real-time status information includes the remaining battery power, charging and discharging power, and geographical location information, and dividing the power batteries into multiple power battery trading groups based on the real-time status information and the power consumption demand curves includes: Collecting the load distribution data of the smart grid, including the real-time load rate of regional distribution transformers, historical power consumption load curves, and time-of-use electricity price information, and using a method combining Fourier series decomposition and wavelet transform to perform periodic analysis and trend extraction on the historical power consumption load curves according to the load distribution data of the smart grid, and calculating the power consumption demand curves for each region in the next 24 hours by time period; Obtaining the real-time status information of distributed power batteries, where the real-time status information includes the remaining battery power, charging and discharging power, and geographical location information, and where the charging and discharging power includes the maximum charging power, maximum discharging power, and charging and discharging efficiency, and calculating the power available for participating in electricity trading according to the remaining battery power and charging and discharging efficiency; Based on the electricity demand curve and real-time status information, calculate the geographical distance and transmission loss between the power battery and each regional load center. Combining the matching degree between the tradable electricity quantity of the power battery and the regional electricity demand, an improved hierarchical clustering algorithm is used to adaptively group the power batteries. Among them, the charging and discharging characteristics deviation of the power batteries within the same group does not exceed 5%, and the geographical location distribution does not exceed the preset maximum grouping distance, and the number of groups is dynamically adjusted according to real-time trading requirements.
3. The method according to claim 1, characterized in that, Construct a federated learning node network based on the power battery trading group. Use the historical response time, battery health status, and transaction completion rate of both the buyer and the seller as operation data to input into a pre-trained multi-layer neural network for feature extraction. Use the gradient boosting decision tree algorithm to calculate the credit assessment score. Based on the credit assessment score, set differential trading quotas and credit thresholds for the buyer and the seller within the power battery trading group, including: Construct a federated learning node network based on the power battery trading group. Regard the buyer and the seller in the power battery trading group as independent federated learning nodes. The federated learning nodes maintain the historical response time, battery health status, and transaction completion rate. The battery health status includes the capacity retention rate, internal resistance growth rate, and voltage consistency. Perform normalization and standardization preprocessing on the historical response time, the battery health status, and the transaction completion rate. Use a sliding time window to segment and sample the preprocessed data to generate a training sample set, and form the operation data with the training sample set. Input the operation data into a pre-trained multi-layer neural network for feature extraction. The multi-layer neural network consists of an input layer, a first hidden layer, a second hidden layer, a third hidden layer, and an output layer. The first hidden layer, the second hidden layer, and the third hidden layer adopt the rectified linear unit activation function with a random inactivation mechanism. The output layer generates a feature vector. Based on the Euclidean distance between the feature vector and the target feature vector and the one-norm of the network weights, construct a multi-objective loss function. Execute federated average training in the federated learning node network. Each federated learning node calculates the local gradient based on local data, encrypts the local gradient using the differential privacy mechanism, and transmits the encrypted local gradient to the aggregation server. The aggregation server performs weighted averaging on the local gradients according to the sample quantity and data quality score of each federated learning node to obtain the global gradient, and updates the global model parameters based on the global gradient. Enhance the feature vector and then input it into the gradient boosting decision tree algorithm. The gradient boosting decision tree algorithm adopts the second-order derivative optimization algorithm, fits the decision tree through negative gradient iteration and minimizing the pre-constructed progressive constraint loss function. In the leaf node area of the decision tree, calculate the optimal prediction value based on Newton's method and the Hessian matrix, and dynamically adjust the learning rate based on the convergence speed of the loss function, and output the credit assessment score. Based on the credit assessment score, set differential trading quotas and credit thresholds for the buyer and the seller within the power battery trading group.
4. The method according to claim 3, characterized in that, After enhancing the feature vector, it is input into the gradient boosting decision tree algorithm. The gradient boosting decision tree algorithm adopts a second-order derivative optimization algorithm and fits the decision tree through negative gradient iteration and minimizing a pre-constructed progressive constraint loss function. In the leaf node region of the decision tree, the optimal prediction value calculated based on Newton's method and the Hessian matrix includes: Construct a hierarchical feature enhancement network to enhance the input feature vector through a basic feature layer, an interaction feature layer, and a fusion feature layer. Calculate the statistical distribution information of the original features in the basic feature layer, generate a feature interaction matrix based on the statistical distribution information in the interaction feature layer and extract the high-order association patterns between features. In the fusion feature layer, adaptively fuse the statistical distribution information and the high-order association patterns to output an enhanced feature vector; Construct a prediction objective function based on the enhanced feature vector, perform first-order and second-order Taylor expansions on the prediction objective function to obtain the gradient information and the Hessian matrix of the objective function. Construct a regularization loss function of the prediction objective according to the gradient information and the Hessian matrix, dynamically adjust the regularization strength of the regularization loss function according to the statistical distribution information to obtain an adaptive regularization loss term, calculate the feature association consistency score based on the feature interaction matrix to obtain a feature association constraint term, and combine the gradient information of the objective function, the adaptive regularization loss term, and the feature association constraint term to form a progressive constraint loss function; Input the enhanced feature vector into the gradient boosting decision tree algorithm, use the second-order derivative optimization algorithm to calculate the first derivative of the objective function to obtain the negative gradient direction, calculate the second derivative of the objective function and construct the Hessian matrix, and reconstruct the feature gradient in combination with the feature interaction matrix to obtain a feature association-aware gradient; Calculate the data density and distribution offset degree of the candidate split points based on the statistical distribution information and combine them with the feature association-aware gradient to construct a distribution-aware split criterion. Select the optimal split point according to the distribution-aware split criterion to perform node splitting to construct a decision tree; In the leaf node region of the decision tree, calculate the second partial derivative between feature pairs based on the feature interaction matrix to construct a second-order Hessian matrix, generate a feature association tensor based on the high-order association pattern, calculate the local distribution covariance in combination with the statistical distribution information, and use Newton's method to optimize and calculate the second-order Hessian matrix and the local distribution covariance to minimize the progressive constraint loss function to obtain an optimal prediction value considering feature association.
5. The method according to claim 1, wherein Construct a spatio-temporal association graph based on the electricity demand curve and historical transaction data, use the graph attention algorithm to extract the electricity demand dependence relationship between regions, and combine a recurrent neural network to model the time series features. Output the optimal transaction price interval for each trading group in the next 24 hours by time period. Generate a risk-controlled transaction matching strategy according to the optimal transaction price interval and the credit threshold, including: Construct the electricity demand curve obtained in advance into an electricity demand matrix, extract the transaction price, transaction volume, default situation, electricity consumption fluctuation, and peak-valley electricity consumption characteristics in the historical transaction data to construct a transaction feature matrix, and construct the adjacency matrix of the spatio-temporal association graph based on the geographical distance attenuation coefficient and electricity consumption pattern similarity between trading groups; The feature vectors of the nodes in the spatio-temporal correlation graph are linearly transformed to obtain query vectors, key vectors, and value vectors. The inner product of the query vectors and the key vectors is calculated and normalized to obtain the attention weight matrix. The attention weight matrix is multiplied by the value vectors to obtain weighted features. Multiple groups of weighted features are concatenated and non-linearly transformed to obtain the power demand dependency relationship; The power demand dependency relationship is input into a recurrent neural network. The fusion ratio of historical state information and current input information is controlled by reset gates and update gates. The reset historical state and the current input are non-linearly transformed to obtain candidate states, and adaptive fusion is performed based on the update gates to obtain temporal features; The temporal features and the historical price series are feature-fused to obtain price prediction features. A mixture probability distribution model containing Gaussian distribution and skewed distribution is constructed based on the price prediction features. Iterative optimization is performed through the expectation-maximization algorithm to determine the optimal number of distributions, and the determined multiple probability distributions are weighted and combined to obtain the conditional probability distribution of the price; Based on the conditional probability distribution, the quantiles of the specified confidence interval are calculated to obtain the optimal trading price interval. The default probability is calculated according to the credit scores of the trading groups and compared with the credit threshold to determine the overlap of the price intervals of the trading groups that meet the credit constraints, and a risk-controlled trading matching strategy is output.
6. The method according to claim 1, characterized in that, According to the differentiated trading quotas, the optimal trading price intervals, and the trading matching strategy, while considering the maximization of trading revenue and the minimization of grid scheduling costs, an improved particle swarm algorithm is used for optimization calculation to obtain a charging and discharging scheduling instruction including charging and discharging time periods, charging and discharging power, and target power consumption. The charging and discharging scheduling instruction is issued and the transaction settlement is executed, including: A charging and discharging scheduling instruction vector is constructed. The charging and discharging scheduling instruction vector includes charging and discharging time periods, charging and discharging power, and target power consumption. The difference between the trading revenue and the grid scheduling cost is calculated based on the charging and discharging power. A trading revenue maximization objective function is constructed by combining the battery loss cost. The power regulation cost and the power fluctuation cost are calculated according to the charging and discharging power, and the power regulation cost and the power fluctuation cost are used to construct a grid scheduling cost minimization objective function; The trading revenue maximization objective function and the grid scheduling cost minimization objective function are used as optimization objectives, and constraint conditions are imposed on the charging and discharging scheduling instruction vector. Among them, the constraint conditions include a quota constraint that limits the sum of the absolute values of the charging and discharging power based on the differentiated trading quota, a price interval constraint that limits the trading price based on the optimal trading price interval, and an operation constraint that limits the charging and discharging power and the state of charge based on the trading matching strategy; The charging and discharging scheduling instruction vector with constraint conditions is encoded as the particle position in the particle swarm. The inertia weight coefficient is adaptively adjusted based on the current iteration progress. The learning factors are dynamically updated according to the particle fitness difference. The particle velocity is updated using the inertia weight coefficient and the dynamic learning factors, and the non-linear perturbation generated by the chaotic mapping is applied to the particle position update process to obtain the updated particle swarm; Evaluate the updated particle swarm, and use the fast hierarchical method of dominance counting to perform non-dominated sorting on the particles to obtain particle layers of different levels. Calculate the crowding degree of the particles based on the normalized distance of the objective function values within the particle layers of the same level, and combine the non-dominated sorting result with the crowding degree calculation result to generate the optimal solution set; Based on the preset decision preference weights, comprehensively evaluate the solutions in the optimal solution set, select the solution with the optimal comprehensive evaluation value as the final charge and discharge scheduling instruction, extract the charge and discharge time periods, charge and discharge powers, and target power parameter according to the charge and discharge scheduling instruction, and issue the charge and discharge scheduling instruction and execute the transaction settlement.
7. The method according to claim 6, wherein Adaptive adjust the inertia weight coefficient based on the current iteration progress, dynamically update the learning factor according to the particle fitness difference, update the particle velocity using the inertia weight coefficient and the dynamic learning factor, and apply the non-linear perturbation generated by the chaotic mapping to the particle position update process to obtain the updated particle swarm, including: For the current particle swarm, calculate the particle swarm diversity index, obtain the aggregation degree of the particle swarm at the current iteration progress based on the first Euclidean distance between each particle in the particle swarm and the average position of the particle swarm, and dynamically adjust the inertia weight base value through a non-linear function according to the aggregation degree of the particle swarm. When the aggregation degree of the particle swarm decreases, increase the inertia weight parameter; Calculate the second Euclidean distance between each particle in the particle swarm and the global optimal solution, and adaptively adjust the particle fitness difference using an exponential function based on the second Euclidean distance, where the particle fitness difference dynamically adjusts the cognitive term parameter and the social term parameter with the change of the second Euclidean distance. The cognitive term parameter increases with the increase of the second Euclidean distance, and the social term parameter decreases with the increase of the second Euclidean distance; Combine the Logistic map and the tent map to generate a chaotic sequence. Among them, the weight coefficient of the chaotic sequence decays linearly with the iteration, and map the chaotic sequence to the boundary range of the particle swarm search space to form a non-linear perturbation term; Select the particle with the highest fitness from the particle swarm as the high-quality particle, and apply the local search perturbation based on the random difference vector to the high-quality particle to obtain the candidate solution. The random difference vector is composed of the product of the difference between the positions of two randomly selected particles in the particle swarm and the adaptive search radius; Calculate the distribution entropy based on the fitness distribution of each particle in the particle swarm, and dynamically adjust the structural characteristics of the particle swarm according to the size of the distribution entropy. When the distribution entropy is greater than the preset distribution entropy threshold, adopt the structural characteristics of global transfer. When the distribution entropy is less than the preset distribution entropy threshold, adopt the structural characteristics of local transfer, and adaptively adjust the transfer probability between particles; Apply the inertia weight parameter, the dynamic learning factor, the non-linear perturbation term, the local search result, and the structural characteristics to the position and velocity update process of the particle swarm to obtain the updated particle swarm.
8. A distributed power battery energy trading and scheduling system for a smart grid, which is used to implement the method described in any one of the foregoing claims 1-7, characterized in that, Including: The first unit is used to collect the intelligent power grid load distribution data and the real-time status information of distributed power batteries, calculate the power consumption demand curves of each region according to the intelligent power grid load distribution data, where the real-time status information includes the remaining battery power, charge and discharge power, and geographical location information, and divide the power batteries into multiple power battery trading groups according to the charge and discharge power, remaining battery power, and geographical location based on the real-time status information and the power consumption demand curves; The second unit is used to construct a federated learning node network based on the power battery trading groups, input the historical response time, battery health status, and transaction completion rate of the buyer and seller as operation data into a pre-trained multi-layer neural network for feature extraction, calculate the credit evaluation score using the gradient boosting decision tree algorithm, and set different transaction quotas and credit thresholds for the buyer and seller within the power battery trading group based on the credit evaluation score; The third unit is used to construct a spatio-temporal association graph based on the power consumption demand curves and historical transaction data, extract the power demand dependence relationship between regions using the graph attention algorithm, model the time series features in combination with a recurrent neural network, output the optimal trading price intervals for each trading group in the next 24 hours by time period, and generate a risk-controlled trading matching strategy according to the optimal trading price intervals and credit thresholds; The fourth unit is used to optimize and calculate the charge and discharge scheduling instructions including the charge and discharge time periods, charge and discharge power, and target power according to the different transaction quotas, optimal trading price intervals, and trading matching strategies, while considering maximizing the trading revenue and minimizing the power grid dispatching cost, using an improved particle swarm algorithm, issue the charge and discharge scheduling instructions, and perform transaction settlement.
9. An electronic device, characterized in that, Comprising: A processor; A memory for storing instructions executable by the processor; Wherein, the processor is configured to call the instructions stored in the memory to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, The computer program instructions, when executed by the processor, implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Energy scheduling and trading method of interconnected micro-grid system
CN117436647A
Intelligent charging pile scheduling method and system based on dynamic adjustment of energy storage battery pack
CN118966580A
Micro-grid energy-saving scheme generation method and system based on energy storage optimization scheduling
CN119209504A
Federated learning-based regional photovoltaic power probability prediction method, and cooperative regulation and control system
WO2021238505A1
AU2020104000A4
Cited By
Balanced optimization scheduling method and system for battery switching network load
CN121036053A
Privacy protection type distributed optimization method and system based on optimal control
CN121503734A
Vector database-oriented online incremental learning index system and construction method thereof
CN121681531A
