Charging demand prediction method based on block chain in Internet of Vehicles
By using a blockchain-based hierarchical federated learning system, a Transformer encoder, and an STGCN spatiotemporal graph convolutional network, the problems of data privacy leakage, heterogeneity, and personalized demand in electric vehicle charging demand forecasting are solved, achieving high-precision and secure charging demand forecasting and facility optimization.
Patent Information
- Application Number
- CN202511076013.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-01
- Publication Date
- 2025-11-18
AI Technical Summary
Existing methods for predicting electric vehicle charging demand suffer from several problems, including risks of data privacy breaches, high heterogeneity of charging data leading to low model training accuracy, and the inability of general global models to meet the personalized needs of different scenarios.
A blockchain-based hierarchical federated learning system is adopted, which combines a Transformer encoder and an STGCN spatiotemporal graph convolutional network to perform model aggregation and prediction through edge servers, thereby meeting the needs of cross-regional model sharing and personalization.
It improves the accuracy and generalization ability of charging demand forecasting, protects user privacy, reduces system latency and resource consumption, optimizes the layout of charging facilities and grid load distribution, and supports the efficient use of clean energy.
Smart Images

Figure CN120978725A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of intelligent transportation and energy management, and relates to a charging demand prediction method based on a block chain in a vehicle Internet. BACKGROUND
[0002] With the increasing emphasis on environmental protection and sustainable development worldwide, electric vehicles (EVs) as a clean energy transportation tool are rapidly increasing in popularity. This trend not only has a profound impact on the traditional fuel vehicle market, but also poses new challenges to the stable operation of the power system. The charging demand of electric vehicles has a high degree of randomness and spatial and temporal heterogeneity, and its charging behavior is influenced by a variety of factors, such as users' daily travel habits, weather conditions, traffic conditions, etc. These factors result in a highly uneven spatial and temporal distribution of electric vehicle charging loads, which may cause a sharp rise in power grid load in certain time periods and regions, posing a threat to the stable operation of the power grid.
[0003] Accurate prediction of electric vehicle charging demand is crucial for optimizing the layout and management of charging facilities. However, traditional charging demand prediction methods have many problems. On the one hand, these methods often ignore the importance of data privacy protection. Electric vehicle charging data contains sensitive information such as users' travel habits, home address, work location, etc., and once leaked, it will cause serious invasion of users' privacy. On the other hand, due to the strong heterogeneity of charging data, the charging behavior of different users, different regions, and different time periods differs greatly, resulting in low training accuracy of existing models. In addition, general global models cannot meet the individualized needs of different scenarios and cannot fully consider the charging behavior characteristics in specific scenarios.
[0004] In recent years, deep learning technology has been widely applied in the field of load prediction. For example, convolutional neural networks (CNN) and long short-term memory networks (LSTM) are used to capture the temporal and spatial characteristics of electric vehicle charging loads, thereby improving the prediction accuracy. However, these deep learning-based prediction methods mostly rely on centralized data processing, which not only may lead to data privacy leakage, but also may increase the complexity and cost of the system due to the centralization of data transmission and processing.
[0005] In order to solve the above problems, federated learning (FL) as a distributed machine learning method has gradually attracted attention. Federated learning allows multiple clients to train models locally and share model parameters in a secure manner, thereby achieving joint training of models while protecting data privacy. However, this centralized federated learning method still has the risk of single point failure and data leakage.
[0006] The emergence of blockchain technology provides a new way to solve these problems. As a distributed ledger technology, blockchain has characteristics such as decentralization, tamper resistance, and traceability, which can provide a secure and reliable environment for data sharing and model updating. Through the blockchain network, the secure sharing and distributed aggregation of model parameters can be ensured, thereby improving the security and reliability of the system.
[0007] Based on the above problems and methods, the present application designs a charging prediction method based on blockchain. First, the charging pile geographical position is divided into regions, and combined with the time dimension to further subdivide the scene, reducing data heterogeneity. Second, a federated learning architecture based on blockchain is established to protect data privacy and security and realize cross-regional model sharing. The model uses a Transformer encoder to extract time and climate features, combined with spatio-temporal graph convolution on the edge server to enhance the spatio-temporal dependence relationship, and finally a local LSTM decoder is used to complete the accurate prediction. In the model aggregation stage, the edge server first aggregates the model by scene, and then generates a regional global model to improve the prediction accuracy and generalization ability. This method protects user privacy while realizing collaborative learning between charging piles, and is suitable for charging demand prediction and management in intelligent transportation systems. SUMMARY
[0008] Therefore, the purpose of the present application is to provide a charging demand prediction method based on blockchain in the Internet of Vehicles, which solves the problems of data privacy leakage risk in electric vehicle charging demand prediction, low model training accuracy caused by strong charging data heterogeneity, and difficulty of general global model to meet individual needs in different scenarios.
[0009] To achieve the above purpose, the present application provides the following technical solutions:
[0010] In the first aspect, the present application embodiment realizes scene-based multi-scale charging demand prediction by using a hierarchical federated learning system based on a blockchain architecture, according to the influence of multi-scale factors in charging demand prediction and the requirements of user privacy protection. This method includes the following steps:
[0011] S1: Region scene division based on space and time dimensions;
[0012] S2: Hierarchical federated learning system based on blockchain architecture;
[0013] S3: Multi-scale charging demand prediction method based on Transformer;
[0014] S4: Spatio-temporal graph convolution network based on STGCN;
[0015] S5: Individualized aggregation scheme based on scene aggregation.
[0016] In a second aspect, in S1, the embodiments of the present application perform regional division and scenario division according to the latitude and longitude of the charging pile and the charging time of the charging pile user, so as to reduce data heterogeneity and enhance personalization. Due to the joint action of geographical space constraints, social and economic attribute convergence, infrastructure policy consistency and neighborhood information dissemination, users form highly overlapped charging time, frequency and mode within a fixed activity radius, so the charging habits of users in the same region and the same scenario are similar, the charging piles can be divided into regions by using a clustering algorithm according to the latitude and longitude of the charging piles, so as to reduce data heterogeneity to a certain extent, the geographical positions of the charging piles in the region are close, and at the same time, according to the charging time of the user, the day is divided into three time periods: a night period of 21:00-05:00, a noon period of 11:00-15:00 and other periods of 06:00-11:00 and 15:00-22:00, the charging time of the charging piles in the region is marked and then clustered by using a clustering algorithm to divide scenarios. Therefore, the charging piles will be uniquely identified as nodes belonging to a specific region and a corresponding scenario, further reducing data heterogeneity.
[0017] In a third aspect, in S2, the embodiments of the present application establish a layered federated learning model of a blockchain architecture to realize safe and efficient federated learning and regional model sharing. The model includes an intelligent cloud layer, a DAG blockchain layer, an edge server layer and a charging pile layer. The intelligent cloud layer is responsible for task publishing and management, global model management and identity authentication to ensure that only authorized nodes can participate in model training and data sharing; the DAG blockchain layer is responsible for storing and recording different scenario models in each region and the global model, so that transactions are tamper-proof; the edge server layer is responsible for model aggregation, DAG blockchain creation and maintenance, and also responsible for spatiotemporal feature extraction in the region; and the charging pile layer is responsible for feature extraction according to local data, prediction model training and model uploading.
[0018] In a fourth aspect, in S3, the embodiments of the present application provide a charging demand prediction method based on a Transformer, which improves the accuracy and rationality of charging demand prediction from multiple angles. The model extracts features of time and weather through a Transformer encoder on local data of the charging pile and local weather data, uploads the features to the edge server layer for spatiotemporal graph convolution to increase spatial dependence; and then accurately predicts through an LSTM decoder combined with the spatiotemporal graph convolution result. The Transformer self-attention mechanism can better capture global context information, the spatiotemporal graph convolution can capture the influence of space on the prediction result, and the LSTM time series modeling capability can further analyze hidden states and deeply mine global dependency relationships of sequence data, so as to obtain a high-precision prediction result.
[0019] In the fifth aspect, the embodiment of the present application designs a STGCN spatio-temporal graph convolution network in S4. The edge server layer collects the adjacency relationship of each charging station in the region to construct an adjacency matrix of the charging piles in the region. The time and weather features of the charging pile layer are received, and multi-layer time convolution and spatial convolution are performed. The spatial relationship in the adjacency matrix is combined with the time and weather features to increase the spatial dependency. Finally, the output result is a time, weather, and spatial multi-scale fusion feature, which is sent back to the charging pile for accurate prediction.
[0020] In the sixth aspect, the embodiment of the present application provides a personalized aggregation scheme of scene aggregation in S5. According to the division result of the scene, the charging piles are marked as belonging to the scene type, and the edge server receives all the charging pile prediction models in the region. After classifying and aggregating all the models according to the marked scene type, the aggregation result is a scene aggregation model under each scene. Then all the scene models are weighted and aggregated according to the number of charging piles in each scene to obtain a global model in the region. The problem of low model accuracy caused by data heterogeneity in model aggregation is solved.
[0021] The beneficial effects of the present application are:
[0022] (1) The traditional method is easy to cause the leakage of user sensitive information (such as travel habits, home address) due to centralized data processing. The present application introduces a hierarchical federated learning system based on blockchain, in which data is trained locally at the charging pile, and only encrypted model parameters are shared without transmitting original data. The decentralized characteristics of blockchain (such as transaction tamper-proof and traceable) ensure the transparency and safety of the model updating process. Combined with the identity authentication mechanism of the intelligent cloud layer, only authorized nodes can participate in the training, which greatly reduces the risk of privacy leakage. This scheme not only complies with privacy protection regulations, but also enhances the trust of users in the intelligent transportation system.
[0023] (2) The strong heterogeneity of charging data (such as differences in behavior in different regions and time periods) often leads to low accuracy of traditional models. The present application combines multi-scale technology: the Transformer encoder captures global time and weather features, the STGCN spatio-temporal graph convolution enhances spatial dependency, and the LSTM decoder deeply excavates sequence dependency. This combination not only handles data heterogeneity, but also adapts to demand mutation scenarios (such as weather changes or traffic peaks), achieving high-precision charging demand prediction. At the same time, the dynamic adjacency matrix learning of the edge server further optimizes the representation of spatial relationships, ensuring the stability and reliability of the model in complex environments.
[0024] (3) The general global model is difficult to meet the individual needs of different scenarios (such as residential areas and work areas). The present application divides the regional scene based on the spatial and temporal dimensions (such as night and noon period), and through the scene-based personalized aggregation scheme: the edge server first aggregates the same scene model, and then generates a regional global model by weighting. This hierarchical aggregation mechanism allows the model to flexibly adapt to specific scene characteristics (such as the night charging peak of residential areas), and improves the generalization ability. The intelligent cloud layer further aggregates the cross-regional model to ensure that the overall system can meet the local needs and achieve global optimization.
[0025] (4) The centralized method has the risk of single point failure and computing bottleneck. The present application adopts a hierarchical architecture (intelligent cloud layer, DAG blockchain layer, edge server layer, charging pile layer), combined with the distributed training of federated learning and the consensus mechanism of blockchain (such as Tip verification of DAG), which significantly reduces system delay and resource consumption. The edge server handles local aggregation, reducing the burden on the cloud; the blockchain automatically executes the smart contract, reducing human intervention. This not only optimizes the collaborative learning efficiency among charging piles, but also supports large-scale vehicle networking expansion, suitable for dynamic changes in intelligent transportation environment.
[0026] (5) By accurately predicting charging demand, the present application helps to optimize the layout of charging facilities and the distribution of power grid load (such as avoiding overload during peak hours). This reduces the risk of power grid fluctuations, supports the efficient use of clean energy, and meets the goals of environmental protection and sustainable development. At the same time, the transparent blockchain record of the system enhances the regulatory credibility, providing a reliable basis for policy making, ultimately promoting the healthy development of electric vehicle popularization and intelligent transportation system.
[0027] Other advantages, objects, and features of the present application will be in part apparent and in part pointed out hereinafter. The objects and other advantages of the present application can be realized and attained by the structure particularly pointed out in the specification as follows. BRIEF DESCRIPTION OF DRAWINGS
[0028] In order to make the purposes, technical solutions and advantages of the present application clearer, the preferred detailed description of the present application will be combined with the drawings as follows:
[0029] Figure 1 Structure diagram of hierarchical federated learning system based on blockchain architecture;
[0030] Figure 2 Schematic diagram of multi-scale charging demand prediction model based on TSL (Transformer STGCN LSTM);
[0031] Figure 3A flowchart for a charging prediction method based on blockchain and hierarchical federated learning is performed. DETAILED DESCRIPTION
[0032] The present application is herein described, by way of example only, with reference to embodiments thereof. It is to be understood that variations and modifications will be apparent to those skilled in the art and that the application is not restricted to the specific embodiments described herein. It is therefore contemplated that this application extend to other specific embodiments and to equivalent constructions as would be apparent to those skilled in the art. The embodiments described herein are to be understood as illustrative only and are not to be taken as limiting the scope of the present application. The following examples are provided by way of example only and are not intended to limit the scope of the application.
[0033] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the principles of the application. In the drawings:
[0034] The same or similar components in the drawings of the embodiments of the present application correspond to the same or similar components; in the description of the present application, it should be understood that if the terms "upper", "lower", "left", "right", "front", "back" and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, therefore the terms describing the positional relationship in the drawings are only used for illustrative purposes, and cannot be understood as a limitation of the present application, for those skilled in the art, the specific meaning of the above terms can be understood according to the specific circumstances.
[0035] Figure 1 A possible structure of a communication system to which embodiments of the present application are applied is shown. As shown in FIG. 1, the communication system includes a 5G network and an IoT network. Figure 1As shown, the network considers a four-layer network, an intelligent cloud layer, a DAG blockchain layer, an edge server layer, and a charging pile layer. The intelligent cloud layer is composed of cloud servers with rich computing and communication resources, high-efficiency storage capabilities, and federal learning task publishers (i.e., institutions or enterprises) with training task requirements, which is responsible for dividing all charging piles by latitude and longitude and then dividing them into personalized scenarios according to charging time of charging pile users. Meanwhile, the publisher sends task demand information including identity recognition, task description, cross-region model aggregation, and model precision to the cloud server. The DAG blockchain layer is maintained by all edge servers, which uses DAG blockchain technology to record all charging pile transactions and model updates, ensuring data tamper resistance and transparency. The DAG-specific consensus mechanism ensures that all nodes in the network agree on transactions and blocks. The edge server layer is composed of multiple edge servers, each responsible for managing charging piles in a certain area and aggregating scenario models and global models for nodes in the DAG blockchain network to participate in transaction verification and block generation processes. The charging pile layer is composed of a large number of charging piles, which are responsible for accurate charging demand prediction using a Transformer encoder and an LSTM decoder.
[0036] 1. Regional scenario division based on spatial and temporal dimensions
[0037] The difference in geographical location and the difference in scenarios result in a large heterogeneity of electric vehicle charging data, and a general global model cannot meet the demand of personalized scenarios. In actual application scenarios, the charging data of charging piles in the same scenario within the same area is similar, for example, the charging pile data of residential scenarios in the same area is similar.
[0038] Therefore, in order to facilitate the management of charging piles, reduce data heterogeneity, and enhance the personalization of models, the intelligent cloud layer uses geographic information system (GIS) technology to divide regions according to charging pile latitude and longitude information, geographical location distribution, combined with actual traffic conditions and environmental characteristics. Within each region, personalized scenario division is performed according to charging time of charging pile users to adapt to charging demand of different time periods and user behavior, dividing a day into three time periods: night period: 21:00-05:00, noon period: 11:00-15:00, and other periods: 06:00-11:00 and 15:00-22:00, and performing scenario division according to charging data in these three time periods, as shown in Table 1. The amount of charging in each time period is determined according to charging pile data in the region. After normalizing the data, the charging amount is between 0-0.4, which belongs to "less", and the charging amount is between 0.4-1, which belongs to "more".
[0039] Table 1: Personalized scenario division table based on charging amount in time period
[0040]
[0041] As Figure 1 shown, the intelligent cloud layer divides the entire large area into N regions according to the latitude and longitude of the charging piles, and the gray ellipse in the figure is a region, each region is managed by an edge server, and the charging piles in the region are divided into different scenes according to the charging data, and the charging piles of the same color in the figure are the same scene.
[0042] 2. Hierarchical federated learning system based on blockchain architecture
[0043] The system adopts a four-layer network architecture: an intelligent cloud layer, a DAG blockchain layer, an edge server layer, and a charging pile layer. Each layer plays a different role in the system and works together to achieve an efficient and secure charging demand prediction model.
[0044] The genesis transaction in the DAG blockchain is created by the intelligent cloud layer, and each transaction is generated by the edge server. Each transaction is composed of a transaction header and a transaction body. The transaction header includes the version number, timestamp, random number, transaction hash value, number of forward transactions, and all transaction hash values. The transaction body contains the scene aggregation model and the regional global model. The DAG structure is mainly composed of Genesis transaction, Confirmed transaction, Unconfirmed transaction, Tip, and New Tip, and the Confirmed transaction has been verified by many transactions.
[0045] The charging pile layer first trains the model using locally collected data, and then uploads the trained model parameters to the edge server. The edge server layer is responsible for collecting all model parameters uploaded by charging piles in the region, aggregating models in the same scene to form a scene aggregation model, and further aggregating all scene models to build a global model in the region. These models are randomly selected Confirmed transactions as Tip for verification, then packaged into New Tip and uploaded to the DAG blockchain layer, ensuring the legitimacy and accuracy of the model parameters. The intelligent cloud layer collects all regional global models from the Confirmed transactions in the blockchain, and further aggregates them to form a global model, which is then updated and distributed to all edge servers. The edge server downloads the updated global model and distributes it to the charging piles in the region for iterative training until the prediction accuracy of the global model reaches the preset standard. The entire process not only improves the accuracy of charging demand prediction, but also ensures user privacy and data security through the tamper-proof nature of the blockchain. In addition, the automatic execution of smart contracts on the blockchain reduces human intervention and enhances the transparency and credibility of the system.
[0046] 3. Multi-scale charging demand prediction method based on TSL
[0047] In the task of electric vehicle load forecasting, the Transformer model may have limitations in capturing strong temporal relationships in sequences, while LSTM performs poorly in handling complex sequence tasks that require understanding long-distance dependencies. However, by combining the self-attention mechanism of Transformer, the model can more effectively capture global context information and feature relationships between multi-dimensional inputs, and integrate these information into hidden states. In addition, by utilizing the time series modeling capability of LSTM, the model can further analyze these hidden states to deeply mine the global dependencies of sequence data, thus achieving high-precision prediction results. This method combines the advantages of Transformer and LSTM, not only enhancing the model's understanding and prediction ability of time series data, but also improving the accuracy and reliability of electric vehicle load forecasting. Spatial-temporal graph convolution (STGCN) can enable the model to accurately perceive "when and where" load fluctuations when demand mutates or topology changes, when dealing with data with obvious spatial and temporal dependencies. STGCN can capture the spatial relationships between charging piles and the characteristics that change over time by applying convolution operations on graph structures. In this way, STGCN not only enhances the model's understanding of local neighborhood information, but also improves its global perception of the entire traffic network dynamics.
[0048] Therefore, the method uses the encoder of the Transformer to extract features from the time and climate sequences, uploads the data features extracted by the encoder to the edge server, and then waits for the data features uploaded by the edge server to perform spatial-temporal graph convolution to obtain new features with global spatial-temporal dependencies and send them back to the local charging pile. Through the decoder based on LSTM, prediction and model training are performed.
[0049] The encoder based on Transformer is as shown in Figure 2 The encoder receives the input sequence (time, load, weather) collected by the charging pile for position encoding. Since the attention mechanism itself does not contain information about the order of elements in the sequence, position encoding is needed to provide this order information, so that the model can understand the positional relationship of each element in the sequence. In the attention layer, the input data will undergo deep calculation and interaction processing. In order to enhance the expression ability of the model, the information of each position will be independently nonlinearly mapped through a feedforward layer to produce the final attention calculation result. On this basis, in order to ensure that the deep network can be stably trained, the model uses residual connection and normalization to alleviate the problem of gradient vanishing. The specific calculation formula is as follows, which shows how to combine the input and the output after processing by the attention layer.
[0050] X' = X + P (1)
[0051] Q = W q • X', K = W k • X', V = W v • X' (2)
[0052]
[0053] M = Multihead(Q, K, V) (4)
[0054] A' = LayerNorm(X' + M) (5)
[0055] f = ReLU(W1 · A' + b1) · W2 + b2 (6)
[0056] h Encoder = LayerNorm(A' + f) (7)
[0057] where formula (1) represents the position encoding of the input sequence, the input sequence is X, the position encoding is P, and X' is the sequence after position encoding; formula (2) describes the generation of the query (Query), key (Key) and value (Value) matrix in the Transformer, Wq, Wk, Wv are learnable weight matrices, which are used to generate the query, key and value matrix respectively; formula (3) is the calculation process of the self-attention weight, A is the attention output; formula (4) represents the implementation of the multi-head attention mechanism, Multihead(Q, K, V) represents the use of multiple parallel attention mechanisms, each head learns a different representation subspace of the sequence; formula (5) implements the residual connection and layer normalization operation, X' + M represents adding the output M of the multi-head attention to the original input X', which realizes the residual connection, LayerNorm is the layer normalization operation, which normalizes the result of the residual connection, which helps to stabilize the training process; formula (6) is the feedforward layer and further nonlinear transformation. W1 · A' + b1 represents the linear transformation of the feedforward layer, b1 is the bias term, ReLU is the activation function, which introduces nonlinearity. W2 and b2 represent the second linear transformation and bias term to further process the output of the feedforward layer; formula (7) is the final output h Encoder .
[0058] The STGCN-based spatio-temporal graph convolution, as shown in Figure 2 The edge server uses a multi-layer perceptron (MLP) and a softmax activation function to learn the dynamic edge weights in the dynamic adjacency matrix B. The dynamic adjacency matrix B here will change with the change of traffic state, to replace the original static adjacency matrix. By inputting the connection relationship of nodes and various historical traffic data into the MLP layer, the edge weights of the adjacency matrix B evolving over time can be obtained, so as to more accurately represent the correlation between nodes.
[0059]
[0060] where i denotes the target node index in the spatial dimension (i.e., the charging pile node currently being calculated), j denotes the neighbor node index that has a connection relationship with node i, and t denotes the current time in the time dimension. The edge server first embeds the received features into a higher-dimensional space,
[0061] h hds =h Encoder W i (9)
[0062] where W i is the weight matrix of the input embedding. Then the time dependence is obtained through the time convolution layer,
[0063] h tc =Convtime(h hds )W t (10)
[0064] where W t is the weight matrix of the time convolution. The spatial dependence is injected into the features by performing a graph convolution operation with the adjacency matrix,
[0065] h gc =Bh tc W g (11)
[0066] where W g is the weight matrix of the graph convolution. The nonlinearity is introduced by the activation function, and then the dependence relationship is enhanced by the time convolution layer:
[0067] h act =Convtime (ReLU(h gc ))W t (12)
[0068] Finally, the N-layer spatio-temporal graph convolution network outputs the multi-scale features h stgcn with time, space, and weather.
[0069] The decoder based on LSTM is as shown in Figure 2 After the charging pile receives h stgcn , it is spliced with h t-1 , and then the spliced hidden state is linearly mapped through a linear layer to obtain a new hidden state at time t-1,
[0070] h concat =concat(h stgcn ,h t-1 ) (13)
[0071] h' t-1=W agg ·h concat +b agg (14)
[0072] In the formula W agg b agg These are learnable weights and biases. The new hidden state h' t-1 This data will be input into the current cell of the LSTM, along with the input data from the current time step and the cell state C from the previous time step. t-1 After precise calculations via the forget gate, input gate, and output gate, the hidden state and cell state will continue to be passed to the next time step. Furthermore, the hidden state will be transformed through a linear layer to output the predicted value for the current time step. The specific calculation formula is shown in equation (15).
[0073]
[0074] In the formula: t is the time step, x t f is the input at time t; t i t o t The calculation results are for the forget gate, input gate, and output gate, respectively. and C t These represent the candidate cell state values and the updated cell state, respectively; h t The updated hidden state; W f W i W C W o and b f b i b C b o Let f, i, C, o be the corresponding weight matrix and bias vector, where f, i, C, o correspond to the forget gate, input gate, cell state, and output gate, respectively; Ot is the output at the current time step.
[0075] 4. Scenario-based personalized aggregation solutions
[0076] like Figure 1 As shown, the intelligent cloud layer divides all charging piles into N regions, and each region is further divided into different scenarios, corresponding to the charging piles of different colors in the diagram. For charging piles in different scenarios, a local prediction model is trained based on local data using TSL's multi-scale charging demand prediction method, with model parameters θ.
[0077] Charging pile i will use the trained model parameters θ i Uploaded to the edge server, the edge server aggregates all charging piles with the same scenario (corresponding to the same color in the image) using FedAvg.
[0078]
[0079] where θ k is the aggregated model parameter of scenario k, N k is the number of charging piles in scenario k, w i is the data volume proportion weight of charging pile i in scenario k, θ i is the model parameter of charging pile i in scenario k.
[0080] After obtaining the scenario k aggregated model, the scenario k regional global model weight w k is obtained by weighting according to the number of charging piles in the region, and then all the scenario models are aggregated by FedAvg to obtain the regional global model (Regional global model) θrg
[0081]
[0082] 5. System flow diagram
[0083] Figure 3 The execution flow chart of the charging prediction method based on blockchain and hierarchical federated learning is shown in the figure, and the specific steps are as follows:
[0084] S501-S503: System initialization, the intelligent cloud layer utilizes geographic information system (GIS) technology, according to the charging pile longitude and latitude information, the geographical position distribution of the charging pile, combined with the actual traffic condition and environmental characteristics, the region is divided. In each region, according to the charging time of the charging pile user, the personalized scene is divided, in order to adapt to the charging demand of different time periods and user behaviors, a day is divided into three time periods: night period: 21:00-05:00, noon period: 11:00-15:00 and other period: 06:00-11:00 and 15:00-22:00, according to the charging data in the three time periods, the K-mean algorithm is used for scene division, finally the training task is published, the initial prediction model and the training task are issued to the edge server layer, and the genesis block is generated;
[0085] S504: Charging pile registers to become a training charging pile, requests model sharing to the edge server;
[0086] S505: The edge server accepts the charging pile request and verifies the charging pile identity and request content;
[0087] S506: The edge server obtains Tips from the DAG chain, and extracts the global model to send a request to participate in the task of the charging pile;
[0088] S507-S509: Local model training based on TSL prediction method, after the charging pile obtains the global model, the local time, load and meteorological sequence data are extracted by the encoder based on the transformer, the extracted data is sent to the edge server, the edge server obtains the adjacency matrix by dynamic learning, and the received data features are STGCN spatio-temporal graph convolution, inject space-time dependence into the features, and send the features back to the charging pile, the charging pile receives the features and performs prediction and model training through the decoder based on the LSTM;
[0089] S510: The charging pile sends the trained local model to the edge server;
[0090] S511-S512: Scene personalized model aggregation stage, the edge server classifies all received models according to the scene and performs FedAvg aggregation, and aggregates into a scene aggregation model, all scene aggregation models are weighted FedAvg aggregated according to the number of charging piles in the scene, and a regional aggregation model is obtained by aggregation.
[0091] S513: The edge server packs the scene aggregation model, the regional global model and the selected Tips hash information into New Tip and broadcasts it to the DAG chain;
[0092] S514: The intelligent cloud layer obtains the regional global model from the DAG chain to aggregate the global model and update it to the DAG chain;
[0093] S515: If the global model accuracy meets the standard, the task is completed, otherwise continue to jump to S506 to perform the training task.
[0094] It should be noted that in this paper, the term "includes", "contains" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or includes elements inherent to such process, method, article or device. Without more limitations, the element defined by the statement "includes a" does not exclude the presence of another identical element in the process, method, article or device including the element.
[0095] Those skilled in the art can clearly understand the above-mentioned embodiment method can be realized by means of software and the necessary general hardware platform, of course, also can be through hardware, but many cases the former is the better implementation. Based on such understanding, the technical solutions of the present application essentially or say to the prior art contribution part can be embodied in the form of software product, the computer software product is stored in a storage medium (such as ROM / RAM, disk, optical disc), including several instructions to make a terminal (may be a mobile phone, computer, server, air conditioner, or network side equipment, etc.) executes the method for switching cell described in several embodiments of the present application.
[0096] Finally, it is pointed out that the above embodiments are only used to illustrate the technical solutions of the present application rather than limit, although the present application is described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application can be modified or replaced by equivalent, without departing from the purpose and scope of the present technical solutions, which should be covered in the scope of claims of the present application.
Claims
1. A blockchain-based method for predicting charging demand in the Internet of Vehicles (IoV), characterized in that: Includes the following steps: The charging piles are divided into regions based on their geographical location information, and the charging piles in the region are divided into at least one scenario based on the user charging time information of each charging pile. The local model is obtained by training a local model based on the local data of the charging pile; An edge server managing the region receives multiple local models within the region and classifies and aggregates them according to the scenario to which the charging piles corresponding to the local models belong, to obtain at least one scenario aggregation model; and generates a global model of the region based on the at least one scenario aggregation model. The edge server uploads the regional global model to the blockchain network for updating the global model.
2. The method for predicting charging demand in the Internet of Vehicles based on blockchain according to claim 1, characterized in that: The step of training a local model based on local data by the charging pile specifically includes: The charging pile uses a Transformer encoder to process local sequence data containing time, load, and weather information to extract time-weather features; The edge server processes the temporal meteorological features received from the charging piles in the area using a Spatio-Temporal Graph Convolutional Network (STGCN) to fuse spatial dependencies and obtain spatio-temporal fused features. The charging pile employs a Long Short-Term Memory (LSTM) decoder to make predictions based on the spatiotemporal fusion features received from the edge server, thereby completing the training of the local model.
3. The method for predicting charging demand in the Internet of Vehicles based on blockchain according to claim 2, characterized in that: The steps for the edge server to perform the spatiotemporal graph convolutional network (STGCN) processing include: An adjacency matrix is constructed based on the connection relationships of charging piles within the area; The adjacency matrix is used to perform graph convolution operation on the temporal meteorological features to fuse spatial dependencies.
4. The method for predicting charging demand based on blockchain in the Internet of Vehicles according to claim 1, characterized in that: The step of generating a global regional model based on the at least one scene aggregation model specifically includes: The regional global model is obtained by weighting and aggregating the aggregation models of each scenario based on the number of charging piles contained in each scenario.
5. The method for predicting charging demand in the Internet of Vehicles based on blockchain according to claim 1, characterized in that: The step of classifying scenarios based on user charging time information includes: The day is divided into multiple preset time periods, and the charging piles are categorized into at least one scenario based on the charging amount during each time period. The scenarios include at least one of the following: work area scenario, residential area scenario, low-frequency use scenario, and high-traffic area scenario.
6. A blockchain-based charging demand prediction system for the Internet of Vehicles, characterized in that: include: Charging pile layer, edge server layer, and blockchain network; The charging pile layer includes multiple charging piles, which are configured to be assigned to specific scenarios in specific areas based on their geographical location and user charging time, and are used to train local models based on local data. The edge server layer includes at least one edge server, each of which manages one region and is configured to: classify and aggregate multiple local models within the received region according to the scene to which the charging piles corresponding to the local models belong, to obtain at least one scene aggregation model; and generate a global model of the region based on the at least one scene aggregation model. The blockchain network is configured to receive and store the regional global model uploaded by the edge server.
7. The blockchain-based charging demand prediction system for the Internet of Vehicles according to claim 6, characterized in that: The charging pile is equipped with a Transformer encoder and a Long Short-Term Memory (LSTM) decoder, and the edge server is equipped with a Spatiotemporal Graph Convolutional Network (STGCN). The Transformer encoder of the charging pile is used to extract time meteorological features from local sequence data; The STGCN of the edge server is used to process the received temporal meteorological features to fuse spatial dependencies and obtain spatiotemporal fusion features. The LSTM decoder of the charging pile is used to train the local model based on the spatiotemporal fusion features.
8. The blockchain-based charging demand prediction system for the Internet of Vehicles according to claim 6 or 7, characterized in that: The edge server is also configured to: The aggregation models of each scenario are weighted and aggregated according to the number of charging piles contained in each scenario to generate the global model of the region.
9. The blockchain-based charging demand prediction system for the Internet of Vehicles according to claim 6, characterized in that: The system also includes an intelligent cloud layer; The intelligent cloud layer is configured to: perform regional and scene division of the charging pile, obtain global models of each region from the blockchain network to aggregate them into a global model, and distribute the global model to the edge server layer.
10. The blockchain-based charging demand prediction system for the Internet of Vehicles according to claim 6, characterized in that: The blockchain network is a blockchain network based on a Directed Acyclic Graph (DAG).