Multi-energy-flow heterogeneous data fusion and space-time coupling prediction method and system
By using H3 hexagonal grids and hybrid deep learning models, combined with graph neural networks and Transformers, the problems of data fragmentation and privacy leakage in large transportation hubs were solved, enabling cross-regional knowledge transfer and global collaborative optimization, thereby improving prediction accuracy and scheduling efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUHAN UNIV OF TECH
- Filing Date
- 2026-01-13
- Publication Date
- 2026-04-28
AI Technical Summary
Traditional forecasting and scheduling methods for single transportation or single energy systems are insufficient to meet the comprehensive operational efficiency, safety, and low-carbon performance requirements of large transportation hubs. Furthermore, cross-regional data cannot be effectively integrated and modeled, leading to data fragmentation, isolated modeling, and privacy risks.
A multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction method is adopted. By unifying the spatial benchmark through H3 hexagonal grid, transfer learning and federated learning, a hybrid deep learning model is constructed to realize cross-regional knowledge transfer and global collaborative optimization. Combined with graph neural network and Transformer model, joint prediction of transportation and energy is carried out.
Without leaving the domain data, knowledge transfer and global collaborative optimization across regional data were achieved, improving the prediction accuracy and global collaborative scheduling efficiency in areas with scarce samples, reducing the risk of privacy leakage, and improving the model's adaptability and prediction accuracy.
Smart Images

Figure CN121935539A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent transportation and energy system integration technology, and in particular to a method and system for multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction. Background Technology
[0002] Large transportation hubs such as ports, airports, and railway freight stations are high-density areas of energy consumption and carbon emissions. The coupling relationships between multiple energy flows, such as traffic flow, power flow, hydrogen flow, and heat / cold flow, are becoming increasingly close. Traditional prediction and scheduling methods that only target a single transportation or energy system are no longer sufficient to meet the multiple requirements of comprehensive operational efficiency, safety, and low-carbon indicators. In addition, large hubs are usually composed of multiple heterogeneous sub-regions such as seaports, railways, highways, and energy plants. The data distribution of each sub-region varies greatly and the samples are extremely imbalanced. Conventional centralized deep learning models show a sharp drop in performance in areas with scarce samples. Moreover, the original data involves production secrets and operational security and cannot be transferred out of the country or region, making it difficult to implement cross-regional joint modeling and parameter sharing.
[0003] In addition, although existing graph neural networks or temporal networks have made progress in spatial topology modeling and temporal dependency capture, there is still no spatiotemporal coupled prediction framework that can simultaneously integrate "heterogeneous nodes, multi-type edges, cross-modal features, and privacy protection". In particular, there is a lack of systematic solutions that embed the two-stage training mechanism of "pre-training-fine-tuning" and "federated aggregation" into the multi-energy flow scenario of transportation and energy.
[0004] Therefore, it is essential to provide a method and system for multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction, which can improve the cross-sub-region knowledge transfer and global collaborative optimization without leaving the domain, in order to solve problems such as data fragmentation, isolated modeling, poor regional adaptability, and high risk of privacy leakage. Summary of the Invention
[0005] In view of this, the present invention proposes a multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction method and system that improves the shortcomings of single system modeling, inability to conduct centralized training and effective spatiotemporal coupling.
[0006] On the one hand, the present invention provides a method for multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction, comprising the following steps: S1: Initial screening of raw multi-source heterogeneous data, performing timestamp alignment, outlier removal, and missing value interpolation on the raw multi-source heterogeneous data to form a clean sample pool; S2: Define the structure of the input tensor and the output tensor, and abstract the input and output as spatiotemporal sequence tensor mappings. The structure of both the input tensor and the output tensor is defined as three dimensions: space × time × feature. The multi-source heterogeneous data in the sample pool is represented in a unified three-dimensional manner, and several H3 hexagonal grids are constructed. S3: Construct a dynamic mapping model, using a graph neural network to establish a spatial topology based on several H3 hexagonal grids; obtain the feature vector set corresponding to the time series of several H3 hexagonal grids, and use LSTM and Transformer to model the time series; use a deep neural network DNN or a graph neural network GNN to fit the dynamic mapping relationship between traffic flow and energy flow, and together they form a hybrid deep learning model. S4: A two-stage training mechanism of transfer learning and federated learning is adopted. First, the hybrid deep learning model is pre-trained in the rich data domain, and then transferred to the target sub-region for fine-tuning to complete the independent model training of each target sub-region. The target sub-region is a heterogeneous sub-region that is not the starting position. Then, through federated learning, the model parameters of the independent model training are collaboratively updated among multiple target sub-regions to achieve global optimization of the hybrid deep learning model. S5: Utilize a globally optimized hybrid deep learning model to jointly predict traffic flow and energy load. The prediction results are used for traffic signal control, energy load scheduling, abnormal event early warning, and intelligent decision support to achieve coordinated optimization of traffic and energy.
[0007] Based on the above technical solutions, preferably, step S2 includes the following: S21: Transform the spatial reference system of multi-source heterogeneous data into a unified H3 hexagonal grid index system, enabling data from different sources to be fused, aligned, and computed in the same spatial dimension; S22: Fix the common sampling granularity to ensure that all data have consistent step size and length alignment in the time dimension; S23: Normalize the dimensions of continuous variables.
[0008] Preferably, step S21 involves: using an H3 hexagonal grid indexing system, sampling the multi-source heterogeneous data in the WGS84 geocentric coordinate system as the sole reference benchmark, removing outliers in latitude and longitude, and obtaining the GPS points [longitude, latitude, timestamp] of the feature locations. The feature refers to the traffic attributes recorded at each location and time point. The topographic map is converted into a planarity map, and then the location of each feature is H3 encoded. The latitude and longitude are placed in the H3 hexagonal grid, and a unique 64-bit code is calculated, forming an H3 encoding format of [H3 grid code, unique ID of the matched road segment, matching distance]. Then, based on the H3 spatial partitioning structure, the adjacency, parent-child relationships, and connectivity relationships between multi-scale hexagonal grid units are constructed, forming a complete, non-redundant topological expression that supports graph neural network inference. Weight calculation is performed; when each type of multi-element heterogeneous feature enters the same H3 hexagonal grid, the area weight is calculated simultaneously. A Length weight L and frequency weight FThe calculated weights are then normalized and weighted to obtain the weight matrix. W Based on H3 encoding and weight matrix W Constructing a joint key-value pair of space and attribute values, and fixing feature locations to a unique hexagonal index, provides standardized input primitives for subsequent spatiotemporal tensor splicing and graph neural network message passing; multi-dimensional heterogeneous elements are entities or objects that carry multi-source heterogeneous data.
[0009] More preferably, step S22 involves fixing the common sampling granularity Δ. t Generate a global time index using an integer number of Δt alignment rules. t k = t 0+ k △ t , k ∈ Z , t 0 indicates the time when sampling begins; t k Indicates the first timeline on the common timeline k Each sampling time; k The index is an integer, and each increment of 1 indicates that a sampling window has been advanced. Z Represents the integer field.
[0010] More preferably, step S23 involves first defining the original continuous variables, where each continuous variable's feature is a dimension, and then... x Calculate the arithmetic mean of the total sample size based on historical granular data. μ and standard deviation σ Sort the sample data in ascending order and calculate the word at the 1st position. q The word at position 1 and the 99th position q 99 For continuous variables x The original value is truncated and limited to [ q 1, q 99 Standardization is performed after the interval is defined to obtain the normalized standard score. z z=[ clip ( x , q 1, q 99 )- μ ] / σ , clip ( x , q 1, q 99 ) represents a continuous variable after truncation and standardization. xThe original value; for discrete variables, keep the 0 / 1 encoding and no numerical transformation is required.
[0011] In a further preferred embodiment, step S3 specifically includes the following: S31: Spatial topology modeling. Select the H3 grid coordinates corresponding to the original multi-source heterogeneous data of facility types as nodes and the facility connection relationship as edges to construct a dynamic heterogeneous graph. Use a two-layer heterogeneous graph attention network to perform linear transformation and attention aggregation on traffic nodes and energy nodes respectively, and output spatial embedding. S32: Time series modeling, using a Transformer encoder, inputting a time-embedded sequence to capture the temporal evolution patterns of traffic flow and energy flow; S33: Dynamic mapping and joint prediction. By fitting the mapping relationship between traffic flow and energy flow through a neural network, 128-dimensional topological-temporal encoding is extracted, and external 20-dimensional features are spliced together to form a 148-dimensional joint vector. A two-layer fully connected deep neural network (DNN) is constructed with a bifurcated dual task head at the end, namely a three-dimensional traffic task head and a three-dimensional energy task head, to capture the spatiotemporal coupling characteristics of traffic flow and energy flow.
[0012] Preferably, step S31 includes: S311: Embed the 64-dimensional nodes output from the first-layer heterogeneous graph attention network, input them into a dedicated weight matrix according to the type of the original multi-source heterogeneous data, and obtain 32-dimensional features after activation by the activation function: ,in f ( x ) is the self-feature of the 32-dimensional embedding. This represents the activation function. Indicates node type A dedicated weight matrix, Represents a node m The feature vectors corresponding to the original multi-source heterogeneous data; S312: For each edge, start from the central node M to neighboring nodes N In edge type r Raw attention score: ,in Indicates that the edge starts from the central node. M to neighboring nodes N In edge type r The original attention score on the surface, Representing edge type r The transpose of the attention vector. Let represent the mapping matrices for the head node and tail node of the edge, respectively. z M , z NThese represent the 32-dimensional embedding features of the central node and its neighboring nodes, respectively. S313: Within the same edge type, the original attention scores are converted into a probability distribution using the softmax function, and the attention weights in the interval [0, 1] are output; S314: Weighted aggregation of neighbor features according to edge type, concatenation and dimensionality reduction are performed, and the feature residuals are added to the concatenation. LayerNorm is then used to obtain the final 32-dimensional topological embedding. S315: Repeat steps S311-S314 to map the 64-dimensional input back to a 32-dimensional topological embedding, that is, the final 32-dimensional topological embedding Z is output after the two heterogeneous graph attention networks are concatenated.
[0013] Further preferably, step S32 includes: processing the original multi-source heterogeneous data corresponding to traffic flow and energy flow according to the common sampling granularity Δ t The data is segmented to form a temporal embedding sequence as input data and then organized into a three-dimensional tensor. A self-attention mechanism is constructed, and the output of each time step is processed through two layers of linear transformation and activation functions. Layer normalization and residual connections are added to stabilize the training. The attention mechanism is as follows: ,in Q , K , V These represent the query, key, and value matrices, respectively. d k This represents the dimension of the key vector in each attention head; the output of the Transformer encoder is mapped to the target output dimension through a linear layer.
[0014] More preferably, step S4 includes: In the transfer learning phase, a two-layer heterogeneous graph attention network and a Transformer encoder are pre-trained end-to-end in the rich data source domain to save the general parameter set. Then, the general parameter set is transferred to the target sub-region, unfreezing only the top-level adaptation layer to adapt the model to the data features of the target sub-region. The general representations of the non-top-level adaptation layers remain unchanged. The model expression for fine-tuning the target sub-region data is as follows: ,in This represents the fine-tuning loss for the target sub-region. j This represents the number of samples in the target sub-region. c j This represents the true value of the sample in the target sub-region. The pre-trained model function representing the original region, This indicates the source region freeze function. This represents the trainable parameters of the target sub-region. e j Indicates sample jThe input features correspond to the 148-dimensional joint vector in step S33; independent model training for each target sub-region is completed through the transfer learning stage; In the federated learning phase, after the transfer learning phase, the model parameters after each training round are encrypted and uploaded to a central server in the cloud. The server uses the FedAvg algorithm to aggregate the data according to data quality weights, generate a global model, and send it back to each target sub-region. Each target sub-region downloads the model and continues to fine-tune it locally. The aggregation formula of the FedAvg algorithm is: ,in Indicates the first t +1 round of global parameters, summation upper limit Q0 This indicates the number of target sub-regions participating in this round of aggregation. Indicates the first q The number of local samples per client. This represents the total number of samples. Indicates the first q The parameters of each target sub-region after local training.
[0015] On the other hand, the present invention also provides a multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction system for the above-mentioned method, comprising: The sample construction unit is used to initially screen the original multi-source heterogeneous data, perform timestamp alignment, outlier removal, and missing value interpolation on the original multi-source heterogeneous data, and form a clean sample pool. Tensor mapping unit is used to define the structure of input and output tensors, abstracting the input and output into spatiotemporal sequence tensor mappings. The structure of both input and output tensors is defined as three dimensions: space × time × feature, which unifies the three-dimensional representation of multi-source heterogeneous data in the sample pool. The dynamic mapping model building unit uses graph neural networks to establish spatial topology, LSTM and Transformer to model time series, and deep neural networks (DNN) or graph neural networks (GNN) to fit the dynamic mapping relationship between traffic flow and energy flow. Based on the joint vector of spatial topology, time series and external features, it together constitutes a hybrid deep learning model to output the prediction results of the spatiotemporal coupling relationship between traffic and multi-energy flow in several steps. The two-stage training unit adopts a two-stage training mechanism of transfer learning and federated learning. First, pre-training is completed in the rich data domain, and then the model is transferred to the target sub-region for fine-tuning to complete the independent training model of each target sub-region. The target sub-region is a heterogeneous sub-region that is not the starting position. Then, federated learning is used to collaboratively update the model parameters among multiple target sub-regions to achieve global optimization. Joint forecasting and collaborative optimization, based on cross-regional collaborative modeling after global optimization, simultaneously forecasts traffic flow and energy load, enabling support for traffic signal control, energy load scheduling, abnormal event early warning, and intelligent decision-making.
[0016] The multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction method and system provided by this invention have the following advantages compared with the prior art: 1. This invention proposes a prediction framework for multi-energy flow heterogeneous data fusion and spatiotemporal coupling that can still achieve cross-sub-regional knowledge transfer and global collaborative optimization under the premise of "data not leaving the domain". It unifies the spatial benchmark through hexagonal grid, aligns time with common sampling granularity, and unifies the units of measurement through truncation standardization. Then, it uses a heterogeneous graph attention network to capture the complex topology of "traffic node-energy node-multi-type edge", uses Transformer to extract long-term time dependencies, and uses a dual-task DNN to simultaneously output the traffic and energy states for the next hour. Finally, it uses "pre-training-fine-tuning" to quickly adapt to the target region and "federated aggregation" to achieve multi-regional parameter weighted averaging. This not only solves the compliance problem of cross-regional data not being able to be trained centrally, but also significantly improves the prediction accuracy and global collaborative scheduling efficiency in areas with scarce samples. 2. By using a unified H3 grid, time step, and feature normalization, data from different sources can be jointly analyzed within a unified spatiotemporal framework. This abstracts heterogeneous data into a three-dimensional tensor of space × time × feature, providing a standard interface that can be directly processed for subsequent complex hybrid deep learning models. The spatial representation of the H3 hexagonal grid is more natural, and the constructed grid topology provides a structured input for graph neural networks. 3. In the dynamic mapping model, the spatial dependencies of infrastructure such as transportation networks and energy networks are explicitly modeled using graph neural networks (GNNs); combined with the long-term memory capability of LSTMs and the powerful global attention mechanism of Transformers, the long-term trends, periodicity, and complex temporal dynamics in traffic flow and energy flow can be effectively captured; and the complex and nonlinear dynamic mapping relationship between traffic flow and energy load is learned through deep neural networks (DNNs). 4. Transfer learning allows general knowledge learned in data-rich regions to be quickly transferred to newly established or marginal regions with scarce data, greatly reducing the initial data requirements for these regions. Federated learning aggregates local knowledge from various regions to form a global model with broader knowledge and stronger generalization ability. The combination of the two achieves the effect of privacy-preserving joint training by transmitting parameters without transmitting the original data, thus improving the problem of cross-regional data not being able to be trained centrally. It also improves the prediction accuracy and global collaborative scheduling efficiency in regions with scarce samples. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart of the multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction method and system of the present invention; Figure 2 This is a schematic diagram of the H3 hexagonal grid index system construction method of the multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction method and system of the present invention; Figure 3 This is a schematic diagram of the H3 hexagonal grid mapping of the multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction method and system of the present invention; Figure 4 This is a schematic diagram illustrating the coupling of temporal modeling and spatial network modeling in the multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction method and system of the present invention. Detailed Implementation
[0019] The technical solutions of the present invention will be clearly and completely described below with reference to the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0020] Large hubs such as ports, airports, and railway freight stations simultaneously generate multiple energy flows, including traffic flow, power flow, hydrogen flow, and heat / cold flow. These data vary in form, sampling granularity, and spatial reference systems, and the data volume in each sub-region is extremely unbalanced. Traditional approaches either predict only traffic or only energy, with models operating independently. Simply piling all data into a centralized deep network leads to four persistent problems: drastic performance drops in areas with scarce samples, cross-domain data carrying sensitive information cannot be exported, and graph neural networks and temporal networks operate independently. These problems persist for a long time.
[0021] In view of this, such as Figure 1 As shown, on the one hand, the present invention provides a method for multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction, including the following steps: S1: Initial screening of raw multi-source heterogeneous data, performing timestamp alignment, outlier removal, and missing value interpolation on the raw multi-source heterogeneous data to form a clean sample pool.
[0022] Table 1 shows the original multivariate heterogeneous data that needs to be processed.
[0023] Table 1. Raw multi-source heterogeneous data to be processed
[0024] S2: Define the structure of the input tensor and the output tensor, and abstract the input and output as spatiotemporal sequence tensor mappings. The structure of both the input tensor and the output tensor is defined as three dimensions: space × time × feature. The multi-source heterogeneous data in the sample pool are represented in a unified three-dimensional manner, and several H3 hexagonal grids are constructed.
[0025] The essence of "abstraction" here is to use a unified mathematical object to describe the input tensor and the output tensor, shielding non-essential details such as acquisition method, storage format, and unit differences, while establishing a mapping relationship from the input tensor to the output tensor, that is, a function or model from the input tensor to the output tensor.
[0026] Step S2 specifically includes the following: First, the input-output tensor structure is defined as follows: , X For the input tensor, Y To output a tensor, R The tensor represents the real number field, meaning that every element is a real number, i.e., a continuous value, rather than an integer or a category. This definition is suitable for single-point prediction and can also be extended to regional and multi-part prediction, making it a standard form for deep learning modeling. Based on the above three dimensions, the multi-source heterogeneous data in Table 1, including transportation, electricity, hydrogen energy facilities, thermal / cold energy systems, and events, are represented in a unified three-dimensional manner, including the following steps:
[0027] S21: Unified Spatial Dimension: Transform the spatial reference system of multi-source heterogeneous data into a unified H3 hexagonal grid index system, enabling data from different sources to be fused, aligned, and computed in the same spatial dimension.
[0028] The construction process of the H3 hexagonal grid index system used in this embodiment of the invention is as follows: Figure 2 As shown. An H3 hexagonal mesh with a resolution R=8, an average side length of ≈460 m, and a single cell area of ≈0.16 km² is selected as the hub-and-spoke unified spatial unit, balancing accuracy and computational cost. A schematic diagram of the H3 hexagonal mesh mapping used in this embodiment of the invention is shown below. Figure 3 As shown.
[0029] In this embodiment, the H3 hexagonal grid indexing system is adopted. Multi-source heterogeneous data is sampled using the WGS84 geocentric-ground-fixed coordinate system EPSG:4326 as the sole reference benchmark. After removing outliers in latitude and longitude, the GPS points [longitude, latitude, timestamp] of the feature locations are obtained. Features refer to traffic attributes recorded at each location and time point. The topographic map is converted into a planarity map to prevent distance errors. Then, the location of each feature is H3 encoded, with latitude and longitude placed in the H3 hexagonal grid. A unique 64-bit code is calculated, forming an H3 encoding format of [H3 grid code, unique ID of the matched road segment, matching distance]. Next, based on the H3 spatial partitioning structure, the adjacency, parent-child, and connectivity relationships between multi-scale hexagonal grid units are systematically recovered and constructed to form a complete, non-redundant topological expression that supports graph neural network inference.
[0030] Then, weight calculations are performed to quantify the spatial coupling strength between multi-source heterogeneous elements and the target hexagonal grid cells. The comparability and additivity of heterogeneous data within the same grid are achieved through normalized area, length, or frequency ratios. Here, weight calculation is performed simultaneously with area weights when each type of multi-source heterogeneous element enters the same H3 hexagonal grid. A Length weight L and frequency weight F The calculated weights are then normalized and weighted to obtain the weight matrix. W Based on H3 encoding and weight matrix W Constructing a joint key-value pair of space and attribute values, and fixing feature locations to a unique hexagonal index, provides standardized input primitives for subsequent spatiotemporal tensor splicing and graph neural network message passing; multi-dimensional heterogeneous elements are entities or objects that carry multi-source heterogeneous data.
[0031] Area weight A It reflects the proportion of the intersection of sets. A = Area (Intersection of face and H3) ÷ Area (Original face); Length weight L This reflects the proportion of line segment / pipe length within the H3 hexagonal grid. Frequency weighting F This reflects the percentage of times an event / sample occurs. Area weight A The value ranges from 0 to 1, with a larger value indicating that the face occupies more of the H3 hexagonal grid; length weight L The value range is 0-1, with a larger value indicating a longer line segment within the H3 hexagonal grid; frequency weight. F The value ranges from 0 to 1, and the larger the value, the denser the events are in the H3 hexagonal grid.
[0032] Then, the three weights are normalized and weighted. , , ; w A , w L , w F These are the results of normalizing the three weights, with the subscripts max and min representing the maximum and minimum values of the corresponding weights, respectively. Let the weights for area and length be 40%, and the weight for frequency be 20%, then the weight matrix... W =0.4 w A +0.4 w L +0.2 w F .
[0033] The trajectory map matching in the original multi-source heterogeneous data table uses the H3 hexagonal grid and shortest distance projection algorithm. The input is the GPS point of the feature location [longitude, latitude, timestamp], and the output is the H3 code: [H3 grid code, unique ID of the matched road segment, matching distance].
[0034] S22: Unified time dimension: Fixed common sampling granularity to ensure that all data have consistent step size and length alignment in the time dimension.
[0035] In this embodiment, the common sampling granularity Δ is fixed. t =5min, generate a global time index using an integer number of Δt alignment rules. t k = t 0+ k △ t , k ∈ Z , t 0 indicates the time when sampling begins; t k Indicates the first timeline on the common timeline k Each sampling time; k The index is an integer, and each increment of 1 indicates that a sampling window has been advanced. Z Represents the integer field. Define the historical length window length and the predicted output window length, with a sliding step of 1 window, i.e., 5 minutes.
[0036] Step S22 ensures that each H3 grid node at each time step t kEach grid cell has a feature vector. Therefore, for any given grid cell, a time series of length T with equal intervals can be extracted. This series corresponds directly to the input of the LSTM and Transformer encoder in subsequent step S32.
[0037] S23: Unified feature dimension: Dimensional normalization of continuous variables.
[0038] First, define the initial continuous variables. A feature of a continuous variable is one dimension. For each continuous variable... x Calculate the arithmetic mean of the total sample size based on historical granular data. μ and standard deviation σ .
[0039] The continuous variables here are those listed in Table 1, such as kW and V for electricity, and average speed (km / h) for transportation. Discrete variables, such as construction events, are encoded as 0 / 1 and require no numerical transformation. For each continuous variable... x Calculate historical statistics based on at least 21 days of 5-minute granular data:
[0040] Arithmetic mean Standard deviation , N The total amount of sample data, x i Indicates the first i The original data of each sampling point. Sort the sample data in ascending order, and calculate the word at the 1% position. q The word at position 1 and the 99th position q 99 For continuous variables x The original value is truncated and limited to [ q 1, q 99 Standardization is performed after the interval is defined to obtain the normalized standard score. z z=[ clip ( x , q 1, q 99 )- μ ] / σ , clip ( x , q 1, q 99 ) represents a continuous variable after truncation and standardization. x The original value.
[0041] Step S23 standardizes the continuous variables, bringing features of different dimensions to the same numerical scale. This avoids excessively large local values from affecting the convergence and training of the subsequent model.
[0042] S3: Construct a dynamic mapping model, using a graph neural network (GNN) to establish a spatial topology based on several H3 hexagonal grids; obtain the feature vector set corresponding to the time series of several H3 hexagonal grids, and use LSTM and Transformer to model the time series; use a deep neural network (DNN) or a graph neural network (GNN) to fit the dynamic mapping relationship between traffic flow and energy flow, together forming a hybrid deep learning model.
[0043] Step S3 specifically includes the following: S31: Spatial topology modeling. H3 grid coordinates corresponding to the original multi-source heterogeneous data of facility types are selected as nodes, and facility connections are used as edges to construct a dynamic heterogeneous graph. A two-layer heterogeneous graph attention network, HetGAT, is used to perform linear transformations and attention aggregation on traffic nodes and energy nodes respectively, outputting the spatial embedding. Step S31 specifically includes:
[0044] S311: Embed the 64-dimensional nodes output from the first-layer heterogeneous graph attention network, and input them into a dedicated weight matrix according to the type of the original multi-source heterogeneous data. After activation by the activation function, a 32-dimensional feature is obtained. Here, the types are selected as transportation, electricity, hydrogen, and thermal / cold energy. ,in f ( x ) is the self-feature of the 32-dimensional embedding. This indicates an activation function that has a small slope for negative values, rather than the exact zero value found in ReLU; Indicates node type A dedicated weight matrix, Represents a node m The feature vectors corresponding to the original multi-source heterogeneous data; S312: For each edge, start from the central node M to neighboring nodes N In edge type r Raw attention score: ,in Indicates that the edge starts from the central node. M to neighboring nodes N In edge type r The original attention score on the surface, Representing edge type r The transpose of the attention vector. Let represent the mapping matrices for the head node and tail node of the edge, respectively. z M , zN These represent the 32-dimensional embedding features of the central node and its neighboring nodes, respectively. S313: Within the same edge type, the original attention scores are converted into a probability distribution using the softmax function, and the attention weights in the interval [0, 1] are output to ensure that the sum of the contributions of neighboring nodes is 1; S314: The neighbor features are weighted and aggregated according to edge type, concatenated and then reduced in dimensionality, and added to the residual of its own features. After passing through LayerNorm, the final 32-dimensional topological embedding is obtained for use in subsequent time series models. S315: Repeat steps S311-S314 to map the 64-dimensional input back to a 32-dimensional topological embedding. That is, the final 32-dimensional topological embedding is output after the two heterogeneous graph attention networks are connected in series, which can be used by subsequent time series models.
[0045] S32: Time series modeling, using a Transformer encoder, inputting a time embedding sequence to capture the temporal evolution patterns of traffic flow and energy flow.
[0046] Transformer encoders are suitable for large-scale data and scenarios requiring the capture of long-range dependencies. Therefore, this invention uses a Transformer encoder for time series modeling, including the following steps: S321: The original multi-source heterogeneous data corresponding to traffic flow and energy flow are processed according to a common sampling granularity Δ. t The data is segmented to form a temporal embedded sequence, which is then used as input data and organized into a three-dimensional tensor. S322: The multi-head mechanism learns attention patterns from different subspaces through parallel attention layers, constructs a self-attention mechanism, and then uses the output of each time step through two layers of linear transformation and activation functions, adding layer normalization and residual connections to stabilize training. The attention mechanism is as follows: ,in Q , K , V These represent the query, key, and value matrices, respectively. d k This represents the dimension of the key vector in each attention head; the Transformer encoder layers above are usually stacked in multiple layers to increase the expressive power of the model.
[0047] S323: Map the output of the Transformer encoder to the target output dimension through a linear layer. Preferably, it is trained and optimized with an appropriate loss function and optimizer.
[0048] S33: Dynamic mapping and joint prediction. By fitting the mapping relationship between traffic flow and energy flow through a neural network, 128-dimensional topological-temporal encoding is extracted, and external 20-dimensional features are spliced together to form a 148-dimensional joint vector. A two-layer fully connected deep neural network (DNN) is constructed with a bifurcated dual task head at the end, namely a three-dimensional traffic task head and a three-dimensional energy task head, to capture the spatiotemporal coupling characteristics of traffic flow and energy flow.
[0049] like Figure 4 As shown, the 128-dimensional topology-temporal codes output from steps S31 and S32 are obtained respectively. The 128-dimensional topology embedding output from step S31 includes: a final 32-dimensional topology embedding, 32-dimensional node static attributes (including lane number, transformer capacity, number of hydrogen refueling machines, heat exchange area, etc.), and a 64-dimensional neighbor mean. The 128-dimensional temporal code output from step S32 includes a 32-dimensional historical self-sequence, a 32-dimensional historical neighbor sequence, a 32-dimensional historical original feature, and a 32-dimensional historical residual. The 128-dimensional topology embedding and the 128-dimensional temporal code are concatenated into a 256-dimensional vector. Through a linear dimensionality reduction step, a dimensionality reduction vector is obtained. The 128-dimensional topology-temporal coding is followed by further integration of external 20-dimensional features to form a 148-dimensional joint vector. The external 20-dimensional features include 3-dimensional meteorological features, 3-dimensional event features, 2-dimensional holiday features, and 12-dimensional regional static features. The 3-dimensional meteorological features include temperature, humidity, and wind speed. The 3-dimensional event features include accidents, construction, and road closures. The 2-dimensional holiday features include whether it is a holiday. The 12-dimensional regional static features include sub-region ID, region type, population density, GDP density, region area, region lane kilometers, region substation capacity, number of hydrogen refueling stations, number of heat exchange stations, total regional hydrogen storage, regional energy storage capacity, and regional carbon emission factor.
[0050] Subsequently, a two-layer fully connected deep neural network (DNN) is employed to sequentially reduce the 148-dimensional joint vector to 64 and 32 dimensions, respectively. The network then branches into two task heads: a 3D traffic task head and a 3D energy task head, sharing parameters from the previous layer to capture cross-system coupling. Weighted MSE loss is then used, batching 32 spatiotemporal segments to ensure that traffic and energy errors decrease synchronously. The network outputs a complete 12-step prediction in a single forward pass, with each time step lasting 5 minutes, supporting predictions from 5 minutes to 1 hour. It supports single-task or multi-task parallelism, flexibly switching between head-layer masks without retraining the backbone.
[0051] S4: A two-stage training mechanism of transfer learning and federated learning is adopted. First, the hybrid deep learning model is pre-trained in the rich data domain, and then transferred to the target sub-region for fine-tuning to complete the independent model training of each target sub-region. The target sub-region is a heterogeneous sub-region that is not the starting position. Then, through federated learning, the model parameters of the independent model training are collaboratively updated among multiple target sub-regions to achieve global optimization of the hybrid deep learning model.
[0052] The content of step S4 is as follows: In the transfer learning phase, in the rich data source region, such as the main port area where the data sample concentration area is located, end-to-end pre-training of a two-layer heterogeneous graph attention network and a Transformer encoder is performed first to save the general parameter set. Then, the general parameter set is transferred to the target sub-region, and only the top-level adaptation layer is unfrozen to adapt the model to the data characteristics of the target sub-region. The general representation of the non-top-level adaptation layers remains unchanged. The fine-tuned model expression for the target sub-region data is as follows: ,in This represents the fine-tuning loss for the target sub-region. j This represents the number of samples in the target sub-region. c j This represents the true value of the sample in the target sub-region. The pre-trained model function representing the original region, This indicates the source region freeze function. This represents the trainable parameters of the target sub-region. e j Indicates sample j The input features correspond to the 148-dimensional joint vector in step S33; independent model training for each target sub-region is completed through the transfer learning stage; In the federated learning phase, after the transfer learning phase, the model parameters after each training round are encrypted and uploaded to a central server in the cloud. The server uses the FedAvg algorithm to aggregate the data according to data quality weights, generate a global model, and send it back to each target sub-region. Each target sub-region downloads the model and continues to fine-tune it locally. The aggregation formula of the FedAvg algorithm is: ,in Indicates the first t +1 round of global parameters, summation upper limit Q0 This indicates the number of target sub-regions participating in this round of aggregation. Indicates the first q The number of local samples per client. This represents the total number of samples. Indicates the first q The parameters of each target sub-region after local training.
[0053] The transfer learning process has already completed the independent training of models for each sub-region. After each training round, only the model parameters are encrypted and uploaded to the central server in the port cloud. The server uses the FedAvg algorithm to aggregate data by weight according to data quality, generate a global model, and send it back to each region. Edge nodes download the model and continue to fine-tune it locally, forming a privacy-preserving joint training loop of "data not leaving the domain and model co-evolving". This makes the cross-regional transportation-energy collaborative prediction error continuously decrease, while each sub-region still maintains data sovereignty and compliance.
[0054] S5: Utilize a globally optimized hybrid deep learning model to jointly predict traffic flow and energy load. The prediction results are used for traffic signal control, energy load scheduling, abnormal event early warning, and intelligent decision support to achieve coordinated optimization of traffic and energy.
[0055] The above method achieves a closed loop of "prediction-scheduling-execution-feedback," providing rolling outputs of traffic flow and electricity / hydrogen / heat load for the next hour every 5 minutes. The number of prediction time steps can be increased or decreased as needed.
[0056] On the other hand, the present invention also provides a multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction system for the above-mentioned method, comprising: The sample construction unit is used to initially screen the original multi-source heterogeneous data, perform timestamp alignment, outlier removal, and missing value interpolation on the original multi-source heterogeneous data, and form a clean sample pool. Tensor mapping unit is used to define the structure of input and output tensors, abstracting the input and output into spatiotemporal sequence tensor mappings. The structure of both input and output tensors is defined as three dimensions: space × time × feature, which unifies the three-dimensional representation of multi-source heterogeneous data in the sample pool. The dynamic mapping model building unit uses graph neural networks to establish spatial topology, LSTM and Transformer to model time series, and deep neural networks (DNN) or graph neural networks (GNN) to fit the dynamic mapping relationship between traffic flow and energy flow. Based on the joint vector of spatial topology, time series and external features, it together constitutes a hybrid deep learning model to output the prediction results of the spatiotemporal coupling relationship between traffic and multi-energy flow in several steps. The two-stage training unit adopts a two-stage training mechanism of transfer learning and federated learning. First, pre-training is completed in the rich data domain, and then the model is transferred to the target sub-region for fine-tuning to complete the independent training model of each target sub-region. The target sub-region is a heterogeneous sub-region that is not the starting position. Then, federated learning is used to collaboratively update the model parameters among multiple target sub-regions to achieve global optimization. Joint forecasting and collaborative optimization, based on cross-regional collaborative modeling after global optimization, simultaneously forecasts traffic flow and energy load, enabling support for traffic signal control, energy load scheduling, abnormal event early warning, and intelligent decision-making.
[0057] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction, characterized in that, Includes the following steps: S1: Initial screening of raw multi-source heterogeneous data, performing timestamp alignment, outlier removal, and missing value interpolation on the raw multi-source heterogeneous data to form a clean sample pool; S2: Define the structure of the input tensor and the output tensor. The structure of both the input tensor and the output tensor is defined as three dimensions: space × time × feature. The multi-source heterogeneous data in the sample pool is represented in a unified three-dimensional manner, and several H3 hexagonal grids are constructed. S3: Construct a dynamic mapping model, using a graph neural network to establish a spatial topology based on several H3 hexagonal grids; obtain the feature vector set corresponding to the time series of several H3 hexagonal grids, and use LSTM and Transformer to model the time series; use a deep neural network DNN or a graph neural network GNN to fit the dynamic mapping relationship between traffic flow and energy flow, and together they form a hybrid deep learning model. S4: A two-stage training mechanism of transfer learning and federated learning is adopted. First, the hybrid deep learning model is pre-trained in the rich data domain, and then transferred to the target sub-region for fine-tuning to complete the independent model training of each target sub-region. The target sub-region is a heterogeneous sub-region that is not the starting position. Then, through federated learning, the model parameters of the independent model training are collaboratively updated among multiple target sub-regions to achieve global optimization of the hybrid deep learning model. S5: Utilize a globally optimized hybrid deep learning model to jointly predict traffic flow and energy load. The prediction results are used for traffic signal control, energy load scheduling, abnormal event early warning, and intelligent decision support to achieve coordinated optimization of traffic and energy.
2. The method for multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction according to claim 1, characterized in that, Step S2 includes the following: S21: Transform the spatial reference system of multi-source heterogeneous data into a unified H3 hexagonal grid index system, enabling different multi-source heterogeneous data to be fused, aligned and computed in the same spatial dimension; S22: Fix the common sampling granularity to ensure that all data have consistent step size and length alignment in the time dimension; S23: Normalize the dimensions of continuous variables.
3. The method for multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction according to claim 2, characterized in that, Step S21 involves using the H3 hexagonal grid indexing system to sample multi-source heterogeneous data in the WGS84 geocentric coordinate system as the sole reference benchmark. After removing outliers in latitude and longitude, the GPS points [longitude, latitude, timestamp] of the feature locations are obtained. The features refer to the traffic attributes recorded at each location and time point. The topographic map is converted into a planarity map, and then the location of each feature is H3 encoded. The latitude and longitude are placed in the H3 hexagonal grid, and a unique 64-bit code is calculated, forming an H3 encoding format of [H3 grid code, unique ID of the matched road segment, matching distance]. Then, based on the H3 spatial partitioning structure, the adjacency, parent-child relationships, and connectivity relationships between multi-scale hexagonal grid units are constructed to form a complete, non-redundant topological expression that supports graph neural network inference. Weighting is performed when each type of heterogeneous element enters the same H3 hexagonal grid, and the area weight is calculated simultaneously. A Length weight L and frequency weight F The calculated weights are then normalized and weighted to obtain the weight matrix. W Based on H3 encoding and weight matrix W Construct a spatial-attribute joint key value, and fix the feature location to a unique hexagonal index; multi-dimensional heterogeneous elements are entities or objects that carry multi-source heterogeneous data.
4. The method for multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction according to claim 3, characterized in that, Step S22 involves fixing the common sampling granularity Δ. t Generate a global time index using an integer number of Δt alignment rules. t k = t 0+ k △ t , k ∈ Z , t 0 indicates the time when sampling begins; t k Indicates the first timeline on the common timeline k Each sampling time; k The index is an integer, and each increment of 1 indicates that a sampling window has been advanced. Z Represents the integer field.
5. The method for multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction according to claim 4, characterized in that, Step S23 involves first defining the original continuous variables, where each continuous variable has one dimension as a feature. For each continuous variable... x Calculate the arithmetic mean of the total sample size based on historical granular data. μ and standard deviation σ Sort the sample data in ascending order and calculate the word at the 1st position. q The word at position 1 and the 99th position q 99 For continuous variables x The original value is truncated and limited to [ q 1, q 99 Standardization is performed after the interval is defined to obtain the normalized standard score. z z=[ clip ( x , q 1, q 99 )- μ ] / σ , clip ( x , q 1, q 99 ) represents a continuous variable after truncation and standardization. x The original value; for discrete variables, keep the 0 / 1 encoding and no numerical transformation is required.
6. The method for multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction according to claim 5, characterized in that, Step S3 specifically includes the following: S31: Spatial topology modeling. Select the H3 grid coordinates corresponding to the original multi-source heterogeneous data of facility types as nodes and the facility connection relationship as edges to construct a dynamic heterogeneous graph. Use a two-layer heterogeneous graph attention network to perform linear transformation and attention aggregation on traffic nodes and energy nodes respectively, and output spatial embedding. S32: Time series modeling, using a Transformer encoder, inputting a time-embedded sequence to capture the temporal evolution patterns of traffic flow and energy flow; S33: Dynamic mapping and joint prediction. By fitting the mapping relationship between traffic flow and energy flow through a neural network, 128-dimensional topological-temporal encoding is extracted, and external 20-dimensional features are spliced together to form a 148-dimensional joint vector. A two-layer fully connected deep neural network (DNN) is constructed with a bifurcated dual task head at the end, namely a three-dimensional traffic task head and a three-dimensional energy task head, to capture the spatiotemporal coupling characteristics of traffic flow and energy flow.
7. The method for multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction according to claim 6, characterized in that, Step S31 includes: S311: Embed the 64-dimensional nodes output from the first-layer heterogeneous graph attention network, input them into a dedicated weight matrix according to the type of the original multi-source heterogeneous data, and obtain 32-dimensional features after activation by the activation function: ,in f ( x ) is the self-feature of the 32-dimensional embedding. This represents the activation function. Indicates node type A dedicated weight matrix, Represents a node m The feature vectors corresponding to the original multi-source heterogeneous data; S312: For each edge, start from the central node M to neighboring nodes N In edge type r Raw attention score: ,in Indicates that the edge starts from the central node. M to neighboring nodes N In edge type r The original attention score on the surface, Representing edge type r The transpose of the attention vector. Let represent the mapping matrices for the head node and tail node of the edge, respectively. z M , z N These represent the 32-dimensional embedding features of the central node and its neighboring nodes, respectively. S313: Within the same edge type, the original attention scores are converted into a probability distribution using the softmax function, and the attention weights in the interval [0, 1] are output; S314: Weighted aggregation of neighbor features according to edge type, concatenation and dimensionality reduction are performed, and the feature residuals are added to the concatenation. LayerNorm is then used to obtain the final 32-dimensional topological embedding. S315: Repeat steps S311-S314 to map the 64-dimensional input back to a 32-dimensional topological embedding, that is, the final 32-dimensional topological embedding Z is output after the two heterogeneous graph attention networks are concatenated.
8. The method for multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction according to claim 6, characterized in that, Step S32 includes: processing the original multi-source heterogeneous data corresponding to traffic flow and energy flow according to the common sampling granularity Δ t The data is segmented to form a temporal embedding sequence as input data and then organized into a three-dimensional tensor. A self-attention mechanism is constructed, and the output of each time step is processed through two layers of linear transformation and activation functions. Layer normalization and residual connections are added to stabilize the training. The attention mechanism is as follows: ,in Q , K , V These represent the query, key, and value matrices, respectively. d k This represents the dimension of the key vector in each attention head; the output of the Transformer encoder is mapped to the target output dimension through a linear layer.
9. The method for multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction according to claim 6, characterized in that, The content of step S4 is as follows: In the transfer learning phase, a two-layer heterogeneous graph attention network and a Transformer encoder are pre-trained end-to-end in the rich data source domain to save the general parameter set. Then, the general parameter set is transferred to the target sub-region, unfreezing only the top-level adaptation layer to adapt the model to the data features of the target sub-region. The general representations of the non-top-level adaptation layers remain unchanged. The model expression for fine-tuning the target sub-region data is as follows: ,in This represents the fine-tuning loss for the target sub-region. j This represents the number of samples in the target sub-region. c j This represents the true value of the sample in the target sub-region. The pre-trained model function representing the original region, This indicates the source region freeze function. This represents the trainable parameters of the target sub-region. e j Indicates sample j The input features correspond to the 148-dimensional joint vector in step S33; independent model training for each target sub-region is completed through the transfer learning stage; In the federated learning phase, after the transfer learning phase, the model parameters after each training round are encrypted and uploaded to a central server in the cloud. The server uses the FedAvg algorithm to aggregate the data according to data quality weights, generate a global model, and send it back to each target sub-region. Each target sub-region downloads the model and continues to fine-tune it locally. The aggregation formula of the FedAvg algorithm is: ,in Indicates the first t +1 round of global parameters, summation upper limit Q0 This indicates the number of target sub-regions participating in this round of aggregation. Indicates the first q The number of local samples per client. This represents the total number of samples. Indicates the first q The parameters of each target sub-region after local training.
10. A multi-energy flow heterogeneous data fusion and spatiotemporal coupling prediction system, used to implement the method as described in any one of claims 1-9, characterized in that, include: The sample construction unit is used to initially screen the original multi-source heterogeneous data, perform timestamp alignment, outlier removal, and missing value interpolation on the original multi-source heterogeneous data, and form a clean sample pool. Tensor mapping unit is used to define the structure of input and output tensors, abstracting the input and output into spatiotemporal sequence tensor mappings. The structure of both input and output tensors is defined as three dimensions: space × time × feature, which unifies the three-dimensional representation of multi-source heterogeneous data in the sample pool. The dynamic mapping model building unit uses graph neural networks to establish spatial topology, LSTM and Transformer to model time series, and deep neural networks (DNN) or graph neural networks (GNN) to fit the dynamic mapping relationship between traffic flow and energy flow. Based on the joint vector of spatial topology, time series and external features, it together constitutes a hybrid deep learning model to output the prediction results of the spatiotemporal coupling relationship between traffic and multi-energy flow in several steps. The two-stage training unit adopts a two-stage training mechanism of transfer learning and federated learning. First, pre-training is completed in the rich data domain, and then the model is transferred to the target sub-region for fine-tuning to complete the independent training model of each target sub-region. The target sub-region is a heterogeneous sub-region that is not the starting position. Then, federated learning is used to collaboratively update the model parameters among multiple target sub-regions to achieve global optimization. Joint forecasting and collaborative optimization, based on cross-regional collaborative modeling after global optimization, simultaneously forecasts traffic flow and energy load, enabling support for traffic signal control, energy load scheduling, abnormal event early warning, and intelligent decision-making.