Distributed power battery energy trading and scheduling method and system for smart grid

By building a federated learning node network and credit assessment mechanism, combined with graph attention algorithms and recurrent neural networks, and optimizing charging and discharging scheduling instructions, the problem of insufficient consideration of the real-time status and geographical location of distributed power batteries in trading and scheduling in smart grids is solved, achieving maximum transaction benefits and minimization of grid scheduling costs, and improving grid operation efficiency and reliability.

CN120262388BActive Publication Date: 2025-09-16JINGNENG VISION LINGJINZHIHUI (BEIJING) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510408230.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-02
Publication Date
2025-09-16
Estimated Expiration
2045-04-02

AI Technical Summary

Technical Problem

In existing technologies, the energy trading and scheduling of distributed power batteries in smart grids lack consideration of the real-time status and geographical location of the power batteries, pose information security risks, and make it difficult to simultaneously optimize both transaction revenue and grid scheduling costs.

Method used

By collecting smart grid load distribution data and real-time status information of power batteries, a federated learning node network is constructed, and the gradient boosting decision tree algorithm is used to calculate the credit assessment score. Combined with the graph attention algorithm and recurrent neural network modeling, a risk-controllable transaction matching strategy is generated, and an improved particle swarm algorithm is used to optimize charging and discharging scheduling instructions.

Benefits of technology

It achieves accurate matching and risk control of power battery transactions, improves transaction success rate and system security, reduces economic losses, and improves grid operation efficiency and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120262388B_ABST
    Figure CN120262388B_ABST
Patent Text Reader

Abstract

The present invention provides a distributed power battery energy trading and scheduling method and system for a smart grid, relating to the technical field of smart grids. The method comprises: collecting load distribution data and battery status information, dividing trading groups; constructing a federated learning network, calculating credit assessment scores, setting differentiated trading quotas, building a spatiotemporal correlation graph, outputting the optimal trading price range, generating a trading matching strategy, optimizing and calculating charging and discharging scheduling instructions, and executing transaction settlement. This method achieves efficient trading and scheduling of power battery energy, improves grid operation efficiency, and reduces scheduling costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart grid technology, and in particular to a distributed power battery energy trading and scheduling method and system for a smart grid. Background Art

[0002] Smart grid is an important development direction of modern power system, which can realize the efficient utilization and flexible dispatch 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 grid.

[0003] Currently, the energy trading and scheduling of distributed power batteries in smart grids still face problems such as a lack of consideration of the real-time status and geographical location of power batteries, information security risks posed by centralized trading models, and a single-objective approach that makes it difficult to simultaneously optimize trading revenue and grid scheduling costs.

[0004] Therefore, a solution is urgently needed to solve the problems existing in the prior art. Summary of the Invention

[0005] The 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.

[0006] A first aspect of an embodiment of the present invention provides a distributed power battery energy trading and scheduling method for a smart grid, comprising:

[0007] collecting smart grid load distribution data and real-time status information of distributed power batteries, calculating a power demand curve for each region based on the smart grid load distribution data, the real-time status information including battery remaining capacity, charge and discharge power, and geographic location information, and dividing the power batteries into a plurality of power battery trading groups based on charge and discharge power, remaining capacity, and geographic location based on the real-time status information and the power demand curve;

[0008] A federated learning node network is built based on the power battery trading group. The historical response time, battery health status, and transaction completion rate of buyers and sellers are used as operational data input into a pre-trained multi-layer neural network for feature extraction. A gradient boosting decision tree algorithm is used to calculate a credit assessment score. Based on this credit assessment score, differentiated trading quotas and credit thresholds are set for buyers and sellers within the power battery trading group.

[0009] Based on the electricity demand curve and historical transaction data, a spatiotemporal correlation graph is constructed. The inter-regional electricity demand dependency is extracted using a graph attention algorithm. A recurrent neural network is combined to model the time series features. The optimal transaction price range for each trading group in the next 24 hours is output. A risk-controlled transaction matching strategy is generated based on the optimal transaction price range and credit threshold.

[0010] Based on the differentiated trading quotas, optimal trading price range and trading matching strategy, while taking into account the maximization of trading revenue and the minimization of grid dispatching costs, an improved particle swarm algorithm is used to optimize and calculate the charging and discharging scheduling instructions including the charging and discharging period, charging and discharging power and target power, and the charging and discharging scheduling instructions are issued and transaction settlement is executed.

[0011] In an optional embodiment,

[0012] Collecting smart grid load distribution data and real-time status information of distributed power batteries, calculating power demand curves for each region based on the smart grid load distribution data, wherein the real-time status information includes battery remaining capacity, charge and discharge power, and geographic location information, and dividing the power batteries into multiple power battery trading groups based on charge and discharge power, remaining capacity, and geographic location based on the real-time status information and the power demand curve, including:

[0013] Collect smart grid load distribution data, including real-time load rates of regional distribution transformers, historical electricity load curves, and time-of-use electricity price information. Based on the smart grid load distribution data, use a combination of Fourier series decomposition and wavelet transform to perform periodic analysis and trend extraction on the historical electricity load curves, and calculate the time-of-use electricity demand curves for each region over the next 24 hours.

[0014] Obtaining real-time status information of distributed power batteries, the real-time status information including the remaining battery capacity, charge and discharge power, and geographic location information, wherein the charge and discharge power includes maximum charge power, maximum discharge power, and charge and discharge efficiency, and calculating the amount of electricity available for participation in electric energy trading based on the remaining battery capacity and charge and discharge efficiency;

[0015] Based on the electricity demand curve and real-time status information, the geographical distance and transmission loss between the power batteries and the load centers in each region are calculated. Combined with the degree of matching between the tradable power of the power batteries and the regional electricity demand, an improved hierarchical clustering algorithm is used to adaptively group the power batteries. The deviation of the charge and discharge characteristics of the power batteries in the same group does not exceed 5%, and the geographical distribution does not exceed the preset maximum grouping distance. The number of groups is dynamically adjusted according to real-time trading demand.

[0016] In an optional embodiment,

[0017] A federated learning node network is built based on the power battery trading group. The historical response time, battery health status, and transaction completion rate of buyers and sellers are used as operating data to input into a pre-trained multi-layer neural network for feature extraction. A gradient boosting decision tree algorithm is used to calculate the credit assessment score. Based on the credit assessment score, differentiated transaction quotas and credit thresholds are set for buyers and sellers in the power battery trading group, including:

[0018] Building a federated learning node network based on a power battery trading group, with buyers and sellers in the power battery trading group acting 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, internal resistance growth rate, and voltage consistency.

[0019] Normalizing and standardizing the historical response time, the battery health status, and the transaction completion rate, performing segmented sampling on the preprocessed data using a sliding time window to generate a training sample set, and forming the training sample set into operating data;

[0020] Inputting the operating data into a pre-trained multi-layer neural network for feature extraction, the multi-layer neural network consisting of an input layer, a first hidden layer, a second hidden layer, a third hidden layer, and an output layer, wherein the first hidden layer, the second hidden layer, and the third hidden layer use a rectified linear unit activation function with a random dropout mechanism, the output layer generates a feature vector, and constructs a multi-objective loss function based on the Euclidean distance between the feature vector and a target feature vector and a norm of a network weight;

[0021] Performing federated average training in the federated learning node network, each federated learning node calculates a local gradient based on local data, encrypts the local gradient using a differential privacy mechanism, and transmits the encrypted local gradient to an aggregation server. The aggregation server performs a weighted average of the local gradients based on the number of samples and data quality scores of each federated learning node to obtain a global gradient, and updates global model parameters based on the global gradient;

[0022] After enhancing the feature vector, the algorithm is fed 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 minimization of a pre-constructed progressive constraint loss function. In the leaf node region of the decision tree, the optimal prediction value is calculated based on the Newton method and the Hessian matrix. The learning rate is dynamically adjusted based on the convergence rate of the loss function, and a credit assessment score is output.

[0023] Based on the credit assessment score, differentiated transaction quotas and credit thresholds are set for buyers and sellers in the power battery transaction group.

[0024] In an optional embodiment,

[0025] After the feature vector is enhanced, it is input into the gradient boosting decision tree algorithm. The gradient boosting decision tree algorithm adopts a second-order derivative optimization algorithm to fit the decision tree by negative gradient iteration and minimization of a pre-built progressive constraint loss function. In the leaf node area of ​​the decision tree, the optimal prediction value is calculated based on the Newton method and the Hessian matrix, including:

[0026] Construct a hierarchical feature enhancement network, and enhance the input feature vector through the basic feature layer, interactive feature layer, and fusion feature layer. The basic feature layer calculates the statistical distribution information of the original features. The interactive feature layer generates a feature interaction matrix based on the statistical distribution information and extracts high-order correlation patterns between features. The fusion feature layer adaptively fuses the statistical distribution information and high-order correlation patterns to output an enhanced feature vector.

[0027] A prediction objective function based on the enhanced feature vector is constructed. The first-order and second-order Taylor expansions of the prediction objective function are performed to obtain the gradient information and Hessian matrix of the objective function. A regularized loss function for the prediction target is constructed based on the gradient information and the Hessian matrix. The regularization strength of the regularized loss function is dynamically adjusted based on the statistical distribution information to obtain an adaptive regularized loss term. The feature association consistency score is calculated based on the feature interaction matrix to obtain a feature association constraint term. The gradient information of the objective function, the adaptive regularized loss term, and the feature association constraint term are combined to form a progressive constraint loss function.

[0028] The enhanced feature vector is input into the gradient boosting decision tree algorithm. The second-order derivative optimization algorithm is used to calculate the first-order derivative of the objective function to obtain the negative gradient direction. The second-order derivative of the objective function is calculated and the Hessian matrix is ​​constructed. The feature gradient is reconstructed in combination with the feature interaction matrix to obtain the feature association perception gradient.

[0029] Based on the statistical distribution information, the data density and distribution deviation of the candidate split points are calculated and combined with the feature correlation perception gradient to construct a distribution-aware splitting criterion. According to the distribution-aware splitting criterion, the optimal splitting point is selected for node splitting to construct a decision tree;

[0030] In the leaf node area of ​​the decision tree, the second-order partial derivatives between feature pairs are calculated based on the feature interaction matrix to construct a second-order Hessian matrix, the feature association tensor is generated based on the high-order association pattern, the local distribution covariance is calculated in combination with the statistical distribution information, and the Newton method is used to optimize the calculation of the second-order Hessian matrix and the local distribution covariance, and the progressive constraint loss function is minimized to obtain the optimal prediction value considering the feature association.

[0031] In an optional embodiment,

[0032] Based on the electricity demand curve and historical transaction data, a spatiotemporal correlation graph is constructed. The inter-regional electricity demand dependency is extracted using a graph attention algorithm. Time series features are modeled using a recurrent neural network. The optimal transaction price range for each transaction group in the next 24 hours is output. A risk-controlled transaction matching strategy is generated based on the optimal transaction price range and credit threshold, including:

[0033] The previously acquired electricity demand curve is constructed into an electricity demand matrix. The transaction price, transaction number, default status, electricity consumption fluctuation and peak and valley electricity consumption characteristics are extracted from the historical transaction data to construct a transaction feature matrix. The adjacency matrix of the spatiotemporal association graph is constructed based on the geographic distance attenuation coefficient and electricity consumption pattern similarity between transaction groups.

[0034] Perform linear transformation on the feature vectors of nodes in the spatiotemporal association graph to obtain query vectors, key vectors, and value vectors. Calculate the inner product of the query vector and the key vector and normalize them to obtain the attention weight matrix. Multiply the attention weight matrix by the value vector to obtain weighted features. Multiple sets of weighted features are concatenated and nonlinearly transformed to obtain the power demand dependency relationship.

[0035] The power demand dependency is input into the recurrent neural network. The reset gate and update gate are used to control the fusion ratio of historical state information and current input information. The reset historical state and current input are nonlinearly transformed to obtain candidate states. The update gate is used to perform adaptive fusion to obtain time series features.

[0036] The price prediction features are obtained by fusing the time series features and the historical price series. Based on the price prediction features, a mixed probability distribution model containing Gaussian distribution and skewed distribution is constructed. The maximum expectation algorithm is used for iterative optimization to determine the optimal number of distributions. The weighted combination of the determined multiple probability distributions is used to obtain the conditional probability distribution of the price.

[0037] The optimal transaction price range is obtained by calculating the quantiles of the specified confidence interval based on the conditional probability distribution. The default probability is calculated based on the credit score of the transaction group and compared with the credit threshold. The overlap of the price ranges of the transaction groups that meet the credit constraints is determined, and a risk-controlled transaction matching strategy is output.

[0038] In an optional embodiment,

[0039] Based on the differentiated trading quotas, optimal trading price range, and trading matching strategy, while taking into account maximization of trading revenue and minimization of grid dispatching costs, an improved particle swarm optimization algorithm is used to optimize and calculate a charging and discharging scheduling instruction including charging and discharging time periods, charging and discharging power, and target power. The charging and discharging scheduling instruction is issued and transaction settlement is executed, including:

[0040] Constructing a charge and discharge scheduling instruction vector, wherein the charge and discharge scheduling instruction vector includes a charge and discharge period, a charge and discharge power, and a target power; calculating the difference between transaction revenue and grid dispatch cost based on the charge and discharge power; constructing a transaction revenue maximization objective function in combination with the battery loss cost; calculating the power regulation cost and the power fluctuation cost based on the charge and discharge power; and constructing a grid dispatch cost minimization objective function in combination with the power regulation cost and the power fluctuation cost;

[0041] Taking the transaction revenue maximization objective function and the grid dispatch cost minimization objective function as optimization objectives, constraints are imposed on the charge and discharge scheduling instruction vector, wherein the constraints include a quota constraint that limits the sum of the absolute values ​​of charge and discharge power based on differentiated transaction quotas, a price range constraint that limits the transaction price based on the optimal transaction price range, and an operation constraint that limits the charge and discharge power and state of charge based on a transaction matching strategy;

[0042] The constrained charge and discharge scheduling instruction vector 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 factor is dynamically updated according to the fitness difference of the particles. The inertia weight coefficient and the dynamic learning factor are used to update the particle velocity. The nonlinear perturbation generated by the chaotic map is applied to the particle position update process to obtain the updated particle swarm.

[0043] The updated particle swarm is evaluated, and the particles are non-dominatedly sorted using a fast hierarchical method based on dominance counting to obtain particle layers of different levels. Within the particle layers of the same level, the congestion of the particles is calculated based on the normalized distance of the objective function value. The non-dominated sorting results are combined with the congestion calculation results to generate the optimal solution set.

[0044] Based on the preset decision preference weights, a comprehensive evaluation is performed on the solutions in the optimal solution set, and the solution with the best comprehensive evaluation value is selected as the final charge and discharge scheduling instruction. The charge and discharge period, charge and discharge power and target power parameters are extracted according to the charge and discharge scheduling instruction, and the charge and discharge scheduling instruction is issued and transaction settlement is executed.

[0045] In an optional embodiment,

[0046] Adaptively adjust the inertia weight coefficient based on the current iteration progress, dynamically update the learning factor according to the fitness difference of the particles, use the inertia weight coefficient and the dynamic learning factor to update the particle velocity, and apply the nonlinear perturbation generated by the chaotic map to the particle position update process to obtain the updated particle swarm.

[0047] For the current particle swarm, calculate the particle swarm diversity index, obtain the particle swarm aggregation degree under 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 nonlinear function according to the particle swarm aggregation degree, and increase the inertia weight parameter when the particle swarm aggregation degree decreases;

[0048] Calculating a second Euclidean distance between each particle in the particle swarm and the global optimal solution, and adaptively adjusting the fitness difference of the particles using an exponential function based on the second Euclidean distance, wherein the fitness difference of the particles dynamically adjusts cognitive item parameters and social item parameters as the second Euclidean distance changes, wherein the cognitive item parameters increase as the second Euclidean distance increases, and the social item parameters decrease as the second Euclidean distance increases;

[0049] Combining Lukist mapping with tent mapping to generate a chaotic sequence, wherein the weight coefficient of the chaotic sequence decays linearly with iteration, and mapping the chaotic sequence to the boundary range of the particle swarm search space to form a nonlinear perturbation term;

[0050] Selecting the particle with the highest fitness from the particle swarm as the high-quality particle, applying a local search perturbation based on a 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 position difference of two randomly selected particles in the particle swarm and the adaptive search radius;

[0051] The distribution entropy is calculated based on the fitness distribution of each particle in the particle swarm, and the structural characteristics of the particle swarm are dynamically adjusted according to the size of the distribution entropy. When the distribution entropy is greater than a preset distribution entropy threshold, the structural characteristics of global transmission are adopted. When the distribution entropy is less than the preset distribution entropy threshold, the structural characteristics of local transmission are adopted, and the transmission probability between particles is adaptively adjusted;

[0052] The inertia weight parameter, dynamic learning factor, nonlinear perturbation term, local search result and structural feature are applied to the position and velocity update process of the particle swarm to obtain an updated particle swarm.

[0053] A second aspect of an embodiment of the present invention provides a distributed power battery energy trading and scheduling system for a smart grid, comprising:

[0054] A first unit is configured to collect smart grid load distribution data and real-time status information of distributed power batteries, calculate a power demand curve for each region based on the smart grid load distribution data, wherein the real-time status information includes battery remaining capacity, charge and discharge power, and geographic location information, and divide the power batteries into a plurality of power battery trading groups based on charge and discharge power, remaining capacity, and geographic location based on the real-time status information and the power demand curve;

[0055] The second unit is used to build a federated learning node network based on the power battery trading group. The historical response time, battery health status, and transaction completion rate of buyers and sellers are used as operating data to input into a pre-trained multi-layer neural network for feature extraction. The gradient boosting decision tree algorithm is used to calculate the credit assessment score. Based on the credit assessment score, differentiated transaction quotas and credit thresholds are set for buyers and sellers in the power battery trading group.

[0056] The third unit is used to construct a spatiotemporal correlation graph based on the electricity demand curve and historical transaction data, extract the inter-regional electricity demand dependency using a graph attention algorithm, model the time series features in combination with a recurrent neural network, output the optimal transaction price range for each trading group in the next 24 hours, and generate a risk-controlled transaction matching strategy based on the optimal transaction price range and credit threshold;

[0057] The fourth unit is used to optimize and calculate the charging and discharging scheduling instructions including the charging and discharging period, charging and discharging power and target power based on the differentiated trading quota, the optimal trading price range and the trading matching strategy, while taking into account the maximization of trading revenue and the minimization of grid scheduling costs, using an improved particle swarm algorithm, and issue the charging and discharging scheduling instructions and execute transaction settlement.

[0058] According to a third aspect of the embodiments of the present invention,

[0059] An electronic device is provided, comprising:

[0060] processor;

[0061] a memory for storing processor-executable instructions;

[0062] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.

[0063] According to a fourth aspect of the embodiments of the present invention,

[0064] A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method described above is implemented.

[0065] 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, which effectively improves the transaction success rate and system security, and reduces the economic losses caused by transaction failures. The spatiotemporal correlation graph and graph attention algorithm are used to capture the dependency of power demand between regions, and the time series characteristics are modeled in combination with a recurrent neural network, which can accurately predict the optimal transaction price range for each time period, improve the accuracy of price prediction, and enhance the decision-making confidence of both parties to the transaction. The improved particle swarm algorithm is used to simultaneously consider the maximization of transaction benefits and the minimization of grid scheduling costs, and generate charging and discharging scheduling instructions that take into account both economic benefits and grid stability. While improving the utilization rate of distributed power battery resources, it effectively smoothes the grid load fluctuations and improves the operating efficiency and reliability of the smart grid. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] Figure 1 Schematic diagram of the process of a distributed power battery energy trading and scheduling method for a smart grid according to an embodiment of the present invention;

[0067] Figure 2 This is a comparison chart of feature processing accuracy corresponding to the distributed power battery energy trading and scheduling method for the smart grid according to an embodiment of the present invention;

[0068] Figure 3 This is a radar chart of multi-scenario performance evaluation corresponding to the distributed power battery energy trading and scheduling method for the smart grid according to an embodiment of the present invention. DETAILED DESCRIPTION

[0069] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0070] The following specific embodiments are used to describe the technical solution of the present invention in detail. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0071] Figure 1 FIG. 1 is a flow chart of a distributed power battery energy trading and scheduling method for a smart grid according to an embodiment of the present invention. Figure 1 As shown, the method includes:

[0072] collecting smart grid load distribution data and real-time status information of distributed power batteries, calculating a power demand curve for each region based on the smart grid load distribution data, the real-time status information including battery remaining capacity, charge and discharge power, and geographic location information, and dividing the power batteries into a plurality of power battery trading groups based on charge and discharge power, remaining capacity, and geographic location based on the real-time status information and the power demand curve;

[0073] A federated learning node network is built based on the power battery trading group. The historical response time, battery health status, and transaction completion rate of buyers and sellers are used as operational data input into a pre-trained multi-layer neural network for feature extraction. A gradient boosting decision tree algorithm is used to calculate a credit assessment score. Based on this credit assessment score, differentiated trading quotas and credit thresholds are set for buyers and sellers within the power battery trading group.

[0074] Based on the electricity demand curve and historical transaction data, a spatiotemporal correlation graph is constructed. The inter-regional electricity demand dependency is extracted using a graph attention algorithm. A recurrent neural network is combined to model the time series features. The optimal transaction price range for each trading group in the next 24 hours is output. A risk-controlled transaction matching strategy is generated based on the optimal transaction price range and credit threshold.

[0075] Based on the differentiated trading quotas, optimal trading price range and trading matching strategy, while taking into account the maximization of trading revenue and the minimization of grid dispatching costs, an improved particle swarm algorithm is used to optimize and calculate the charging and discharging scheduling instructions including the charging and discharging period, charging and discharging power and target power, and the charging and discharging scheduling instructions are issued and transaction settlement is executed.

[0076] In an optional embodiment,

[0077] Collecting smart grid load distribution data and real-time status information of distributed power batteries, calculating power demand curves for each region based on the smart grid load distribution data, wherein the real-time status information includes battery remaining capacity, charge and discharge power, and geographic location information, and dividing the power batteries into multiple power battery trading groups based on charge and discharge power, remaining capacity, and geographic location based on the real-time status information and the power demand curve, including:

[0078] Collect smart grid load distribution data, including real-time load rates of regional distribution transformers, historical electricity load curves, and time-of-use electricity price information. Based on the smart grid load distribution data, use a combination of Fourier series decomposition and wavelet transform to perform periodic analysis and trend extraction on the historical electricity load curves, and calculate the time-of-use electricity demand curves for each region over the next 24 hours.

[0079] Obtaining real-time status information of distributed power batteries, the real-time status information including the remaining battery capacity, charge and discharge power, and geographic location information, wherein the charge and discharge power includes maximum charge power, maximum discharge power, and charge and discharge efficiency, and calculating the amount of electricity available for participation in electric energy trading based on the remaining battery capacity and charge and discharge efficiency;

[0080] Based on the electricity demand curve and real-time status information, the geographical distance and transmission loss between the power batteries and the load centers in each region are calculated. Combined with the degree of matching between the tradable power of the power batteries and the regional electricity demand, an improved hierarchical clustering algorithm is used to adaptively group the power batteries. The deviation of the charge and discharge characteristics of the power batteries in the same group does not exceed 5%, and the geographical distribution does not exceed the preset maximum grouping distance. The number of groups is dynamically adjusted according to real-time trading demand.

[0081] Collect smart grid load distribution data, including real-time load rates of regional distribution transformers, historical load curves, and time-of-use electricity pricing information. For example, in District A of a city, real-time load rate data is collected every five minutes for 10 distribution transformer nodes within the area, with historical load rate data for the past seven days recorded. Time-of-use electricity pricing information for the area is also obtained, such as 1.2 yuan / kWh for peak hours (10:00-15:00, 18:00-21:00), 0.8 yuan / kWh for off-peak hours (7:00-10:00, 15:00-18:00, 21:00-23:00), and 0.4 yuan / kWh for off-peak hours (23:00-7:00 the following day).

[0082] Perform 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, analysis found that the load peaks on weekdays occur between 9:00-11:00 and 19:00-21:00, while the weekend load peaks are mainly concentrated between 10:00-14:00. Then, use the wavelet transform method to perform multi-scale analysis on the load curve and separate the trend term, periodic term, and random term. By analyzing the wavelet coefficients, identify the mutation points and outliers in the load curve, such as the sudden increase in electricity load under special weather conditions.

[0083] Based on the analysis results, combined with external factors such as weather forecast data, holiday information, and regional event schedules, the system calculates the power demand curve for each region over the next 24 hours. For example, the power demand for transformer node No. 1 in Area A is predicted to be 320kW from 7:00 AM to 8:00 AM the next day, and 450kW from 8:00 AM to 9:00 AM. This forecast is repeated for all 24 time periods throughout the day.

[0084] Obtain real-time status information for distributed power batteries. Taking electric vehicles within the city as an example, the IoV platform collects real-time battery status information for electric vehicles, including remaining battery capacity (SOC), maximum charging power, maximum discharging power, charging and discharging efficiency, and GPS positioning information. For example, electric vehicle number EV001 has a current SOC of 75%, a battery capacity of 60kWh, a maximum charging power of 7kW, a maximum discharging power of 10kW, a charging efficiency of 92%, a discharging efficiency of 95%, and a current location of 116.3° longitude and 39.9° latitude.

[0085] The amount of electricity available for electricity trading is calculated based on the battery's remaining charge and charge / discharge efficiency. For electric vehicle EV001, assuming the owner sets a minimum SOC of 20%, the amount of electricity that can be discharged is (75% - 20%) × 60kWh × 95% = 31.35kWh. If the owner plans to charge to 90%, the amount of electricity that can be charged is (90% - 75%) × 60kWh ÷ 92% = 9.78kWh.

[0086] Based on the electricity demand curve and real-time battery status information, power battery trading groups are divided. The geographical distance between the power battery and each regional load center and the transmission loss are calculated. For example, Transformer No. 1 in Area A is located at longitude 116.32° and latitude 39.91°, approximately 2.5 kilometers from electric vehicle No. EV001. Based on a transmission loss rate of 0.5% / km, the estimated transmission loss is 1.25%.

[0087] Evaluate the degree of match between the tradable power of the power battery and the regional electricity demand. For example, during the predicted peak power demand period of 7:00 PM to 9:00 PM, the load rate of Transformer No. 1 in Area A will reach 85%, requiring additional power supply. The discharge power and power provided by EV001 can partially meet this demand, resulting in a matching score of 85 out of 100.

[0088] An improved hierarchical clustering algorithm is used to adaptively group power batteries. Clustering parameters are first set: the charge and discharge characteristics of power batteries within a group must not vary by more than 5%, and their geographic distribution must not exceed a preset maximum grouping distance (e.g., 5 kilometers). For Area A, the initial number of groups is set to five. Through a bottom-up hierarchical clustering process, similar power batteries are gradually merged.

[0089] During the clustering process, similarity metrics between power batteries were defined, including: charge and discharge power similarity, SOC level similarity, geographic proximity, and overlap in available time periods. For example, electric vehicles numbered EV001 and EV008, with maximum discharge powers of 10kW and 9.5kW (5% deviation), SOC levels of 75% and 72% (4% deviation), and a geographic distance of 1.2 kilometers, were both able to discharge between 6:00 PM and 10:00 PM. Their similarity score was 92, and they were therefore grouped together.

[0090] The number of groups is dynamically adjusted based on real-time transaction demand. For example, during peak hours, if the system detects that multiple transformers in Area A are over 90% loaded, the system increases the number of discharging groups to eight to provide more granular power support. During off-peak hours, the system consolidates the groups into three charging groups for centralized charging scheduling.

[0091] Dynamically adjusted power battery trading groups are formed. For example, during the 7:00 PM period on a certain day, three discharging groups and two charging groups were formed in Area A: Discharging Group 1 consisted of 15 electric vehicles with a total discharge power of 145 kW, primarily supporting transformers 1 and 2; Discharging Group 2 consisted of 12 electric vehicles with a total discharge power of 118 kW, primarily supporting transformers 3 and 4; Discharging Group 3 consisted of 18 electric vehicles with a total discharge power of 172 kW, primarily supporting transformers 5 through 7. Charging Groups 1 and 2 were respectively arranged to charge in areas with lower loads on transformers 8 through 10.

[0092] In this embodiment, the Fourier series decomposition method is used to identify multiple periodic features in the load curve, and the wavelet transform is used for multi-scale analysis to effectively separate the trend term, periodic term and random term, which can accurately grasp the regional power consumption pattern and improve the accuracy of load prediction. The improved hierarchical clustering algorithm is used to group the power batteries. By setting the charge and discharge characteristic deviation threshold and the maximum group distance limit, the homogeneity of the power batteries in the same group is ensured, and the accuracy and efficiency of group scheduling are improved. Through reasonable group division and dynamic adjustment, the optimal configuration of electric energy in the time and space dimensions is achieved, effectively improving the operating efficiency and reliability of the distribution network.

[0093] In an optional embodiment,

[0094] A federated learning node network is built based on the power battery trading group. The historical response time, battery health status, and transaction completion rate of buyers and sellers are used as operating data to input into a pre-trained multi-layer neural network for feature extraction. A gradient boosting decision tree algorithm is used to calculate the credit assessment score. Based on the credit assessment score, differentiated transaction quotas and credit thresholds are set for buyers and sellers in the power battery trading group, including:

[0095] Building a federated learning node network based on a power battery trading group, with buyers and sellers in the power battery trading group acting 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, internal resistance growth rate, and voltage consistency.

[0096] Normalizing and standardizing the historical response time, the battery health status, and the transaction completion rate, performing segmented sampling on the preprocessed data using a sliding time window to generate a training sample set, and forming the training sample set into operating data;

[0097] Inputting the operating data into a pre-trained multi-layer neural network for feature extraction, the multi-layer neural network consisting of an input layer, a first hidden layer, a second hidden layer, a third hidden layer, and an output layer, wherein the first hidden layer, the second hidden layer, and the third hidden layer use a rectified linear unit activation function with a random dropout mechanism, the output layer generates a feature vector, and constructs a multi-objective loss function based on the Euclidean distance between the feature vector and a target feature vector and a norm of a network weight;

[0098] Performing federated average training in the federated learning node network, each federated learning node calculates a local gradient based on local data, encrypts the local gradient using a differential privacy mechanism, and transmits the encrypted local gradient to an aggregation server. The aggregation server performs a weighted average of the local gradients based on the number of samples and data quality scores of each federated learning node to obtain a global gradient, and updates global model parameters based on the global gradient;

[0099] After enhancing the feature vector, the algorithm is fed 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 minimization of a pre-constructed progressive constraint loss function. In the leaf node region of the decision tree, the optimal prediction value is calculated based on the Newton method and the Hessian matrix. The learning rate is dynamically adjusted based on the convergence rate of the loss function, and a credit assessment score is output.

[0100] Based on the credit assessment score, differentiated transaction quotas and credit thresholds are set for buyers and sellers in the power battery transaction group.

[0101] A federated learning node network is constructed based on a power battery trading group. In actual applications, a battery trading platform contains 100 trading entities. Each entity acts as an independent federated learning node, maintaining its own historical response time, battery health status, and transaction completion rate data. 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 for 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%.

[0102] The raw data is preprocessed. The system uses min-max normalization to map each metric to the [0, 1] range. Z-score normalization is then performed to achieve a mean of 0 and a standard deviation of 1. For example, node A's response time of 2.5 hours is normalized to 0.25 (assuming a maximum of 10 hours and a minimum of 0 hours). After further normalization, it might become -0.8 (indicating faster than average). The system uses a sliding window mechanism with a 30-day window length and a step size of 5 days. 12 training samples are generated from 90 days of data to form the operational data for node A.

[0103] The preprocessed running data is fed into a pretrained multi-layer neural network for feature extraction. The network consists of an input layer (15 neurons, corresponding to the three-day averages of five 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 a Reluctant Unified Unit (ReLU) activation function with a 25% dropout rate to prevent overfitting. For example, a piece of data from node A, after being processed by the network, might generate the feature vector [0.72, 0.85, 0.63, 0.91, 0.77, 0.82, 0.69, 0.88]. The system calculates the Euclidean distance between this feature vector and the preset high-credit target feature vector [0.9, 0.9, 0.8, 0.95, 0.85, 0.9, 0.8, 0.95] and combines it with the first-norm of the network weights to construct a multi-objective loss function.

[0104] During the federated learning training phase, each node calculates a local gradient using local data. To protect data privacy, the system adds noise to the local gradients, following a Laplace distribution (mean 0, scale parameter 0.1) to achieve differential privacy. For example, the gradient of a parameter calculated by node A as 0.35 might become 0.32 after adding noise. Each node transmits the encrypted local gradients to the aggregator. The aggregator performs a weighted average based on the node's sample size and data quality score. For example, if node A has 100 samples and a quality score of 0.9, the weight might be 0.045. The aggregator aggregates the weighted gradients of all nodes to derive a global gradient, which it uses to update the global model parameters. The updated model is then distributed to each node.

[0105] After feature extraction, the system enhances the feature vector, concatenating the original feature vector with its historical mean, variance, maximum, and minimum values ​​to form an expanded feature vector. For example, the 8-dimensional feature vector of node A is expanded to a 40-dimensional feature vector. The enhanced feature vector is then fed into the gradient boosting decision tree algorithm for credit assessment.

[0106] Using the XGBoost framework and a second-order derivative optimization algorithm, 100 decision trees with a maximum depth of 5 were constructed. The log-likelihood loss function was minimized through negative gradient iteration. At the leaf nodes of the decision tree, the optimal prediction value was calculated using the Newton method and the Hessian matrix. The initial learning rate was set to 0.1 and dynamically adjusted based on the convergence rate of the loss function. When the loss reduction was less than 0.01% over five consecutive iterations, the learning rate was reduced to 0.8 times the original value. The final output was a credit assessment score between 0 and 100. For example, the credit assessment score for node A was 87.5.

[0107] Differentiated transaction quotas and credit thresholds are set based on credit assessment scores. For users with a credit score of 90-100, the daily transaction quota is unlimited, and the minimum counterparty credit threshold is 60; for users with a credit score of 80-89, the daily transaction quota is 1 million yuan, and the minimum counterparty credit threshold is 65; for users with a credit score of 70-79, the daily transaction quota is 500,000 yuan, and the minimum counterparty credit threshold is 70; for users with a credit score of 60-69, the daily transaction quota is 200,000 yuan, and the minimum counterparty credit threshold is 75; for users with a credit score below 60, the daily transaction quota is 50,000 yuan, and the minimum counterparty credit threshold is 80.

[0108] In this embodiment, a sliding window mechanism is used for data sampling, preserving the temporal characteristics of historical transaction behavior while promptly reflecting the dynamic changes in the credit status of trading entities. By combining a federated learning architecture with a differential privacy mechanism, secure sharing of transaction data is achieved. By adding Laplace noise to local gradients, the effectiveness of model training is ensured while protecting individual data privacy. The combined application of feature enhancement and gradient boosting decision tree algorithms enables accurate credit scoring, differentiated transaction quotas, and credit threshold systems. This effectively balances trading activity and risk control, provides reasonable trading permissions for trading entities of different credit ratings, and significantly improves the security and reliability of the entire trading system.

[0109] In an optional embodiment,

[0110] After the feature vector is enhanced, it is input into the gradient boosting decision tree algorithm. The gradient boosting decision tree algorithm adopts a second-order derivative optimization algorithm to fit the decision tree by negative gradient iteration and minimization of a pre-built progressive constraint loss function. In the leaf node area of ​​the decision tree, the optimal prediction value is calculated based on the Newton method and the Hessian matrix, including:

[0111] Construct a hierarchical feature enhancement network, and enhance the input feature vector through the basic feature layer, interactive feature layer, and fusion feature layer. The basic feature layer calculates the statistical distribution information of the original features. The interactive feature layer generates a feature interaction matrix based on the statistical distribution information and extracts high-order correlation patterns between features. The fusion feature layer adaptively fuses the statistical distribution information and high-order correlation patterns to output an enhanced feature vector.

[0112] A prediction objective function based on the enhanced feature vector is constructed. The first-order and second-order Taylor expansions of the prediction objective function are performed to obtain the gradient information and Hessian matrix of the objective function. A regularized loss function for the prediction target is constructed based on the gradient information and the Hessian matrix. The regularization strength of the regularized loss function is dynamically adjusted based on the statistical distribution information to obtain an adaptive regularized loss term. The feature association consistency score is calculated based on the feature interaction matrix to obtain a feature association constraint term. The gradient information of the objective function, the adaptive regularized loss term, and the feature association constraint term are combined to form a progressive constraint loss function.

[0113] The enhanced feature vector is input into the gradient boosting decision tree algorithm. The second-order derivative optimization algorithm is used to calculate the first-order derivative of the objective function to obtain the negative gradient direction. The second-order derivative of the objective function is calculated and the Hessian matrix is ​​constructed. The feature gradient is reconstructed in combination with the feature interaction matrix to obtain the feature association perception gradient.

[0114] Based on the statistical distribution information, the data density and distribution deviation of the candidate split points are calculated and combined with the feature correlation perception gradient to construct a distribution-aware splitting criterion. According to the distribution-aware splitting criterion, the optimal splitting point is selected for node splitting to construct a decision tree;

[0115] In the leaf node area of ​​the decision tree, the second-order partial derivatives between feature pairs are calculated based on the feature interaction matrix to construct a second-order Hessian matrix, the feature association tensor is generated based on the high-order association pattern, the local distribution covariance is calculated in combination with the statistical distribution information, and the Newton method is used to optimize the calculation of the second-order Hessian matrix and the local distribution covariance, and the progressive constraint loss function is minimized to obtain the optimal prediction value considering the feature association.

[0116] A hierarchical feature enhancement network is constructed, consisting of a basic feature layer, an interactive feature layer, and a fusion feature layer. At the basic feature layer, statistical analysis is performed on the input feature vector, calculating the mean, variance, quantile, and other statistical distribution information for each feature. For example, for a vector containing features such as user age, consumption frequency, and browsing time, the mean of the age feature is 32.5, the variance is 8.7, the 25th percentile is 26, and the 75th percentile is 39; the mean of consumption frequency is 5.2 times / month, the variance is 2.3, and the skewness is 0.8; and the mean of browsing time is 45 minutes / day, with a standard deviation of 15 minutes.

[0117] At the interactive feature layer, a feature interaction matrix is ​​generated based on statistical distribution information. Specifically, this is achieved by calculating 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 time is -0.28, and the correlation coefficient between consumption frequency and browsing time is 0.62. A feature interaction matrix is ​​then constructed based on the correlation coefficients, and high-order correlation patterns between features are extracted through a deep cross-network. For example, the high-order correlation pattern identified is that users aged 25-35 and browsing time longer than 60 minutes typically have a consumption frequency 1.5 times higher than the average.

[0118] At the fusion feature layer, an attention mechanism is used to adaptively fuse statistical distribution information and high-order correlation patterns. Weights are assigned to each feature, such as 0.25 for age, 0.40 for purchase frequency, and 0.35 for browsing duration. Weights are also assigned to high-order correlation patterns, such as 0.55 for the "age-browsing duration-purchase frequency" correlation pattern. This weighted fusion outputs an enhanced feature vector, expanding its dimensionality from the original n-dimensionality to 2n-dimensionality.

[0119] Construct a prediction objective function based on the enhanced feature vector. Perform first- and second-order Taylor expansions on the prediction objective function to obtain its gradient information and Hessian matrix. For example, for a binary classification problem, the objective function is a logarithmic loss function, with a calculated first-order gradient of 0.28 and a second-order gradient of 0.15. Based on the gradient information and the Hessian matrix, construct a regularized loss function for the prediction objective, with an initial regularization coefficient of 0.1.

[0120] The regularization strength of the regularization loss function is dynamically adjusted based on statistical distribution information. For features with large variance (such as browsing time), the regularization coefficient is adjusted to 0.08; for features with skewed distributions (such as consumption frequency), the regularization coefficient is adjusted to 0.12, resulting in an adaptive regularization loss term. The feature association consistency score is calculated based on the feature interaction matrix. For example, the association consistency score between age and consumption frequency is 0.78, resulting in a feature association constraint term. The gradient information of the objective function, the adaptive regularization loss term, and the feature association constraint term are combined to form a progressive constraint loss function.

[0121] The enhanced feature vector is input into the gradient boosting decision tree algorithm. A second-order derivative optimization algorithm is used to calculate the first-order derivative of the objective function, yielding a negative gradient direction. For example, for sample 1, the negative gradient direction is -0.35. The second-order derivative of the objective function is calculated and the Hessian matrix is ​​constructed. For example, for sample 1, the second-order derivative value is 0.22. The feature gradients are reconstructed using the feature interaction matrix. The gradient information of highly correlated feature pairs is weighted and combined to obtain the feature association perception gradient. For example, the association perception gradient of the consumption frequency feature is adjusted from -0.35 to -0.42.

[0122] The data density and distribution offset of candidate split points are calculated based on statistical distribution information. For example, for a candidate split point with an age feature value of 30, the data density is 0.15 and the distribution offset is 0.08. Combined with the feature association-aware gradient, a distribution-aware splitting criterion is constructed, resulting in a calculated splitting gain of 0.28. Based on the distribution-aware splitting criterion, the optimal split point is selected for node splitting and decision tree construction. For example, the split point with an age feature value of 32 has a splitting gain of 0.35, which is greater than that of other candidate split points.

[0123] At the leaf nodes of the decision tree, the second-order partial derivatives between feature pairs are calculated 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, so a 3×3 second-order Hessian matrix is ​​constructed. Feature correlation tensors are generated based on high-order correlation patterns, such as a third-order correlation strength of 0.42. Local distribution covariance is calculated based on statistical distribution information. For example, the local covariance between age and consumption frequency in leaf node 1 is 0.25.

[0124] The Newton method was used to optimize the second-order Hessian matrix and local distribution covariance, with an initial step size of 0.1. Convergence was achieved after five iterations, minimizing the progressive constraint loss function. The optimal prediction value considering feature associations was 0.78 for leaf node 1, 0.23 for leaf node 2, and 0.45 for leaf node 3.

[0125] In this embodiment, gradient information is adjusted through the feature interaction matrix, so that node splitting can simultaneously consider the combined influence of multiple related features. A distribution-aware splitting criterion is proposed, which takes into account the data density and distribution offset information of the features, thereby improving the accuracy of split point selection. In the calculation of leaf node prediction values, a second-order Hessian matrix containing feature correlation information is constructed and optimized in combination with the local distribution covariance, achieving accurate modeling of the sample distribution characteristics within the leaf node area.

[0126] In existing technologies, feature engineering typically uses simple feature combinations or statistical feature extraction methods, which make it difficult to fully explore the complex correlations between features and cannot adapt to dynamic changes in feature distribution. At the same time, traditional decision tree algorithms only consider the information gain of a single feature when splitting a node, ignoring the interaction between features, resulting in limited model prediction accuracy. In addition, existing technologies often use simple averaging or linear regression methods when calculating leaf node prediction values, failing to fully utilize the local distribution characteristics of features, which affects the local prediction ability of the model.

[0127] During the decision tree construction process, this embodiment improves the quality of node splitting through the feature association perception mechanism and enhances the model's ability to recognize feature combination patterns. In the leaf node prediction stage, the optimization calculation based on distribution characteristics improves the local prediction accuracy of the model and significantly improves the effect of feature engineering, enabling the model to adaptively capture the complex correlation relationships between features. While maintaining the interpretability of the model, it significantly improves the prediction accuracy and has stronger feature adaptability and robustness.

[0128] Figure 2 This is a comparison chart of feature processing accuracy corresponding to the distributed power battery energy trading and scheduling method of the smart grid according to an embodiment of the present invention. Figure 2As shown in the figure, the scatter line graph comprehensively demonstrates the prediction accuracy comparison of this technical solution and three mainstream gradient boosting decision tree algorithms (XGBoost, LightGBM and CatBoost) under different training sample sizes. 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 of this technical solution is 71.2%, while XGBoost is 69.5%, LightGBM is 68.8%, and CatBoost is 70.0%; when the sample size is 5,000, the accuracy of this technical solution is increased to 83.2%, which is much higher than XGBoost's 79.8%, LightGBM's 78.8% and CatBoost's 80.8%; when the sample size reaches 10,000, the accuracy of this technical solution is 88.6%, while the other three algorithms are 84.5%, 83.2% and 80.8% respectively. When the sample size further increased to 20,000, the accuracy of this technical solution reached 92.1%, ahead of XGBoost's 89.0%, LightGBM's 87.8%, and CatBoost's 89.6%. Finally, when the sample size reached 50,000, the accuracy of this technical solution climbed to 94.7%, 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%).

[0129] This comprehensive performance advantage stems from the hierarchical feature enhancement network employed by this technical solution. This network deeply mines input features through basic, interactive, and fused feature layers. Combined with a second-order derivative optimization algorithm and feature correlation-aware gradients, it achieves precise modeling of complex feature relationships. The figure also shows that the performance gap between this technical solution and other algorithms widens as the sample size increases. This demonstrates that this solution offers greater scalability and generalization capabilities in large-scale data scenarios, making it particularly suitable for high-accuracy scenarios in real-world business applications, such as precision medical diagnosis, financial risk assessment, and refined marketing.

[0130] In an optional embodiment,

[0131] Based on the electricity demand curve and historical transaction data, a spatiotemporal correlation graph is constructed. The inter-regional electricity demand dependency is extracted using a graph attention algorithm. Time series features are modeled using a recurrent neural network. The optimal transaction price range for each transaction group in the next 24 hours is output. A risk-controlled transaction matching strategy is generated based on the optimal transaction price range and credit threshold, including:

[0132] The previously acquired electricity demand curve is constructed into an electricity demand matrix. The transaction price, transaction number, default status, electricity consumption fluctuation and peak and valley electricity consumption characteristics are extracted from the historical transaction data to construct a transaction feature matrix. The adjacency matrix of the spatiotemporal association graph is constructed based on the geographic distance attenuation coefficient and electricity consumption pattern similarity between transaction groups.

[0133] Perform linear transformation on the feature vectors of nodes in the spatiotemporal association graph to obtain query vectors, key vectors, and value vectors. Calculate the inner product of the query vector and the key vector and normalize them to obtain the attention weight matrix. Multiply the attention weight matrix by the value vector to obtain weighted features. Multiple sets of weighted features are concatenated and nonlinearly transformed to obtain the power demand dependency relationship.

[0134] The power demand dependency is input into the recurrent neural network. The reset gate and update gate are used to control the fusion ratio of historical state information and current input information. The reset historical state and current input are nonlinearly transformed to obtain candidate states. The update gate is used to perform adaptive fusion to obtain time series features.

[0135] The price prediction features are obtained by fusing the time series features and the historical price series. Based on the price prediction features, a mixed probability distribution model containing Gaussian distribution and skewed distribution is constructed. The maximum expectation algorithm is used for iterative optimization to determine the optimal number of distributions. The weighted combination of the determined multiple probability distributions is used to obtain the conditional probability distribution of the price.

[0136] The optimal transaction price range is obtained by calculating the quantiles of the specified confidence interval based on the conditional probability distribution. The default probability is calculated based on the credit score of the transaction group and compared with the credit threshold. The overlap of the price ranges of the transaction groups that meet the credit constraints is determined, and a risk-controlled transaction matching strategy is output.

[0137] Obtain the electricity demand curve and historical transaction data for each trading group. The electricity demand curve is sampled once per hour over a 24-hour period, forming a 24-dimensional vector. For n trading groups, construct an n×24 electricity demand matrix D. For example, the electricity demand for a trading group over a 24-hour period might 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.

[0138] Transaction prices, transaction counts, defaults, electricity consumption fluctuations, and peak-valley electricity consumption characteristics are extracted from historical transaction data. For transaction prices, the average, maximum, minimum, and standard deviation over the past 30 days are calculated. For transaction counts, the total transaction volume over the past 30 days is calculated. For defaults, the number of defaults and the proportion of default amounts over the past 90 days are recorded. For electricity consumption fluctuations, the ratio of standard deviation to mean is calculated. For peak-valley electricity consumption characteristics, the ratio of peak to valley electricity consumption is calculated. These features are combined to form the transaction feature matrix F.

[0139] Construct an adjacency matrix A for the spatiotemporal correlation graph. Calculate the geographic distance between transaction groups and convert the physical distance into a weight coefficient using the Gaussian distance decay function. For example, if the distance between two groups is 50 kilometers, the decay coefficient might be 0.85; at a distance of 100 kilometers, the decay coefficient might drop to 0.65. Then, calculate the similarity of electricity usage patterns, using cosine similarity to measure the similarity between the two groups' electricity usage curves. The final adjacency relationship is obtained by weighting the distance decay coefficient with the electricity usage pattern similarity, forming an n×n adjacency matrix A.

[0140] In the graph attention algorithm, the feature vector of each node is transformed three times independently linearly to obtain the query vector Q, key vector K, and value vector V. For example, for the feature vector h_i of node i, it is transformed by 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.

[0141] To calculate attention weights, for node i and all of its neighboring nodes j, the inner product of Q_i and K_j is calculated and normalized using the softmax function to obtain the attention weight matrix. For example, the attention weights of node 1 for nodes 2, 3, and 4 might be [0.4, 0.35, 0.25]. The attention weights are multiplied by the value vector and summed to obtain the weighted features of the node. To capture different aspects of dependencies, eight attention heads are set up, each of which independently calculates weighted features. Finally, these features are concatenated and passed through a feedforward network to obtain the feature matrix R representing the power demand dependencies.

[0142] The power demand dependency R is input into the gated recurrent unit network. For the input x_t at time step t and the state h_{t-1} at the previous time step, a reset gate r_t and an update gate z_t are calculated. The reset gate controls the degree of retention of historical information, while the update gate controls the degree of incorporation of new information. For example, during peak hours, the update gate value might be high (e.g., 0.8), indicating that the current input information is more weighted; during stable periods, the update gate value might be low (e.g., 0.3), indicating that the historical state information is more weighted.

[0143] The reset historical state is nonlinearly transformed with the current input to obtain a candidate state. Based on the value of the update gate, the candidate state is adaptively fused with the state at the previous moment to obtain the current state h_t, which represents the time series characteristics. For example, the time series characteristics of a trading group at a specific moment may be a 128-dimensional vector that captures the temporal dynamics of the group's electricity demand.

[0144] The time series feature h_t is fused with the historical price series to obtain the price prediction feature p_t. Based on p_t, a mixed probability distribution model is constructed, which contains a weighted combination of multiple Gaussian distributions and skewed distributions. For example, three Gaussian distributions and two skewed distributions can be initialized to capture different distribution characteristics of prices. The distribution parameters and weights are iteratively optimized using the maximum expectation algorithm until the log-likelihood function converges or the maximum number of iterations (e.g., 100) is reached.

[0145] After determining the optimal number of distributions, we weightedly combine the multiple probability distributions to obtain the conditional probability distribution of the price. Based on this distribution, we calculate the upper and lower quantiles of the 90% confidence interval to obtain the optimal transaction price range [P_lower, P_upper]. For example, the optimal price range for a trading group between 8:00 and 9:00 in the future might be [0.52, 0.68] yuan / kWh.

[0146] The default probability is calculated based on the credit score of the trading group. Credit scores are calculated on a scale of 0-100, based on factors such as historical default records, transaction frequency, and fluctuations in transaction amounts. When the credit score falls below a set threshold (e.g., 60), the price range for that group is adjusted, raising the lower limit or lowering the upper limit to control risk. For example, for a group with a credit score of 55, the original price range of [0.52, 0.68] might be adjusted to [0.55, 0.65].

[0147] Check the overlap of price ranges between trading groups that meet credit constraints, identify buyers and sellers with overlapping price ranges, and generate a transaction matching strategy. For example, if the price range of seller group A is [0.55, 0.65] and the price range of buyer group B is [0.53, 0.62], then the match is successful and the recommended transaction price is the midpoint of the overlapping range, 0.585 yuan / kWh.

[0148] In this embodiment, by constructing a spatiotemporal-correlated electricity trading price prediction system, accurate matching and pricing between trading groups are achieved. By constructing an adjacency matrix of the spatiotemporal correlation graph, the geographical distance relationship and the similarity of electricity consumption patterns between different trading groups are effectively described, enabling the system to accurately grasp the correlation characteristics between groups. By introducing a credit scoring mechanism to dynamically adjust the price range, the credit risk factors of the trading entities are effectively incorporated into the pricing system, ensuring the balance of interests between the two parties to the transaction and increasing the possibility of transaction conclusion.

[0149] In an optional embodiment,

[0150] Based on the differentiated trading quotas, optimal trading price range, and trading matching strategy, while taking into account maximization of trading revenue and minimization of grid dispatching costs, an improved particle swarm optimization algorithm is used to optimize and calculate a charging and discharging scheduling instruction including charging and discharging time periods, charging and discharging power, and target power. The charging and discharging scheduling instruction is issued and transaction settlement is executed, including:

[0151] Constructing a charge and discharge scheduling instruction vector, wherein the charge and discharge scheduling instruction vector includes a charge and discharge period, a charge and discharge power, and a target power; calculating the difference between transaction revenue and grid dispatch cost based on the charge and discharge power; constructing a transaction revenue maximization objective function in combination with the battery loss cost; calculating the power regulation cost and the power fluctuation cost based on the charge and discharge power; and constructing a grid dispatch cost minimization objective function in combination with the power regulation cost and the power fluctuation cost;

[0152] Taking the transaction revenue maximization objective function and the grid dispatch cost minimization objective function as optimization objectives, constraints are imposed on the charge and discharge scheduling instruction vector, wherein the constraints include a quota constraint that limits the sum of the absolute values ​​of charge and discharge power based on differentiated transaction quotas, a price range constraint that limits the transaction price based on the optimal transaction price range, and an operation constraint that limits the charge and discharge power and state of charge based on a transaction matching strategy;

[0153] The constrained charge and discharge scheduling instruction vector 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 factor is dynamically updated according to the fitness difference of the particles. The inertia weight coefficient and the dynamic learning factor are used to update the particle velocity. The nonlinear perturbation generated by the chaotic map is applied to the particle position update process to obtain the updated particle swarm.

[0154] The updated particle swarm is evaluated, and the particles are non-dominatedly sorted using a fast hierarchical method based on dominance counting to obtain particle layers of different levels. Within the particle layers of the same level, the congestion of the particles is calculated based on the normalized distance of the objective function value. The non-dominated sorting results are combined with the congestion calculation results to generate the optimal solution set.

[0155] Based on the preset decision preference weights, a comprehensive evaluation is performed on the solutions in the optimal solution set, and the solution with the best comprehensive evaluation value is selected as the final charge and discharge scheduling instruction. The charge and discharge period, charge and discharge power and target power parameters are extracted according to the charge and discharge scheduling instruction, and the charge and discharge scheduling instruction is issued and transaction settlement is executed.

[0156] Construct a charge and discharge scheduling instruction vector, which includes three key parameters: charge and discharge period, charge and discharge power, and target power. The charge and discharge period is represented by a set of time intervals T = {t1, t2, ..., tn}, each lasting one hour. The charge and discharge power is represented by a sequence of power values ​​P = {p1, p2, ..., pn}, in kilowatts, with positive values ​​indicating discharge and negative values ​​indicating charge. The target power is represented by the power value E, in kilowatt-hours. Based on the charge and discharge power P, calculate the difference D = RC between the transaction revenue R and the grid dispatch cost C. The transaction revenue R is calculated by multiplying the electricity transaction price by the transaction power. For example, if the transaction price for a period t is 0.8 yuan / kWh and the discharge power is 100 kW, the transaction revenue for that period is 80 yuan. Also considered is the battery loss cost L, which is related to the charge and discharge depth and the number of cycles. For example, the loss cost for each complete cycle of a lithium battery is approximately 0.05 yuan / kWh. Combining the transaction revenue and battery loss cost, construct the transaction revenue maximization objective function F1 = RL.

[0157] The power regulation cost A and power fluctuation cost B are calculated based on the charge and discharge power. Power regulation cost A reflects the cost incurred by the grid for regulating generator output and is proportional to the amount of power regulation, with a regulation coefficient of 0.15 yuan / kilowatt. Power fluctuation cost B represents the impact of power variations between time periods on grid stability and is proportional to the rate of power change, with a fluctuation coefficient of 0.08 yuan / kilowatt. The power regulation cost and power fluctuation cost are combined to form the grid dispatch cost minimization objective function F2 = A + B.

[0158] Taking the objective function F1 to maximize transaction revenue and the objective function F2 to minimize grid dispatch costs as optimization objectives, three types of constraints are imposed on the charge and discharge scheduling instruction vector: quota constraints, price range constraints, and operational constraints. Quota constraints limit the sum of the absolute values ​​of charge and discharge power based on differentiated transaction quotas. For example, the peak-period quota is 300 kilowatts, the normal-period quota is 200 kilowatts, and the valley-period quota is 400 kilowatts. Price range constraints limit transaction prices based on the optimal transaction price range. For example, the lower limit of the discharge price is 0.75 yuan / kWh, and the upper limit of the charging price is 0.45 yuan / kWh. Operational constraints limit the charge and discharge power and state of charge based on the transaction matching strategy, including upper and lower power limits (such as ±500 kilowatts) and state of charge range constraints (such as 20%-90%).

[0159] The constrained charge and discharge scheduling instruction vector is encoded as the particle position in the particle swarm. Particle positions are represented as X = {x1, x2, ..., xn}, where xi corresponds to the charge and discharge power in time period i. The inertia weight coefficient w is adaptively adjusted based on the current iteration progress k. When k is less than half the total number of iterations K, w is linearly reduced from 0.9 to 0.4; when k is greater than or equal to half of K, w remains at 0.4. The learning factors c1 and c2 are dynamically updated based on particle fitness differences. Particles with good fitness are assigned a larger cognitive learning factor c1 (e.g., 2.5) and a smaller social learning factor c2 (e.g., 1.5), while particles with poor fitness receive the opposite. The inertia weight coefficient w and the dynamic learning factors c1 and c2 are used to update the particle velocity V. The velocity update formula is: new velocity = w × old velocity + c1 × r1 × (individual optimal position - current position) + c2 × r2 × (global optimal position - current position), where r1 and r2 are random numbers between 0 and 1. The nonlinear perturbation δ generated by the chaotic map is applied to the particle position update process, and the new position = old position + new velocity + δ. The amplitude of δ gradually decreases with the iteration, with an initial value of 10% of the original position and eventually decreasing to 1%.

[0160] The updated particle swarm is evaluated and non-dominated sorting is performed using a fast hierarchical method based on domination counts. The condition for particle i to dominate particle j is: F1(i) ≥ F1(j) and F2(i) ≤ F2(j), and at least one inequality holds. By calculating the domination count and dominated set of each particle, particles are divided into different levels of particle strata. Within the same level of particle strata, the crowding degree of particles is calculated based on the normalized distance of the objective function value. A higher crowding degree indicates a sparser solution space around the particle. The non-dominated sorting results are combined with the crowding degree calculation results to generate the optimal solution set S.

[0161] The solutions in the optimal solution set S are comprehensively evaluated based on the preset decision preference weights w1 and w2. The comprehensive evaluation value V = w1 × normalized value of F1 + w2 × (1 - normalized value of F2), where w1 + w2 = 1. For example, when transaction revenue and grid dispatch costs are equally important, w1 = w2 = 0.5 can be set; when transaction revenue is more important, w1 = 0.7 and w2 = 0.3 can be set. The solution with the optimal comprehensive evaluation value V is selected as the final charge and discharge scheduling instruction, from which the charge and discharge period, charge and discharge power, and target power parameters are extracted.

[0162] For example, a storage power station has a capacity of 1,000 kWh and a maximum charge and discharge power of ±500 kW. The 24-hour charge and discharge scheduling instructions calculated using this method are: charging powers of -300, -350, -400, -350, -250, and -200 kW for periods 1-6, respectively; discharging powers of 400, 450, and 400 kW for periods 13-15; and 350, 400, and 300 kW for periods 19-21; with zero power for the remaining periods. The target power is 2,800 kWh, with an estimated transaction revenue of 2,150 yuan, a reduction of 320 yuan in grid dispatch costs, and 140 yuan in battery loss costs, for a total profit of 2,330 yuan. Transaction settlement based on this scheduling instruction resulted in actual profits in line with expectations.

[0163] In this embodiment, an adaptive particle swarm algorithm is used for solving the problem. The convergence performance of the algorithm is significantly improved through the dynamic adjustment of the inertia weight and the adaptive update of the learning factor. The introduction of chaotic mapping to generate nonlinear perturbations effectively avoids the algorithm from falling into the local optimum and enhances the diversity of solutions. A fast hierarchical method of dominance counting is used for non-dominated sorting, and the solution is screened in combination with congestion calculation to ensure the quality and diversity of the final solution set. At the same time, multiple dimensions such as transaction revenue, battery loss cost and grid dispatch cost are taken into consideration. By designing a reasonable calculation method, the economic indicators of the energy storage system operation are accurately characterized, and the precise control of the charge and discharge scheduling of the energy storage system is achieved. While ensuring the safe and stable operation of the system, the economic benefits are significantly improved, providing effective technical support for the intelligent dispatch of the energy storage system.

[0164] In an optional embodiment,

[0165] Adaptively adjust the inertia weight coefficient based on the current iteration progress, dynamically update the learning factor according to the fitness difference of the particles, use the inertia weight coefficient and the dynamic learning factor to update the particle velocity, and apply the nonlinear perturbation generated by the chaotic map to the particle position update process to obtain the updated particle swarm.

[0166] For the current particle swarm, calculate the particle swarm diversity index, obtain the particle swarm aggregation degree under 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 nonlinear function according to the particle swarm aggregation degree, and increase the inertia weight parameter when the particle swarm aggregation degree decreases;

[0167] Calculating a second Euclidean distance between each particle in the particle swarm and the global optimal solution, and adaptively adjusting the fitness difference of the particles using an exponential function based on the second Euclidean distance, wherein the fitness difference of the particles dynamically adjusts cognitive item parameters and social item parameters as the second Euclidean distance changes, wherein the cognitive item parameters increase as the second Euclidean distance increases, and the social item parameters decrease as the second Euclidean distance increases;

[0168] Combining Lukist mapping with tent mapping to generate a chaotic sequence, wherein the weight coefficient of the chaotic sequence decays linearly with iteration, and mapping the chaotic sequence to the boundary range of the particle swarm search space to form a nonlinear perturbation term;

[0169] Selecting the particle with the highest fitness from the particle swarm as the high-quality particle, applying a local search perturbation based on a 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 position difference of two randomly selected particles in the particle swarm and the adaptive search radius;

[0170] The distribution entropy is calculated based on the fitness distribution of each particle in the particle swarm, and the structural characteristics of the particle swarm are dynamically adjusted according to the size of the distribution entropy. When the distribution entropy is greater than a preset distribution entropy threshold, the structural characteristics of global transmission are adopted. When the distribution entropy is less than the preset distribution entropy threshold, the structural characteristics of local transmission are adopted, and the transmission probability between particles is adaptively adjusted;

[0171] The inertia weight parameter, dynamic learning factor, nonlinear perturbation term, local search result and structural feature are applied to the position and velocity update process of the particle swarm to obtain an updated particle swarm.

[0172] Initialize the particle swarm. Randomly generate N particles in the D-dimensional search space. Each particle has a position vector and a velocity vector. The position vector represents a potential solution, and the velocity vector represents the particle's movement direction and step size. For example, generate 50 particles in a 10-dimensional space with a position range of [-100, 100] and an initial velocity range of [-10, 10].

[0173] 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 degree of aggregation of the particle swarm. Specifically, first calculate the average of all particle positions, then calculate the Euclidean distance between each particle and this average position, and finally take the average of these distances as the particle swarm aggregation index. For example, when this index value is less than 0.5, it indicates that the particle swarm is overly aggregated.

[0174] Dynamically adjust the inertia weight based on the degree of particle swarm aggregation. A nonlinear function is used to achieve adaptive adjustment of the inertia weight. When the particle swarm aggregation decreases, the inertia weight parameter is increased, and vice versa. In practice, the inertia weight can be set to a base value of 0.7. When the aggregation index is less than 0.3, the inertia weight is adjusted to 0.9; when the aggregation index is greater than 0.8, the inertia weight is adjusted to 0.4. In other cases, the inertia weight value is calculated using linear interpolation.

[0175] Calculate the Euclidean distance between the particle and the global optimal solution. For each particle in the swarm, calculate the Euclidean distance between it and the current global optimal solution, which is used to dynamically adjust the learning factor. For example, for the i-th particle, calculate its Euclidean distance dist_i from the global optimal solution.

[0176] Adaptively adjust the learning factor based on Euclidean distance. Use an exponential function to dynamically adjust cognitive and social parameters, so that cognitive parameters increase with Euclidean distance and social parameters decrease with Euclidean distance. In practice, the baseline value of cognitive parameter c1 can be set to 1.5, and the baseline value of social parameter c2 can be set to 1.5. When the distance between a particle and the global optimal solution is greater than a threshold (e.g., 10), c1 is adjusted to 2.0 and c2 to 1.0; when the distance is less than a threshold (e.g., 2), c1 is adjusted to 1.0 and c2 to 2.0.

[0177] Generate a chaotic sequence as a nonlinear perturbation. This chaotic sequence is generated by combining the Roadquist map and the tent map. The initial value x0 = 0.7 is selected. The Roadquist map is iteratively calculated to obtain the sequence {x1, x2, ...}. This sequence is then input 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, starting from 0.1 and eventually decaying to 0.01. The chaotic sequence is mapped to the boundaries of the search space to form a nonlinear perturbation term.

[0178] Implement a local search strategy. The top 5% of particles with the highest fitness are selected from the swarm as quality particles. A local search perturbation based on a random difference vector is applied to each quality particle. Specifically, two particles are randomly selected from the swarm, the difference between their positions is calculated, and the difference is multiplied by the adaptive search radius (initial value 0.5, linearly decaying to 0.1 with iterations) to obtain a random difference vector. This vector is then added to the quality particle position to obtain a candidate solution. If the candidate solution has a better fitness than the original particle, the original particle is replaced with the candidate solution.

[0179] Dynamically adjust the particle swarm structure. The distribution entropy is calculated based on the particle swarm's fitness distribution. The specific method is to normalize the fitness value and divide it into 10 intervals. The proportion of the number of particles in each interval is counted, and the entropy of these proportions is calculated. When the distribution entropy is greater than the preset threshold of 0.8, a global transfer structure is adopted (each particle can interact with any other particle); when the distribution entropy is less than 0.8, a local transfer structure is adopted (each particle only interacts with its neighbors). At the same time, the transfer probability between particles is adaptively adjusted based on the distribution entropy. The greater the distribution entropy, the higher the transfer probability.

[0180] Update particle velocity and position. This update takes into account the inertia weight parameters, dynamic learning factors, nonlinear perturbation terms, local search results, and structural features calculated above. For velocity updates, the inertia term uses the adaptively adjusted inertia weight, while the cognitive and social terms use the dynamically adjusted learning factors c1 and c2, respectively. For position updates, the standard position update formula is supplemented with a nonlinear perturbation term generated by a chaotic sequence.

[0181] Experimental results on the test function Rastrigin show that the proposed method achieves an optimal solution of 0.00021 after 1,000 iterations in 30 dimensions, while the standard PSO algorithm achieves an optimal solution of 0.15673, a significant improvement. On the Griewank function, the proposed method converges approximately 35% faster than the standard PSO algorithm.

[0182] In this embodiment, by introducing a particle swarm diversity indicator, the degree of swarm aggregation is monitored in real time, and the inertia weight is dynamically adjusted based on this indicator, effectively avoiding the premature convergence problem caused by the premature aggregation of the particle swarm. By calculating the Euclidean distance between the particles and the global optimal solution, adaptive adjustment of the learning factor is achieved, so that particles far from the optimal solution focus more on individual cognition, while particles close to the optimal solution focus more on social learning, thereby enhancing the search ability of the algorithm.

[0183] In existing technologies, traditional particle swarm optimization algorithms often face problems such as slow convergence, easy falling into local optimality, and difficulty maintaining swarm diversity when solving complex optimization problems. Most of these problems are caused by fixed algorithm parameters, a single particle update strategy, and a static swarm structure. These algorithms are unable to adapt to the dynamic characteristics of the search process, thus reducing the algorithm's search efficiency and solution quality.

[0184] In this embodiment, the chaotic sequence is generated by combining the road-quister mapping and the tent mapping, which is introduced as a nonlinear perturbation term into the particle position update process, thereby improving the algorithm's ability to escape the local optimum. By implementing a local search strategy based on random difference vectors for high-quality particles, the algorithm's local refined search capability is enhanced. A dynamic topological structure adjustment mechanism based on fitness distribution entropy is introduced, and the global and local transmission structures are adaptively switched according to the group distribution characteristics. The transmission probability between particles is dynamically adjusted, thereby optimizing the group information exchange efficiency and providing effective technical support for solving practical engineering optimization problems.

[0185] Figure 3 This is a radar chart of multi-scenario performance evaluation corresponding to the distributed power battery energy trading and scheduling method of the smart grid according to an embodiment of the present invention, such as Figure 3 As shown in the figure, the radar chart comprehensively shows the comparison of the proposed technology solution with three representative particle swarm optimization algorithms (standard PSO, CLPSO, and APSO) on six key performance indicators. It can be clearly seen from the figure that the proposed technology solution shows significant performance advantages in all evaluation dimensions.

[0186] In terms of optimization accuracy, this technical solution achieved an extremely high level of 95%, far exceeding the 50% of the standard PSO, and significantly higher than the 70% of CLPSO and 80% of APSO. This accuracy advantage is mainly due to the synergy between the adaptive learning factor adjustment mechanism and the local search strategy in this technical solution, which enables the algorithm to conduct a detailed search after finding the global optimal region, achieving a high-precision solution.

[0187] In terms of convergence speed, this technical solution achieved a score of 90%, 30 percentage points higher than the standard PSO's 60%, 15 percentage points higher than the CLPSO's 75%, and 10 percentage points higher than the APSO's 80%. This is due to the fact that this technical solution dynamically adjusts the inertia weight based on the current iteration progress and the degree of particle swarm aggregation, accelerating the algorithm's convergence process. Furthermore, the chaotic sequence generated by combining the Roadster mapping with the tent mapping ensures that the algorithm can escape the local optimal trap.

[0188] In terms of resistance to premature maturation, this technical solution scored 85%, significantly better than the 55% of the standard PSO, and higher than the 70% of the CLPSO and 75% of the APSO. Traditional PSO algorithms often converge prematurely during iterations. However, this technical solution effectively prevents the particle swarm from prematurely falling into local optimality by dynamically adjusting the structural characteristics driven by distributed entropy and introducing nonlinear perturbation terms.

[0189] Global search capability is one of the core metrics of the particle swarm algorithm. This solution achieved a score of 90% in this regard, far exceeding the 55% of the standard PSO, and significantly higher than the 75% of the CLPSO and 80% of the APSO. This excellent global search capability stems from the dynamic balance between cognitive and social parameters in this solution, as well as the nonlinear perturbations generated by the chaotic sequence, which enable the algorithm to conduct a comprehensive and effective exploration of the solution space.

[0190] In terms of computational efficiency, this solution achieved an 85% score, significantly higher than the 55% of the standard PSO, and also better than the 70% of the CLPSO and 75% of the APSO. This high efficiency is primarily attributed to the solution's parameter adjustment strategy based on particle fitness differences and its local search mechanism for high-quality particles, which reduces the number of iterations and computational overhead required for the algorithm to converge.

[0191] In summary, this technical solution achieves a comprehensive improvement in the performance of the particle swarm optimization algorithm through innovative mechanisms such as adaptive adjustment of the inertia weight coefficient, dynamic update of the learning factor based on particle fitness differences, generation of nonlinear perturbations by chaotic mapping, local search of high-quality particles, and structural feature adjustment driven by distributed entropy, providing a more efficient, stable and accurate solution tool for complex optimization problems.

[0192] The distributed power battery energy trading and dispatching system for smart grids includes:

[0193] A first unit is configured to collect smart grid load distribution data and real-time status information of distributed power batteries, calculate a power demand curve for each region based on the smart grid load distribution data, wherein the real-time status information includes battery remaining capacity, charge and discharge power, and geographic location information, and divide the power batteries into a plurality of power battery trading groups based on charge and discharge power, remaining capacity, and geographic location based on the real-time status information and the power demand curve;

[0194] The second unit is used to build a federated learning node network based on the power battery trading group. The historical response time, battery health status, and transaction completion rate of buyers and sellers are used as operating data to input into a pre-trained multi-layer neural network for feature extraction. The gradient boosting decision tree algorithm is used to calculate the credit assessment score. Based on the credit assessment score, differentiated transaction quotas and credit thresholds are set for buyers and sellers in the power battery trading group.

[0195] The third unit is used to construct a spatiotemporal correlation graph based on the electricity demand curve and historical transaction data, extract the inter-regional electricity demand dependency using a graph attention algorithm, model the time series features in combination with a recurrent neural network, output the optimal transaction price range for each trading group in the next 24 hours, and generate a risk-controlled transaction matching strategy based on the optimal transaction price range and credit threshold;

[0196] The fourth unit is used to optimize and calculate the charging and discharging scheduling instructions including the charging and discharging period, charging and discharging power and target power based on the differentiated trading quota, the optimal trading price range and the trading matching strategy, while taking into account the maximization of trading revenue and the minimization of grid scheduling costs, using an improved particle swarm algorithm, and issue the charging and discharging scheduling instructions and execute transaction settlement.

[0197] According to a third aspect of the embodiments of the present invention,

[0198] An electronic device is provided, comprising:

[0199] processor;

[0200] a memory for storing processor-executable instructions;

[0201] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.

[0202] According to a fourth aspect of the embodiments of the present invention,

[0203] A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method described above is implemented.

[0204] The present invention may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present invention.

[0205] 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 above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, 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: include: collecting smart grid load distribution data and real-time status information of distributed power batteries, calculating a power demand curve for each region based on the smart grid load distribution data, the real-time status information including battery remaining capacity, charge and discharge power, and geographic location information, and dividing the power batteries into a plurality of power battery trading groups based on charge and discharge power, remaining capacity, and geographic location based on the real-time status information and the power demand curve; A federated learning node network is built based on the power battery trading group. The historical response time, battery health status, and transaction completion rate of buyers and sellers are used as operational data input into a pre-trained multi-layer neural network for feature extraction. A gradient boosting decision tree algorithm is used to calculate a credit assessment score. Based on this credit assessment score, differentiated trading quotas and credit thresholds are set for buyers and sellers within the power battery trading group. Based on the electricity demand curve and historical transaction data, a spatiotemporal correlation graph is constructed. The inter-regional electricity demand dependency is extracted using a graph attention algorithm. A recurrent neural network is combined to model the time series features. The optimal transaction price range for each trading group in the next 24 hours is output. A risk-controlled transaction matching strategy is generated based on the optimal transaction price range and credit threshold. Based on the differentiated trading quotas, optimal trading price range and trading matching strategy, while taking into account the maximization of trading revenue and the minimization of grid dispatching costs, an improved particle swarm algorithm is used to optimize and calculate the charging and discharging scheduling instructions including the charging and discharging period, charging and discharging power and target power, and the charging and discharging scheduling instructions are issued and transaction settlement is executed.

2. The method according to claim 1, characterized in that Collecting smart grid load distribution data and real-time status information of distributed power batteries, calculating power demand curves for each region based on the smart grid load distribution data, wherein the real-time status information includes battery remaining capacity, charge and discharge power, and geographic location information, and dividing the power batteries into multiple power battery trading groups based on charge and discharge power, remaining capacity, and geographic location based on the real-time status information and the power demand curve, including: Collect smart grid load distribution data, including real-time load rates of regional distribution transformers, historical electricity load curves, and time-of-use electricity price information. Based on the smart grid load distribution data, use a combination of Fourier series decomposition and wavelet transform to perform periodic analysis and trend extraction on the historical electricity load curves, and calculate the time-of-use electricity demand curves for each region over the next 24 hours. Obtaining real-time status information of distributed power batteries, the real-time status information including the remaining battery capacity, charge and discharge power, and geographic location information, wherein the charge and discharge power includes maximum charge power, maximum discharge power, and charge and discharge efficiency, and calculating the amount of electricity available for participation in electric energy trading based on the remaining battery capacity and charge and discharge efficiency; Based on the electricity demand curve and real-time status information, the geographical distance and transmission loss between the power batteries and the load centers in each region are calculated. Combined with the degree of matching between the tradable power of the power batteries and the regional electricity demand, an improved hierarchical clustering algorithm is used to adaptively group the power batteries. The deviation of the charge and discharge characteristics of the power batteries in the same group does not exceed 5%, and the geographical distribution does not exceed the preset maximum grouping distance. The number of groups is dynamically adjusted according to real-time trading demand.

3. The method according to claim 1, characterized in that A federated learning node network is built based on the power battery trading group. The historical response time, battery health status, and transaction completion rate of buyers and sellers are used as operating data to input into a pre-trained multi-layer neural network for feature extraction. A gradient boosting decision tree algorithm is used to calculate the credit assessment score. Based on the credit assessment score, differentiated transaction quotas and credit thresholds are set for buyers and sellers in the power battery trading group, including: Building a federated learning node network based on a power battery trading group, with buyers and sellers in the power battery trading group acting 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, internal resistance growth rate, and voltage consistency. Normalizing and standardizing the historical response time, the battery health status, and the transaction completion rate, performing segmented sampling on the preprocessed data using a sliding time window to generate a training sample set, and forming the training sample set into operating data; Inputting the operating data into a pre-trained multi-layer neural network for feature extraction, the multi-layer neural network consisting of an input layer, a first hidden layer, a second hidden layer, a third hidden layer, and an output layer, wherein the first hidden layer, the second hidden layer, and the third hidden layer use a rectified linear unit activation function with a random dropout mechanism, the output layer generates a feature vector, and constructs a multi-objective loss function based on the Euclidean distance between the feature vector and a target feature vector and a norm of a network weight; Performing federated average training in the federated learning node network, each federated learning node calculates a local gradient based on local data, encrypts the local gradient using a differential privacy mechanism, and transmits the encrypted local gradient to an aggregation server. The aggregation server performs a weighted average of the local gradients based on the number of samples and data quality scores of each federated learning node to obtain a global gradient, and updates global model parameters based on the global gradient; After enhancing the feature vector, the algorithm is fed 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 minimization of a pre-constructed progressive constraint loss function. In the leaf node region of the decision tree, the optimal prediction value is calculated based on the Newton method and the Hessian matrix. The learning rate is dynamically adjusted based on the convergence rate of the loss function, and a credit assessment score is output. Based on the credit assessment score, differentiated transaction quotas and credit thresholds are set for buyers and sellers in the power battery transaction group.

4. The method according to claim 3, characterized in that After the feature vector is enhanced, it is input into the gradient boosting decision tree algorithm. The gradient boosting decision tree algorithm adopts a second-order derivative optimization algorithm to fit the decision tree by negative gradient iteration and minimization of a pre-built progressive constraint loss function. In the leaf node area of ​​the decision tree, the optimal prediction value is calculated based on the Newton method and the Hessian matrix, including: Construct a hierarchical feature enhancement network, and enhance the input feature vector through the basic feature layer, interactive feature layer, and fusion feature layer. The basic feature layer calculates the statistical distribution information of the original features. The interactive feature layer generates a feature interaction matrix based on the statistical distribution information and extracts high-order correlation patterns between features. The fusion feature layer adaptively fuses the statistical distribution information and high-order correlation patterns to output an enhanced feature vector. A prediction objective function based on the enhanced feature vector is constructed. The first-order and second-order Taylor expansions of the prediction objective function are performed to obtain the gradient information and Hessian matrix of the objective function. A regularized loss function for the prediction target is constructed based on the gradient information and the Hessian matrix. The regularization strength of the regularized loss function is dynamically adjusted based on the statistical distribution information to obtain an adaptive regularized loss term. The feature association consistency score is calculated based on the feature interaction matrix to obtain a feature association constraint term. The gradient information of the objective function, the adaptive regularized loss term, and the feature association constraint term are combined to form a progressive constraint loss function. The enhanced feature vector is input into the gradient boosting decision tree algorithm. The second-order derivative optimization algorithm is used to calculate the first-order derivative of the objective function to obtain the negative gradient direction. The second-order derivative of the objective function is calculated and the Hessian matrix is ​​constructed. The feature gradient is reconstructed in combination with the feature interaction matrix to obtain the feature association perception gradient. Based on the statistical distribution information, the data density and distribution deviation of the candidate split points are calculated and combined with the feature correlation perception gradient to construct a distribution-aware splitting criterion. According to the distribution-aware splitting criterion, the optimal splitting point is selected for node splitting to construct a decision tree; In the leaf node area of ​​the decision tree, the second-order partial derivatives between feature pairs are calculated based on the feature interaction matrix to construct a second-order Hessian matrix, the feature association tensor is generated based on the high-order association pattern, the local distribution covariance is calculated in combination with the statistical distribution information, and the Newton method is used to optimize the calculation of the second-order Hessian matrix and the local distribution covariance, and the progressive constraint loss function is minimized to obtain the optimal prediction value considering the feature association.

5. The method according to claim 1, wherein Based on the electricity demand curve and historical transaction data, a spatiotemporal correlation graph is constructed. The inter-regional electricity demand dependency is extracted using a graph attention algorithm. Time series features are modeled using a recurrent neural network. The optimal transaction price range for each transaction group in the next 24 hours is output. A risk-controlled transaction matching strategy is generated based on the optimal transaction price range and credit threshold, including: The previously acquired electricity demand curve is constructed into an electricity demand matrix. The transaction price, transaction number, default status, electricity consumption fluctuation and peak and valley electricity consumption characteristics are extracted from the historical transaction data to construct a transaction feature matrix. The adjacency matrix of the spatiotemporal association graph is constructed based on the geographic distance attenuation coefficient and electricity consumption pattern similarity between transaction groups. Perform linear transformation on the feature vectors of nodes in the spatiotemporal association graph to obtain query vectors, key vectors, and value vectors. Calculate the inner product of the query vector and the key vector and normalize them to obtain the attention weight matrix. Multiply the attention weight matrix by the value vector to obtain weighted features. Multiple sets of weighted features are concatenated and nonlinearly transformed to obtain the power demand dependency relationship. The power demand dependency is input into the recurrent neural network. The reset gate and update gate are used to control the fusion ratio of historical state information and current input information. The reset historical state and current input are nonlinearly transformed to obtain candidate states. The update gate is used to perform adaptive fusion to obtain time series features. The price prediction features are obtained by fusing the time series features and the historical price series. Based on the price prediction features, a mixed probability distribution model containing Gaussian distribution and skewed distribution is constructed. The maximum expectation algorithm is used for iterative optimization to determine the optimal number of distributions. The weighted combination of the determined multiple probability distributions is used to obtain the conditional probability distribution of the price. The optimal transaction price range is obtained by calculating the quantiles of the specified confidence interval based on the conditional probability distribution. The default probability is calculated based on the credit score of the transaction group and compared with the credit threshold. The overlap of the price ranges of the transaction groups that meet the credit constraints is determined, and a risk-controlled transaction matching strategy is output.

6. The method according to claim 1, characterized in that Based on the differentiated trading quotas, optimal trading price range, and trading matching strategy, while taking into account maximization of trading revenue and minimization of grid dispatching costs, an improved particle swarm optimization algorithm is used to optimize and calculate a charging and discharging scheduling instruction including charging and discharging time periods, charging and discharging power, and target power. The charging and discharging scheduling instruction is issued and transaction settlement is executed, including: Constructing a charge and discharge scheduling instruction vector, wherein the charge and discharge scheduling instruction vector includes a charge and discharge period, a charge and discharge power, and a target power; calculating the difference between transaction revenue and grid dispatch cost based on the charge and discharge power; constructing a transaction revenue maximization objective function in combination with the battery loss cost; calculating the power regulation cost and the power fluctuation cost based on the charge and discharge power; and constructing a grid dispatch cost minimization objective function in combination with the power regulation cost and the power fluctuation cost; Taking the transaction revenue maximization objective function and the grid dispatch cost minimization objective function as optimization objectives, constraints are imposed on the charge and discharge scheduling instruction vector, wherein the constraints include a quota constraint that limits the sum of the absolute values ​​of charge and discharge power based on differentiated transaction quotas, a price range constraint that limits the transaction price based on the optimal transaction price range, and an operation constraint that limits the charge and discharge power and state of charge based on a transaction matching strategy; The constrained charge and discharge scheduling instruction vector 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 factor is dynamically updated according to the fitness difference of the particles. The inertia weight coefficient and the dynamic learning factor are used to update the particle velocity. The nonlinear perturbation generated by the chaotic map is applied to the particle position update process to obtain the updated particle swarm. The updated particle swarm is evaluated, and the particles are non-dominatedly sorted using a fast hierarchical method based on dominance counting to obtain particle layers of different levels. Within the particle layers of the same level, the congestion of the particles is calculated based on the normalized distance of the objective function value. The non-dominated sorting results are combined with the congestion calculation results to generate the optimal solution set. Based on the preset decision preference weights, a comprehensive evaluation is performed on the solutions in the optimal solution set, and the solution with the best comprehensive evaluation value is selected as the final charge and discharge scheduling instruction. The charge and discharge period, charge and discharge power and target power parameters are extracted according to the charge and discharge scheduling instruction, and the charge and discharge scheduling instruction is issued and transaction settlement is executed.

7. The method according to claim 6, characterized in that Adaptively adjust the inertia weight coefficient based on the current iteration progress, dynamically update the learning factor according to the fitness difference of the particles, use the inertia weight coefficient and the dynamic learning factor to update the particle velocity, and apply the nonlinear perturbation generated by the chaotic map to the particle position update process to obtain the updated particle swarm. For the current particle swarm, calculate the particle swarm diversity index, obtain the particle swarm aggregation degree under 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 nonlinear function according to the particle swarm aggregation degree, and increase the inertia weight parameter when the particle swarm aggregation degree decreases; Calculating a second Euclidean distance between each particle in the particle swarm and the global optimal solution, and adaptively adjusting the fitness difference of the particles using an exponential function based on the second Euclidean distance, wherein the fitness difference of the particles dynamically adjusts cognitive item parameters and social item parameters as the second Euclidean distance changes, wherein the cognitive item parameters increase as the second Euclidean distance increases, and the social item parameters decrease as the second Euclidean distance increases; Combining Lukist mapping with tent mapping to generate a chaotic sequence, wherein the weight coefficient of the chaotic sequence decays linearly with iteration, and mapping the chaotic sequence to the boundary range of the particle swarm search space to form a nonlinear perturbation term; Selecting the particle with the highest fitness from the particle swarm as the high-quality particle, applying a local search perturbation based on a 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 position difference of two randomly selected particles in the particle swarm and the adaptive search radius; The distribution entropy is calculated based on the fitness distribution of each particle in the particle swarm, and the structural characteristics of the particle swarm are dynamically adjusted according to the size of the distribution entropy. When the distribution entropy is greater than a preset distribution entropy threshold, the structural characteristics of global transmission are adopted. When the distribution entropy is less than the preset distribution entropy threshold, the structural characteristics of local transmission are adopted, and the transmission probability between particles is adaptively adjusted; The inertia weight parameter, dynamic learning factor, nonlinear perturbation term, local search result and structural feature are applied to the position and velocity update process of the particle swarm to obtain an updated particle swarm.

8. A distributed power battery energy trading and dispatching system for a smart grid, used to implement the method according to any one of claims 1 to 7, characterized in that: include: A first unit is configured to collect smart grid load distribution data and real-time status information of distributed power batteries, calculate a power demand curve for each region based on the smart grid load distribution data, wherein the real-time status information includes battery remaining capacity, charge and discharge power, and geographic location information, and divide the power batteries into a plurality of power battery trading groups based on charge and discharge power, remaining capacity, and geographic location based on the real-time status information and the power demand curve; The second unit is used to build a federated learning node network based on the power battery trading group. The historical response time, battery health status, and transaction completion rate of buyers and sellers are used as operating data to input into a pre-trained multi-layer neural network for feature extraction. The gradient boosting decision tree algorithm is used to calculate the credit assessment score. Based on the credit assessment score, differentiated transaction quotas and credit thresholds are set for buyers and sellers in the power battery trading group. The third unit is used to construct a spatiotemporal correlation graph based on the electricity demand curve and historical transaction data, extract the inter-regional electricity demand dependency using a graph attention algorithm, model the time series features in combination with a recurrent neural network, output the optimal transaction price range for each trading group in the next 24 hours, and generate a risk-controlled transaction matching strategy based on the optimal transaction price range and credit threshold; The fourth unit is used to optimize and calculate the charging and discharging scheduling instructions including the charging and discharging period, charging and discharging power and target power based on the differentiated trading quota, the optimal trading price range and the trading matching strategy, while taking into account the maximization of trading revenue and the minimization of grid scheduling costs, using an improved particle swarm algorithm, and issue the charging and discharging scheduling instructions and execute transaction settlement.

9. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; 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: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Short-term Load Forecasting Method Based on TCN and IPSO-LSSVM Combined Model

    AU2020104000A4

  • Energy scheduling and trading method of interconnected micro-grid system

    CN117436647A