Battery swap station battery swap demand prediction method and device, server and readable storage medium

By constructing a spatiotemporal graph structure for battery swapping stations and using graph attention networks and gated cyclic units, the problem of ignoring spatial dependencies in battery swapping station networks was solved, enabling accurate prediction and dynamic scheduling of battery swapping demand and improving prediction accuracy.

CN121638897APending Publication Date: 2026-03-10STATE GRID ZHEJIANG ELECTRIC POWER CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511791108.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-01
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing demand forecasting schemes for battery swapping stations ignore the spatial dependencies within the overall battery swapping station network, resulting in a significant decrease in forecast accuracy in complex scenarios such as sudden demand shifts and peak-hour spillovers.

Method used

A spatiotemporal graph structure of multiple battery swapping stations is constructed. Spatial location relationships and temporal dynamics are modeled in a unified manner through adjacency matrix and node feature matrix. Graph attention network and gated recurrent unit are used to capture the spatial dependence and temporal evolution of battery swapping demand, and hidden state vectors are generated for prediction.

Benefits of technology

It significantly improves the accuracy of prediction in complex scenarios such as sudden demand shifts and peak-hour spillover, and enables accurate prediction and dynamic scheduling of battery swapping demand.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121638897A_ABST
    Figure CN121638897A_ABST
Patent Text Reader

Abstract

The invention provides a battery swap station battery swap demand prediction method and apparatus, a server and a readable storage medium. The method comprises the steps of obtaining a space-time diagram structure corresponding to a plurality of battery swap stations; wherein the space-time diagram structure is composed of an adjacent matrix and a node feature matrix; the adjacent matrix represents the spatial position relationship between the battery swap stations; the node feature matrix comprises a multi-dimensional feature sequence of each battery swap station at each time point in a historical time period; performing feature enhancement on the multi-dimensional feature sequences of all the battery swap stations at each time point by using the adjacent matrix to obtain spatial context features of all the battery swap stations at each time point; for each battery swap station, generating a hidden state vector according to the spatial context feature at each time point; the hidden state vector represents a power conversion demand evolution rule; and based on the hidden state vector, outputting the power conversion demand of the power conversion station in the prediction period through a power conversion demand prediction model. According to the invention, the battery swap demand prediction of the battery swap station can be accurately realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electric vehicle technology, and more specifically, to a method, apparatus, server, and readable storage medium for predicting battery swapping demand at battery swapping stations. Background Technology

[0002] With the continuous growth of electric vehicle ownership and the widespread application of battery swapping in urban mobility, logistics, and other scenarios, battery swapping stations, as core infrastructure, directly impact user experience and the stability of the overall service network through their operational efficiency. To achieve efficient resource allocation, more and more battery swapping station operators are beginning to model historical battery swapping behavior to predict battery replacement demand in the near future, thereby guiding key operational activities such as battery storage and scheduling.

[0003] Currently, mainstream demand forecasting schemes for battery swapping stations generally adopt a univariate time series forecasting framework. This framework uses the historical battery swapping volume of a single station as the sole input and leverages deep learning models with time series modeling capabilities, such as LSTM (Long Short-Term Memory), to uncover the daily periodicity, cyclicality, and trend patterns hidden in the battery swapping data. This allows for a point estimate of the battery swapping volume in the short term. While this method has some predictive usability, it ignores the spatial dependencies within the overall battery swapping station network, leading to a significant decrease in prediction accuracy for complex scenarios such as sudden demand shifts and peak-hour spillover effects.

[0004] Therefore, improving the accuracy of battery swapping demand prediction in complex scenarios is a technical problem that needs to be solved. Summary of the Invention

[0005] In view of this, the purpose of the present invention is to provide a method, device, server and readable storage medium for predicting battery swapping demand at battery swapping stations. The present invention can improve the accuracy of battery swapping demand prediction in complex scenarios.

[0006] To achieve the above objectives, the technical solutions adopted in the embodiments of the present invention are as follows: In a first aspect, the present invention provides a method for predicting battery swapping demand at battery swapping stations. The method includes: obtaining a spatiotemporal graph structure corresponding to multiple battery swapping stations; wherein the spatiotemporal graph structure is composed of an adjacency matrix and a node feature matrix; the adjacency matrix represents the spatial positional relationship between battery swapping stations; the node feature matrix includes a multidimensional feature sequence of each battery swapping station at each time point within a historical time period; using the adjacency matrix to perform feature enhancement on the multidimensional feature sequences of all battery swapping stations at each time point to obtain the spatial context features of all battery swapping stations at each time point; for each battery swapping station, generating a hidden state vector based on the spatial context features at each time point; wherein the hidden state vector characterizes the evolution law of battery swapping demand; and based on the hidden state vector, outputting the battery swapping demand of the battery swapping station within the prediction period through a battery swapping demand prediction model.

[0007] Secondly, the present invention provides a battery swapping station demand prediction device, comprising: an acquisition module for acquiring a spatiotemporal graph structure corresponding to multiple battery swapping stations; wherein the spatiotemporal graph structure is composed of an adjacency matrix and a node feature matrix; the adjacency matrix represents the spatial proximity relationship between battery swapping stations; the node feature matrix includes a multidimensional feature sequence of each battery swapping station at each time point within a historical time period; an enhancement module for enhancing the multidimensional feature sequence of all battery swapping stations at each time point using the adjacency matrix to obtain the spatial context features of all battery swapping stations at each time point; a generation module for generating a hidden state vector for each battery swapping station based on the spatial context features at each time point; wherein the hidden state vector characterizes the evolution law of battery swapping demand; and a prediction module for outputting the battery swapping demand of the battery swapping station within the prediction period based on the hidden state vector and a battery swapping demand prediction model.

[0008] Thirdly, the present invention provides a server including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor can execute the machine-executable instructions to implement the battery swapping demand prediction method for battery swapping stations as described in any of the foregoing embodiments.

[0009] Fourthly, the present invention provides a readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the battery swapping demand prediction method for battery swapping stations as described in any of the foregoing embodiments.

[0010] The battery swapping demand prediction method, device, server, and readable storage medium provided in this invention first construct a spatiotemporal graph structure corresponding to multiple battery swapping stations. The adjacency matrix characterizes the spatial relationships between the stations, and the node feature matrix contains multi-dimensional feature sequences of each station at various points in time within a historical period, thus unifying spatial correlation and temporal dynamics in the model. Next, the adjacency matrix is ​​used to enhance the multi-dimensional feature sequences of all battery swapping stations at each point in time, effectively aggregating information from neighboring stations. This yields the spatial context features of all battery swapping stations at each point in time, enhancing the model's ability to perceive spatial dependencies. Based on this, for each battery swapping station, the dynamic pattern of its demand evolution over time is captured based on the serialized spatial context features, and a hidden state vector representing this pattern is generated. Finally, based on these hidden state vectors and the temporal information of the prediction period, the battery swapping demand prediction model outputs the battery swapping demand of each station within the prediction period. This significantly improves prediction accuracy in complex scenarios such as sudden demand shifts and peak-hour spillovers by fully integrating spatial correlation evolution and temporal dynamics.

[0011] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0012] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 This illustrates an existing battery swapping demand forecasting scheme; Figure 2 A schematic flowchart illustrating the battery swapping demand forecasting method for battery swapping stations provided in an embodiment of the present invention; Figure 3 This is a simplified overall schematic diagram of the battery swapping demand forecasting process provided in an embodiment of the present invention; Figure 4 This diagram illustrates the functional block diagram of the battery swapping demand prediction device for battery swapping stations provided in an embodiment of the present invention. Figure 5 A structural block diagram of a server provided in an embodiment of the present invention is shown. Detailed Implementation

[0014] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0015] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0016] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0017] Please see Figure 1 , Figure 1 This paper presents an existing battery swapping demand forecasting scheme. During their research, the inventors discovered that in real-world applications, battery swapping stations in cities do not operate in isolation. Their demand changes are influenced by multiple factors, including the operational status of surrounding stations, user migration behavior, traffic network structure, and regional functional layout. Significant spatial correlations exist between adjacent battery swapping stations. For example, when a battery swapping station in a hotspot area approaches full capacity or experiences a service interruption, users originally destined for that station will switch to nearby stations, triggering a local redistribution and transmission effect of demand. Furthermore, commuting flows between different areas of the city also lead to dynamic propagation characteristics of battery swapping demand in the spatial dimension. Existing methods based on independent modeling of single stations struggle to capture such cross-site collaborative evolution patterns, resulting in a significant decrease in forecasting accuracy for complex scenarios such as sudden demand shifts and peak-hour spillover effects.

[0018] To address the above problems, this invention provides a method for predicting battery swapping demand at battery swapping stations. Please refer to... Figure 2 , Figure 2The schematic flowchart of the battery swapping demand prediction method for battery swapping stations provided in the embodiments of the present invention may include steps S201 to S204, as described below: S201: Obtain the spatiotemporal diagram structure corresponding to multiple battery swapping stations; In this embodiment of the invention, the spatiotemporal graph structure organizes the originally isolated and scattered data of battery swapping stations into a unified structured data model that can reflect spatial relationships and carry temporal evolution information. It consists of an adjacency matrix and a node feature matrix. The adjacency matrix represents the spatial proximity relationship between battery swapping stations. The node feature matrix includes the multidimensional feature sequence of each battery swapping station at each time point in the historical time period.

[0019] Optionally, the historical time period can be the past number of days, with each day as a time point. For example, the past 2 days. The multidimensional feature sequence can be, but is not limited to, composed of the following operational status data: number of batteries replaced, battery inventory, number of vehicles in the vicinity, average distance traveled by users to the station, etc.

[0020] S202: Use the adjacency matrix to enhance the multidimensional feature sequences of all battery swapping stations at each time point to obtain the spatial context features of all battery swapping stations at each time point; In this embodiment of the invention, the original multidimensional feature sequence only describes the operating status of a single battery swapping station. The feature enhancement process combines the information of neighboring stations to regenerate a new feature representation for each station, so that it not only contains its own information, but also incorporates the spatial information of surrounding stations, i.e., spatial context features.

[0021] S203: For each battery swapping station, generate a hidden state vector based on the spatial context features at each time point; In this embodiment of the invention, the hidden state vector represents the evolution law of battery swapping demand, which is used for accurate prediction of subsequent battery swapping demand.

[0022] S204: Based on the hidden state vector, the battery swapping demand of the battery swapping station is output through the battery swapping demand prediction model during the prediction period.

[0023] In this embodiment of the invention, the input to the battery swapping station demand prediction model is the hidden state vector of each battery swapping station, and the output is the battery swapping demand corresponding to that station. The prediction period can be daily, every few days, or weekly, etc., and is not limited here.

[0024] Unlike existing technologies, this invention first constructs a spatiotemporal graph structure corresponding to multiple battery swapping stations. The adjacency matrix characterizes the spatial relationships between the stations, and the node feature matrix contains multi-dimensional feature sequences of each station at various points in time within a historical period, thus unifying spatial correlation and temporal dynamics in the model. Next, the adjacency matrix is ​​used to enhance the multi-dimensional feature sequences of all battery swapping stations at each point in time, effectively aggregating information from neighboring stations to obtain the spatial context features of all stations at each point in time, thereby enhancing the model's ability to perceive spatial dependencies. Based on this, for each battery swapping station, the dynamic pattern of its demand evolution over time is captured based on the serialized spatial context features, and a hidden state vector representing this pattern is generated. Finally, based on these hidden state vectors and combined with the temporal information of the prediction period, the battery swapping demand prediction model outputs the battery swapping demand of each station within the prediction period. This significantly improves prediction accuracy in complex scenarios such as sudden demand shifts and peak-hour spillovers by fully integrating spatial correlation evolution and temporal dynamic features.

[0025] Next, the embodiments of the present invention will describe the above. Figure 1 The process of forecasting battery swapping demand is explained in detail.

[0026] In step S201, during the construction of the spatiotemporal graph structure, this embodiment of the invention first needs to acquire the operating status data of each battery swapping station and use this data to construct a node feature matrix. Simultaneously, an adjacency matrix is ​​established by constructing a graph structure between the battery swapping stations. The spatiotemporal graph structure is then constructed based on these two key pieces of information. The processes for constructing the adjacency matrix and the node feature matrix are described below.

[0027] The adjacency matrix can be generated according to the following implementation method in this embodiment of the invention: Step a1: Construct a graph structure; where each battery swapping station is a node in the graph structure; nodes are connected by edges to represent spatial proximity; spatial proximity is defined as the geographical distance between two stations being less than a set threshold. Step a2: Based on the graph structure, establish the adjacency matrix; In this embodiment of the invention, in order to model the spatial relationships between multiple battery swapping stations, the entire battery swapping station network is first abstracted into a graph structure, where each battery swapping station is regarded as a node in the graph. This graph structure can effectively express the topological relationships between stations, laying the foundation for subsequent spatial feature extraction.

[0028] During the construction of the graph structure, whether a connecting edge exists between any two nodes depends on whether the geographical distance between them is less than a preset threshold (e.g., 4 kilometers). This threshold is a reasonable value set based on common commuting or service coverage areas between battery swapping stations within a city. If the straight-line distance or road distance between two stations is less than this threshold, an undirected edge is established between the two nodes, indicating that the two battery swapping stations are spatially adjacent and may have mutual influences such as demand transmission and user diversion. At the same time, self-loops are usually added to each node, that is, each station is connected to itself, in order to retain its own characteristic information.

[0029] Adjacency matrix A∈{0,1} N×N This is a mathematical representation of the spatial adjacency relationships between the aforementioned battery swapping stations. Where N is the total number of battery swapping stations, and A... ij =1 indicates that the geographical distance between the i-th and j-th battery swapping stations is less than a set threshold, indicating a spatial adjacency relationship and a connecting edge. A ij =0 indicates that the geographical distance between the i-th and j-th battery swapping stations is greater than a set threshold, meaning there is no spatial adjacency and no connecting edges. Furthermore, due to the inclusion of self-loops, all A's on the main diagonal of matrix A... ii =1.

[0030] The above implementation method can transform the dispersed battery swapping stations and their spatial proximity relationships into a structured graph data, which is then encoded in the form of an adjacency matrix to capture the spatial dependence of battery swapping demand. This allows the model to identify the implicit patterns that changes in demand at surrounding stations may affect the current station, thereby improving prediction accuracy.

[0031] Next, for the node feature matrix, we can directly obtain various operating status data of each battery swapping station at each time point within the historical time period. After preprocessing the operating status data, we construct a multi-dimensional feature sequence and organize it into a node feature matrix according to the node order.

[0032] In this embodiment of the invention, the operational status data includes, but is not limited to: the number of batteries to be swapped at each time point, the current battery inventory, the number of vehicles in the surrounding area, and the average distance users travel to the station. This data reflects the load status, service capacity, external demand intensity, and geographical accessibility of the battery swapping station, collectively constituting a description of the station's operational status.

[0033] For ease of understanding, assume that the running status data includes four types, represented as follows: The number of batteries replaced at each battery swapping station per day; The daily battery inventory at each station; The number of battery swapping vehicles around each station each day; Average daily travel distance per station.

[0034] For each battery swapping station i and the day t, a feature vector is formed. As shown below:

[0035] Next, assuming there are N battery swapping stations, T historical days, and S types of operational status data, then in the process of obtaining and organizing the node feature matrix: for each battery swapping station i and each historical time point t, its corresponding multiple operational status data are combined into a feature vector. The constructed node feature matrix in .

[0036] The above implementation methods can transform raw operational data into structured and computable node feature representations, enabling the model to simultaneously capture the evolutionary patterns of each site and its spatial relationships with other sites in spatiotemporal joint modeling. This is an important prerequisite for achieving high-precision battery swapping demand forecasting.

[0037] Combining the adjacency matrix A and the node feature matrix X, the spatiotemporal graph structure in this embodiment of the invention is defined as G=(V,E,X), where V is the node set (swapping station), E is the edge set (defined by A), and the final output spatiotemporal graph structure G is composed of the node feature matrix X and the adjacency matrix A.

[0038] Based on the above spatiotemporal graph structure, the enhanced feature vector of each battery swapping station for each day can be obtained through step S202, which integrates the spatial influence information of itself and neighboring stations.

[0039] In step S202, the Graph Attention Network (GAT) is an advanced graph neural network that learns the influence weights of each neighboring node on a node in the graph through an attention mechanism, thereby more accurately aggregating information from nearby battery swapping stations. This embodiment of the invention uses a multi-layered graph attention network, meaning that multiple GAT layers are stacked sequentially to form a deep network structure, enabling the model to expand from local to global representations and gradually extract higher-level spatial feature representations.

[0040] Therefore, step S202 provided in the embodiments of the present invention can be implemented in the following manner: Step b1: For each time point, input the adjacency matrix and the multidimensional feature sequence of each battery swapping station at that time point into a multilayer graph attention network; Understandably, by adopting a multi-layer graph attention network structure, each layer can be seen as an information extraction process: the first layer focuses on the most direct local neighbor relationships, the second layer can indirectly capture the influence of sites in more distant layers, and by progressing layer by layer, the network can start from local details and gradually build a global feature representation of the entire regional battery swapping network.

[0041] Step b2: The multi-layer graph attention network determines the neighboring sites of the target battery swapping station from the adjacency matrix; where the target battery swapping station is each of all battery swapping stations. In this embodiment of the invention, at each time point, for each battery swapping station, neighboring stations with spatial proximity can be found based on the values ​​assigned in the adjacency matrix.

[0042] Step b3: Starting from the first layer of the multi-layer graph attention network, the process is passed down layer by layer. At each layer, the corresponding weight matrix is ​​used to linearly transform the feature representations of each neighboring site output in the previous layer. It is understandable that at each layer of the network, the multidimensional features carried by these neighboring sites can be linearly transformed, which is equivalent to mapping the original data to a more suitable representation space for learning, thus preparing for subsequent information integration.

[0043] Step b4: Based on the attention weights of each neighboring site in each layer, the feature representation after linear transformation is weighted and fused to generate a new feature representation, which is then passed layer by layer until the last layer outputs the spatial context features.

[0044] In this embodiment of the invention, in each layer, different attention weights are assigned based on the correlation strength between each pair of battery swapping stations and their neighbors, and the transformed features are then weighted and fused accordingly. The final output is a spatial context feature vector that condenses key neighbor information, which more accurately reflects the actual situation of the target battery swapping station in its environment.

[0045] The above implementation method can adaptively capture the influence relationship between battery swapping stations, significantly improving the accuracy and expressive power of spatial feature modeling, and providing a guarantee for accurate prediction.

[0046] To facilitate understanding of steps b1 to b4 above, the following explanation will continue using the four types of features mentioned above as examples. Assume: the output feature dimension of the first layer of the graph attention network is 4, and the output feature dimension of each subsequent layer is D, i.e. , The demand for daily forecasting Node features (Right now The adjacency matrix is .

[0047] First of all, let (Initial features) In each layer l (l=1,2,…L), L is the total number of layers (e.g., 2). For each node i (i.e., the i-th battery swapping station), the process of strengthening features can be represented by the following formula:

[0048] The meanings of each parameter are as follows: : Represents the feature representation of the output of the l-th layer.

[0049] : The feature representation of the j-th neighboring station output in the previous layer.

[0050] : The set of neighboring nodes (including node i itself).

[0051] Weight matrix.

[0052] ReLU activation function; The attention weight of the l-th layer neighbor site j is calculated using the following formula:

[0053]

[0054] : Attention vector of layer l.

[0055] : splicing operation.

[0056] k: The kth neighboring site.

[0057] Finally, the output at each time point t in the last layer (i.e., the Lth layer) can be expressed as: The spatial context feature sequences corresponding to each time point are as follows: .

[0058] In one embodiment of the present invention, the attention weights corresponding to each neighboring site can also be adjusted in reverse based on the actual and predicted battery swapping demand of the battery swapping station. This is to achieve dynamic adjustment. Specifically, it can be corrected in the following way: Step 1: Obtain the actual battery swapping demand of each battery swapping station; Step 2: Determine the accuracy of each battery swapping station based on the predicted and actual battery swapping demand. Step 3: Adjust the attention weights using the accuracy of each battery swapping station.

[0059] In this embodiment of the invention, the accuracy of a single battery swapping station (i.e., the i-th battery swapping station) is as follows:

[0060] in For predicted values, This is the actual value.

[0061] Batch accuracy:

[0062] in: For battery swapping station The actual demand for battery swapping.

[0063] For battery swapping station The predicted demand for battery swapping.

[0064] To prevent division by zero for the minimum value, it can be set to 0.1.

[0065] This represents the total number of battery swapping stations.

[0066] The corrected attention weights are shown below:

[0067] Next, the spatial context feature sequence obtained in step 202 is as follows: The hidden feature vector of each battery swapping station can be generated in step S203 for subsequent prediction.

[0068] In step S203, since the features enhanced by GAT do not have time-series characteristics, this embodiment of the invention introduces a gated recurrent unit (GRU) to... The feature data is processed into a time series for final time series prediction. Therefore, step S203 can be implemented by steps c1 to c2: Step c1: Arrange the spatial context features at multiple time points in chronological order to form a feature sequence; Step c2: Input the feature sequence into a recurrent neural network with a gating mechanism for dynamic modeling and output the hidden state vector.

[0069] In this embodiment of the invention, due to The enhancement feature of battery swapping station i at time t is For each battery swapping station i, an independent GRU is used for the following processing flow:

[0070] in: : Previous hidden state, initial H represents the number of hidden layers in a recurrent neural network.

[0071] Input weight matrix.

[0072] Hidden state weight matrix.

[0073] Bias vector.

[0074] : Sigmoid activation function.

[0075] Element-wise multiplication.

[0076] After time step T, the hidden state of the i-th battery swapping station is finally generated: .

[0077] In the process of GRU processing time series data, at each time step, it dynamically determines how to update the internal information based on the current input and the memory state of the previous time step. Specifically: First, the system will calculate based on the input information. This represents the mixing ratio of old and new information; that is, how much of the current output state comes from newly calculated candidate information, and how much is directly inherited from past historical states. Next, the system will calculate... This quantity determines the degree to which the previous state influences the current candidate state; then, the model generates a candidate state based on the current input and historical information adjusted by the reset gate. This candidate state is a potential new memory generated based on the current input and historical states filtered by the reset gate. It fully considers the changing trends of various current features (such as battery inventory, number of surrounding vehicles, etc.) and incorporates some retained historical context. This state is not the final output but participates in subsequent decisions as a candidate. Finally, the model merges the hidden state from the previous time step with this newly generated candidate state to obtain... This is the final output state of the entire GRU unit at the current time step, and it is also a comprehensive expression of the model's dynamic demand for the current battery swapping station. It includes both necessary historical memory and the latest observation information.

[0078] Furthermore, based on the results obtained in step S203 above... In step S204, the embodiment of the present invention outputs the battery swapping demand of the battery swapping station within the prediction period through the battery swapping demand prediction model.

[0079] In this embodiment of the invention, the battery swapping demand prediction model can be a linear regression function, based on which the linear regression function and The battery swapping demand corresponding to each battery swapping station i can be obtained. , means as follows:

[0080] in: Weight vector.

[0081] : Bias term.

[0082] Predict the number of batteries to be replaced in the next time period (e.g., the time period is days).

[0083] As can be seen from the above embodiments, the present invention innovatively constructs the urban battery swapping station network as a graph structure, uses a graph convolutional neural network to aggregate information from adjacent stations, accurately captures the spatial dependence of battery swapping demand, introduces an attention enhancement mechanism to distinguish the influence weights of different neighboring nodes on the target station, and inputs the feature sequence rich in spatial information into the gated recurrent unit to output a refined demand prediction for future multi-time slices.

[0084] To facilitate a more intuitive understanding of the battery swapping demand prediction process provided in this embodiment of the invention, please refer to [link / reference]. Figure 3 , Figure 3 This is a simplified overall schematic diagram of the battery swapping demand forecasting process provided in an embodiment of the present invention, combined with... Figure 3 The embodiments of the present invention can be summarized as having the following advantages: 1. This invention uses the historical daily battery swapping count, battery inventory, number of swapping vehicles around the swapping station, and average travel distance of swapping vehicles as input data for each swapping station. This breaks through the limitations of traditional single-variable time-series prediction and constructs a richer feature system. In terms of spatial modeling, this patent innovatively constructs a spatiotemporal graph structure for swapping stations, treating each swapping station as a node in a graph network. The edge weights between nodes are calculated based on a hybrid approach of geographical distance decay and demand relevance, explicitly modeling the spatial relationships between swapping stations. 2. This invention employs an attention-enhanced graph convolutional network to strengthen the feature representation of each battery swapping station. Specifically, this invention implements an innovative mechanism for automatically correcting graph attention weights by adjusting the weight matrix of the graph attention network (GAT) in the model based on the accuracy of the prediction results. In detail, the system calculates a weight adjustment factor based on the historical prediction accuracy of each battery swapping station, introducing accuracy weighting during the attention weight calculation process. This ensures that nodes with good prediction performance receive higher weights during feature propagation, while the weights of nodes with poor prediction performance are suppressed, thereby achieving adaptive model correction. 3. This invention effectively processes long-sequence data through a gated recurrent unit (GRU). The GRU, through its gating mechanism of update and reset gates, adaptively captures long-term dependencies in time series data, avoiding the gradient vanishing problem in traditional recurrent neural networks. The update gate controls the degree of retention of historical information, the reset gate controls the degree of forgetting of historical information, candidate states generate new state information, and the final state combines historical states and candidate states to form a complete time memory mechanism. 4. In this embodiment of the invention, the original multi-dimensional features are first standardized, and then a spatiotemporal graph structure is constructed. A graph convolutional network enhances the spatial domain features of the nodes, capturing the spatial dependencies between battery swapping stations. Simultaneously, a GRU network encodes the time-series features of each battery swapping station, capturing its temporal evolution. The features of the two modalities are then aligned through projection and organically combined using a gating fusion mechanism, ultimately outputting a prediction of the battery demand for each battery swapping station for the next day. The entire process forms a complete technical chain from feature engineering, spatial modeling, temporal modeling to fusion prediction. 5. In this embodiment of the invention, the prediction performance feedback can also be integrated into graph attention calculation. By establishing the attention correction formula, the accuracy calculation method and gradient propagation mechanism can be realized.

[0085] Furthermore, in this embodiment of the invention, a battery scheduling scheme can also be designed based on the predicted battery swapping demand of each battery swapping station obtained in steps S201 to S204 above, as shown in steps d1 to d3: Step d1: Obtain the current battery inventory and safety stock for each battery swapping station; In this embodiment of the invention, the current battery inventory quantity of each battery swapping station i It can be obtained directly from the system; the safety stock level is based on the demand forecast for battery swapping stations. What was obtained, that is , It is a safety factor (e.g.) =1.2), used to cope with forecast errors and sudden demand, and to avoid supply disruptions.

[0086] Step d2: Determine the net surplus of the battery swapping station based on the safety stock level, the current battery inventory, and the projected demand for the battery swapping station. In this embodiment of the invention, the net demand or net surplus of each exchange station i :

[0087] Step d3: Determine the battery transfer-in sites and battery transfer-in locations based on the net surplus; In this embodiment of the invention, the battery receiving station and the battery receiving site can be determined in the following way: if This indicates that the site is out of stock and is a battery receiving site; an order needs to be placed. Block battery, This represents net demand. If... This indicates that the battery station has excess capacity and is a battery transfer station; it can be transferred out. Block battery, This indicates the net surplus.

[0088] Step d4: Execute the preset battery scheduling strategy for the battery transfer station and the battery transfer station.

[0089] In this embodiment of the invention, the battery scheduling strategy is as follows: Step 1: Construct a battery allocation optimization model with the objective function of minimizing the total allocation cost of all battery allocation paths. Under the constraints of meeting the demand of each receiving site and the supply capacity of each sending site, solve for the optimal battery allocation scheme. Step 2: Generate logistics scheduling instructions based on the optimal battery allocation plan and trigger the execution of battery scheduling tasks.

[0090] In this embodiment of the invention, during the process of establishing the battery allocation optimization model, the decision variables are first defined as follows: The number of batteries transferred from battery dispatch station i to battery dispatch station j is the value to be solved.

[0091] : The unit allocation cost from battery dispatching station i to battery receiving station j (based on the station path distance as the cost allocation value).

[0092] The battery allocation optimization model (minimizing the total allocation cost) is shown below:

[0093] This goal means that the system will prioritize dispatching between nearby stations, thereby saving time and shipping costs.

[0094] The constraints for the above battery allocation optimization model include: Condition 1: For each battery dispatching station, the total number of batteries dispatched outwards shall not exceed the net surplus, i.e.:

[0095] Condition 2: For each battery receiving site, the total number of batteries received should equal the net demand, i.e.:

[0096] Condition 3: All allocation quantities are non-negative values, i.e. .

[0097] Finally, the embodiments of the present invention can be based on the solution results. Automatically generate battery scheduling tasks.

[0098] Through the above implementation methods, this invention constructs a dynamic scheduling and closed-loop feedback mechanism, using the actual operating cost after scheduling as a penalty signal to reverse the attention weight in the prediction model, thereby realizing a closed loop of collaborative optimization between prediction and scheduling, and significantly improving the operating efficiency of the battery swapping station.

[0099] In order to perform the above Figure 2 The corresponding steps are described below, along with an implementation method for the battery swapping demand forecasting device 40 at a battery swapping station. Please refer to [link / reference]. Figure 4 , Figure 4 A functional block diagram of a battery swapping station demand prediction device provided in an embodiment of the present invention is shown. The battery swapping station demand prediction device 40 includes: an acquisition module 401, an enhancement module 402, a generation module 403, and a prediction module 404.

[0100] The acquisition module 401 is used to obtain the spatiotemporal graph structure corresponding to multiple battery swapping stations; wherein, the spatiotemporal graph structure consists of an adjacency matrix and a node feature matrix; the adjacency matrix represents the spatial proximity relationship between battery swapping stations; the node feature matrix includes the multidimensional feature sequence of each battery swapping station at each time point in the historical time period; The enhancement module 402 is used to enhance the multi-dimensional feature sequence of all battery swapping stations at each time point using the adjacency matrix, so as to obtain the spatial context features of all battery swapping stations at each time point. The generation module 403 is used to generate a hidden state vector for each battery swapping station based on the spatial context features at each time point; wherein, the hidden state vector represents the evolution law of battery swapping demand. The prediction module 404 is used to output the battery swapping demand of the battery swapping station within the prediction period based on the hidden state vector and the battery swapping demand prediction model.

[0101] It is understandable that the acquisition module 401, reinforcement module 402, generation module 403, and prediction module 404 can be executed collaboratively. Figure 2Each step in the process is used to achieve the corresponding technical effect.

[0102] It should be noted that the battery swapping demand prediction device 40 provided in this embodiment of the invention can be specific hardware on the device or software or firmware installed on the device. The implementation principle and technical effects of the device provided in this embodiment of the invention are the same as those in the foregoing method embodiments. For the sake of brevity, any parts not mentioned in the device embodiments can be referred to the corresponding content in the foregoing method embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can all be referred to the corresponding processes in the above method embodiments, and will not be repeated here.

[0103] Optionally, the above modules can be stored in the form of software or firmware. Figure 5 The memory shown is either stored in or embedded in the operating system (OS) of the server 50, and can be accessed by... Figure 5 The processor executes the commands. Meanwhile, the data and program code required to execute these modules can be stored in memory.

[0104] Please see Figure 5 , Figure 5 The diagram illustrates a structural block diagram of a server provided in an embodiment of the present invention, including a memory 501, a processor 502, and a communication interface 503. The memory 501, processor 502, and communication interface 503 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.

[0105] Optionally, the bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized into address buses, data buses, control buses, etc. For ease of representation, Figure 5 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0106] In this embodiment of the invention, the processor 502 may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in this embodiment of the invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in this embodiment of the invention can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor. The software modules may be located in the memory 501, and the processor 502 reads the program instructions from the memory 501 and, in conjunction with its hardware, completes the steps of the aforementioned methods.

[0107] In this embodiment of the invention, the memory 501 can be a non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), or it can be volatile memory, such as RAM. The memory can also be any other medium capable of carrying or storing desired executable program code having an instruction or data structure form and accessible by a computer, but is not limited thereto. The memory in this embodiment of the invention can also be a circuit or any other device capable of implementing a storage function for storing instructions and / or data.

[0108] The memory 501 can be used to store software programs and modules, such as the instructions / modules of the battery swapping demand prediction device 40 provided in this embodiment of the invention. These can be stored in the memory 501 in the form of software or firmware, or embedded in the operating system (OS) of the server 50. The processor 502 executes various functional applications and data processing by executing the software programs and modules stored in the memory 501. The communication interface 503 can be used to communicate with other node devices for signaling or data.

[0109] Understandable. Figure 5 The structure shown is for illustrative purposes only; the server 50 may also include more than [other components]. Figure 5 The more or fewer components shown, or having the same Figure 5 The different configurations shown. Figure 5 The components shown can be implemented using hardware, software, or a combination thereof.

[0110] Based on the above embodiments, the present invention also provides a readable storage medium storing a computer program. When the computer program is executed by a computer, it causes the computer to execute the battery swapping demand prediction method for battery swapping stations provided in the above embodiments. For specific implementation details, please refer to the method embodiments, which will not be repeated here.

[0111] Based on the above embodiments, the present invention also provides a program product, which includes a computer program. The processor can execute the computer program to implement the battery swapping demand prediction method for battery swapping stations provided in the embodiments of the present invention. For specific implementation, please refer to the method embodiments, which will not be repeated here.

[0112] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and there may be other division methods in actual implementation. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the coupling or direct coupling or communication connection shown or discussed may be through some communication interface; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0113] Furthermore, the units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the objectives of the embodiments of the present invention, depending on actual needs.

[0114] Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0115] It should be noted that if the function is implemented as a software module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0116] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for predicting battery replacement demand of a battery swap station, characterized in that, The method comprises: obtaining a plurality of battery swap stations corresponding to a space-time graph structure; wherein the space-time graph structure is composed of an adjacency matrix and a node feature matrix; the adjacency matrix represents the spatial position relationship between the battery swap stations; and the node feature matrix includes a multi-dimensional feature sequence of each battery swap station at each time point in a historical time period; using the adjacency matrix to perform feature enhancement on the multi-dimensional feature sequence of all battery swap stations at each time point, to obtain spatial context features of all battery swap stations at each time point; for each battery swap station, generating a hidden state vector according to the spatial context features at each time point; wherein the hidden state vector represents the evolution law of the battery swap demand; based on the hidden state vector, outputting the battery swap demand of the battery swap station in a prediction period by a battery swap demand prediction model.

2. The battery replacement station battery replacement demand prediction method of claim 1, wherein, Obtaining a plurality of battery swap stations corresponding to a space-time graph structure comprises: constructing a graph structure; wherein each battery swap station is a node in the graph structure; the nodes are connected by edges to represent the spatial proximity relationship; and the spatial proximity relationship is that the geographical distance between two stations is less than a set threshold; establishing the adjacency matrix according to the graph structure; obtaining a plurality of operating state data of each battery swap station at each time point; wherein the operating state data includes the number of battery swaps, the battery inventory, the number of surrounding vehicles, and the average distance of users arriving at the station; after preprocessing the operating state data, constructing a multi-dimensional feature sequence and organizing it into the node feature matrix in node order.

3. The battery replacement station battery replacement demand prediction method of claim 1, wherein, using the adjacency matrix to perform feature enhancement on the multi-dimensional feature sequence of all battery swap stations at each time point, to obtain spatial context features of all battery swap stations at each time point, comprising: for each time point, inputting the adjacency matrix and the multi-dimensional feature sequence of each battery swap station at the time point into a multi-layer graph attention network; determining the neighbor stations of the target battery swap station from the adjacency matrix by the multi-layer graph attention network; wherein the target battery swap station is each of all battery swap stations; starting from the first layer of the multi-layer graph attention network and passing down layer by layer, each layer uses a corresponding weight matrix to perform linear transformation on the feature representation output by each neighbor station at the previous layer; weighting and fusing the feature representation after linear transformation according to the attention weight corresponding to each neighbor station in each layer, to generate a new feature representation, and passing layer by layer until the spatial context features are output by the last layer.

4. The battery replacement station battery replacement demand prediction method according to claim 3, characterized in that, The method further comprises: obtaining the actual battery swap demand of each battery swap station; determining the accuracy corresponding to each battery swap station from the battery swap demand prediction and the actual battery swap demand; correcting the attention weight using the accuracy corresponding to each battery swap station.

5. The battery replacement station battery replacement demand prediction method of claim 1, wherein, For each battery swap station, generating a hidden state vector according to the spatial context features at each time point, comprises: arranging the spatial context features at multiple time points in time order to form a feature sequence; inputting the feature sequence into a recurrent neural network with a gating mechanism for dynamic modeling, to output the hidden state vector.

6. The battery replacement station battery replacement demand prediction method of claim 1, wherein, The method further comprises: obtaining the current battery inventory and the safety inventory of each battery swap station; determine a net surplus or a net demand of the battery swap station based on the safe inventory, the current battery inventory quantity and the demand prediction of the battery swap station; determine a battery dispatch-out site and a battery dispatch-in site based on the net surplus or the net demand; execute a preset battery dispatch strategy on the battery dispatch-out site and the battery dispatch-in site.

7. The battery replacement station battery replacement demand prediction method according to claim 6, characterized in that, The executing of the preset battery dispatch strategy on the battery dispatch-out site and the battery dispatch-in site comprises: constructing a battery dispatch optimization model to minimize the total dispatch cost of all battery dispatch paths as an objective function, and solving an optimal battery dispatch scheme under the constraint condition of meeting the demand of each dispatch-in site and the supply capacity of each dispatch-out site; wherein the constraint condition comprises: for each battery dispatch-out site, the total number of outward dispatched batteries shall not exceed the net surplus; for each battery dispatch-in site, the total number of received batteries is equal to the net demand; all dispatch quantities are non-negative values; generating a logistics scheduling instruction according to the optimal battery dispatch scheme and triggering the execution of the battery dispatch task. 8.A battery swap station battery swap demand prediction device, characterized by, comprise: an acquisition module configured to obtain a plurality of time-space graph structures corresponding to a plurality of battery swap stations; wherein the time-space graph structure is composed of an adjacency matrix and a node feature matrix; the adjacency matrix represents the spatial proximity relationship between the battery swap stations; and the node feature matrix comprises a multi-dimensional feature sequence of each battery swap station at each time point in a historical time period; a reinforcement module configured to perform feature reinforcement on the multi-dimensional feature sequence of all battery swap stations at each time point by using the adjacency matrix, to obtain spatial context features of all battery swap stations at each time point; a generation module configured to generate a hidden state vector for each battery swap station according to the spatial context features at each time point; wherein the hidden state vector represents the evolution law of battery swap demand; a prediction module configured to output a battery swap demand of the battery swap station in a prediction period by a battery swap demand prediction model based on the hidden state vector.

9. A server, characterized by The computer program is executed by the processor to implement the battery swap demand prediction method of any one of claims 1-7.

10. A readable storage medium, having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the battery swap demand prediction method of any one of claims 1-7.