Urban electric power pipe network prediction method and system based on space-time prompt generation and guidance
By constructing a prediction model for spatiotemporal prompt generation and guidance, the problem of inaccurate prediction of spatiotemporal heterogeneity of power pipeline networks is solved, efficient and accurate spatiotemporal prediction of urban power pipeline networks is achieved, and spatiotemporal weights are dynamically adjusted to improve the robustness and accuracy of the prediction.
Patent Information
- Application Number
- CN202510686210.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-27
- Publication Date
- 2025-09-05
AI Technical Summary
Existing technologies have difficulty capturing the temporal and spatial heterogeneity and dynamic changes of power pipeline networks, resulting in inaccurate and incomplete temporal and spatial predictions of power systems.
By constructing a prediction model based on spatiotemporal cue generation and guidance, utilizing multi-scale temporal prior knowledge and semantic spatial cues, and combining spatiotemporal interaction modeling, we can capture temporal and spatial heterogeneity, overcome interference through spatiotemporal cue guidance, and achieve efficient and accurate spatiotemporal prediction.
It achieves efficient, accurate and comprehensive spatiotemporal prediction of urban power pipeline networks, dynamically adjusts spatiotemporal weights, solves the prediction bias caused by spatiotemporal heterogeneity, and improves the robustness and accuracy of the prediction.
Smart Images

Figure CN120596831A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of spatiotemporal data mining, and in particular to a method and system for predicting urban power pipe networks based on spatiotemporal prompt generation and guidance. Background Art
[0002] In urban modernization construction and management, ensuring the safe, stable and efficient operation of power pipeline networks is an important aspect, which requires providing accurate spatiotemporal predictions of the operating status of power pipeline networks.
[0003] Due to the complex distribution of power pipelines, there are large changes and differences in power load, equipment operating conditions, environmental influencing factors, etc. in different regions and time periods, and there are differences in the age of power pipeline facilities. The existing spatiotemporal prediction methods that only consider uniform distribution cannot capture the differences and dynamic changes in the spatiotemporal heterogeneity of the power system, making it difficult to provide comprehensive and accurate predictions.
[0004] Therefore, there is a need in this field for an improved spatiotemporal prediction method that can provide efficient, accurate and comprehensive spatiotemporal prediction of power system scenarios with high spatiotemporal heterogeneity in urban power network monitoring and intelligent scheduling applications. Summary of the Invention
[0005] In view of the above problems, the present invention provides an urban power pipeline network prediction method and system based on spatiotemporal prompt generation and guidance, which can achieve efficient, accurate and comprehensive spatiotemporal prediction of complex scenarios with high spatiotemporal heterogeneity of urban power pipeline networks.
[0006] The present invention provides a method for predicting urban power pipe networks based on spatiotemporal prompt generation and guidance, comprising the following steps:
[0007] Step S1, obtaining multi-scale time prior knowledge, and collecting and standardizing historical spatiotemporal data in the spatial area to be predicted to obtain a standard data set including historical spatiotemporal sequences, wherein the collected historical spatiotemporal data includes power network load;
[0008] Step S2: constructing a prediction model based on spatiotemporal cue generation and guidance. The prediction model includes an encoder, a decoder, a spatiotemporal cue generation module, and a spatiotemporal cue guidance module. The model generates multi-scale temporal cues and semantic spatial cues, and integrates temporal and spatial cues through spatiotemporal interaction modeling to obtain comprehensive spatiotemporal cues, thereby guiding the spatiotemporal modeling process to overcome the interference of spatiotemporal heterogeneity.
[0009] Step S3, using the standard data set to train the constructed prediction model based on spatiotemporal cue generation and guidance to obtain a trained prediction model;
[0010] Step S4: Apply the trained prediction model to the prediction of future spatiotemporal data to obtain spatiotemporal prediction results for the urban power network, and use the spatiotemporal prediction results for power network resource allocation planning.
[0011] Optionally, in step S1: multi-scale time prior knowledge includes month, date, time step, week, whether it is a working day and whether it is a holiday; standardization processing of historical spatiotemporal data in the spatial area to be predicted includes dividing the spatial area to be predicted into N sub-areas, counting the historical spatiotemporal data of each time period in each sub-area, and inputting the historical spatiotemporal data of each time period in each sub-area into a three-dimensional array in the format of B*T*N to obtain a standard data set including historical spatiotemporal sequences, where B represents the data batch, T represents the time series length, and N represents the total number of spatial nodes. Each data point in the standard data set represents the power network load of the node in the data batch at one time step.
[0012] Optionally, step S2 specifically includes the following steps:
[0013] Step S2.1: Build the backbone network of the prediction model, which captures spatiotemporal dependencies and generates spatiotemporal representations through stacked graph convolutional networks and temporal convolutional networks.
[0014] Step S2.2: Construct a spatiotemporal cue generation module to capture temporal heterogeneity through multi-scale temporal cue generation, capture spatial heterogeneity through semantic spatial cue generation, and fuse temporal and spatial cues through spatiotemporal interaction modeling to obtain comprehensive spatiotemporal cues.
[0015] Step S2.3, construct a spatiotemporal cue guidance module. After inputting comprehensive spatiotemporal cues into the encoder, the encoded spatiotemporal representation is cue-guided to overcome the interference of heterogeneity on spatiotemporal modeling.
[0016] Optionally, step S2.2 specifically includes the following steps:
[0017] Step S2.2.1, construct the temporal cue generation part, which captures temporal heterogeneity by combining prior embeddings with memory networks and generates temporal cues through embedding queries;
[0018] Step S2.2.2: Construct the spatial cue generation component, which captures spatial heterogeneity through adaptive node embedding, and constructs a spatial adjacency matrix based on this to perform dependency modeling and representation learning, fusing the representations to generate semantic spatial cues.
[0019] In step S2.2.3, the spatiotemporal cue fusion part is constructed, and the complex interaction between the two is modeled using a learnable spatiotemporal interaction tensor. The fusion process of spatiotemporal cues is regarded as the reverse process of tensor decomposition, and adaptive updates are achieved through backpropagation to obtain comprehensive spatiotemporal cues.
[0020] Optionally, step S2.2.1 specifically includes the following steps:
[0021] First, the multi-scale time prior knowledge is mapped from discrete to continuous feature space to obtain the mapped time prior knowledge:
[0022] e i =Embedding(t i )
[0023] Among them, e i represents the embedding vector of the i-th time prior knowledge, Embedding(·) represents the embedding operation, t i represents the value of the i-th time prior knowledge, i represents the number of the time prior knowledge and i = 1, 2, ..., M, and M is the total number of selected time prior knowledge;
[0024] Then, based on the mapped temporal prior knowledge, the importance of different prior knowledge is adaptively learned through the feature fusion network to obtain a multi-scale temporal fusion representation:
[0025] E t =concat(e1,e2,…e i ,…,e M )W t +b t
[0026] Among them, E t It is a multi-scale temporal fusion representation and represents the domain, T represents the total length of the time step, d h represents the feature dimension of multi-scale temporal fusion representation, concat(·) represents the concatenation process, and W t is the weight of the feature fusion network and sum(·) represents the sum function, d i represents the embedding dimension of the i-th time prior knowledge, b t is the bias of the feature fusion network and
[0027] Next, build the memory network Stores long-term temporal memory learned from history, where m represents the number of memory units stored in the memory network, and d m Represents the characteristic dimension of the memory unit stored in the memory network;
[0028] The query process of the memory network is as follows:
[0029] Q t =E t Wq +b q
[0030]
[0031] O t =V t W o +b o
[0032] Among them, Q t Represented by time fusion representation E t The query vector obtained by mapping exp(·) represents the natural exponential function, W q represents the weight of the query mapping, b q represents the bias of the query mapping, j represents the number of the memory unit and j = 1, 2, ... m, represents the jth memory unit and a j is the jth memory unit The corresponding attention score, V t represents the weighted sum of the memory cells and O t represents the memory-enhanced temporal fusion representation obtained by output mapping and W o represents the weight of the output mapping, b o represents the bias of the output mapping;
[0033] The memory-enhanced temporal fusion representation O obtained by output mapping t As a reminder of the time of generation.
[0034] Optionally, step S2.2.2 specifically includes the following steps:
[0035] First, a pair of trainable node embeddings E1 are randomly initialized based on the number of spatial nodes. To capture spatial heterogeneity, d e Represents the feature dimension of node embedding;
[0036] Based on the obtained pair of trainable node embeddings, construct an adaptive adjacency matrix:
[0037] A adp =softmax(ReLU(E1E2 T ))
[0038] Among them, A adp is an adaptive adjacency matrix and ReLU(·) is the activation function, and softmax(·) is the normalized exponential function;
[0039] Next, to capture spatial heterogeneity, a graph convolutional network is applied to model spatial dependencies:
[0040] H k =σ(A adp H k-1 W k )
[0041] H s =MLP(concat(H0,…,H k ))
[0042] Among them, H k represents the output feature of the k-th order graph convolution, k represents the graph convolution order index, σ(·) is the GeLU activation function, H s represents the multi-order spatial aggregation representation, H0 is the input spatiotemporal representation, W k is the weight of the k-th order graph convolution and MLP(·) represents the multilayer perceptron used for output mapping;
[0043] Perform feature fusion on node embeddings to automatically extract features and generate spatial cues:
[0044] E s =concat(E1,E2)W s +b s
[0045] Among them, E s represents the fused representation of node embedding and W s is the weight of the feature fusion network and b s is the bias of the feature fusion network and
[0046] The obtained node embedding fusion representation E s As a space reminder.
[0047] Optionally, step S2.2.3 specifically includes the following steps:
[0048] First, randomly initialize the learnable tensor Used to model complex spatiotemporal interactions, where d c is the space-time interaction dimension, and d c <<d h ;
[0049] Next, combine the generated time prompt O t With space prompt E s , comprehensively modeling the spatiotemporal interaction process and obtaining fused spatiotemporal cues:
[0050] E st =(O t W t′ )·W c ·(E s W s′ ) T
[0051] Among them, E st represents the fused spatiotemporal cues and W t ′ is the weight that maps the time tensor to the interaction dimension and and W s′ are weights that map spatial tensors to interaction dimensions and W c Represents a randomly initialized learnable tensor.
[0052] Optionally, step S2.3 specifically includes:
[0053] After the fused spatiotemporal cue is input into the encoder, the spatiotemporal representation H obtained by the encoder is guided by spatiotemporal cue to obtain the spatiotemporal representation guided by spatiotemporal cue:
[0054] H′=H⊙E st
[0055] Among them, H is the spatiotemporal representation before spatiotemporal cue guidance, H′ is the spatiotemporal representation after spatiotemporal cue guidance, and E st is the fused spatiotemporal cue, ⊙ represents the Hadamard product operation;
[0056] The obtained spatiotemporal representation guided by the spatiotemporal cues is processed by the decoder to obtain and output the predicted value of the future spatiotemporal sequence.
[0057] Optionally, step S3 specifically includes:
[0058] Get the mean absolute error as the prediction loss:
[0059]
[0060] Among them, L mae represents the prediction loss, n represents the number of spatial nodes and n=1,2…N, q represents the time step in the prediction window, Q represents the future window size, represents the predicted value of the future space-time series, Represents the true value of the future space-time series;
[0061] Based on the obtained prediction loss, the gradient is calculated through back propagation, and the parameters of the prediction model are updated using the stochastic gradient descent algorithm to obtain a trained prediction model.
[0062] According to another embodiment of the present invention, a system for predicting urban power pipe networks based on spatiotemporal prompt generation and guidance is provided, comprising:
[0063] The data collection and processing module is used to collect multi-scale time prior knowledge and historical spatiotemporal data in the spatial area to be predicted, perform standardization on the spatial area to be predicted, and obtain a standard data set including historical spatiotemporal sequences;
[0064] A prediction model based on spatiotemporal cue generation and guidance captures temporal and spatial heterogeneity by generating multi-scale temporal cues and semantic spatial cues, and fuses temporal and spatial cues through spatiotemporal interaction modeling to obtain comprehensive spatiotemporal cues, thereby guiding the spatiotemporal modeling process to overcome the interference of spatiotemporal heterogeneity.
[0065] The training module uses a standard data set to train the prediction model;
[0066] The prediction model based on spatiotemporal cue generation and guidance includes:
[0067] The encoder and decoder use stacked graph convolutional networks and temporal convolutional networks to capture spatiotemporal dependencies and generate spatiotemporal representations layer by layer to perform spatiotemporal predictions;
[0068] The spatiotemporal cue generation module captures temporal heterogeneity through multi-scale temporal cue generation and spatial heterogeneity through semantic spatial cue generation. It then fuses temporal and spatial cues through complex spatiotemporal interaction modeling to obtain comprehensive spatiotemporal cues.
[0069] The spatiotemporal cue guidance module guides the spatiotemporal modeling process through the generated spatiotemporal cues, thereby overcoming the interference of spatiotemporal heterogeneity.
[0070] Compared with the prior art, the urban power pipeline network prediction method and system based on spatiotemporal prompt generation and guidance provided by the present invention have at least the following beneficial effects.
[0071] 1) Capturing spatiotemporal heterogeneity through flexible spatiotemporal cue generation, and utilizing spatiotemporal cues to efficiently guide the spatiotemporal modeling process, thereby overcoming the interference of spatiotemporal heterogeneity and achieving accurate and robust prediction.
[0072] 2) In urban power network monitoring and intelligent dispatching applications, provide efficient, accurate and comprehensive spatiotemporal predictions for power system scenarios with high spatiotemporal heterogeneity.
[0073] 3) Through multi-scale temporal cue generation, combined with temporal priors, the periodicity (intraday fluctuations, seasonal changes) and burstiness (failures or peak loads) of power loads are captured, and the representation of key time points is strengthened through memory networks.
[0074] 4) Through semantic spatial cue generation, the load characteristics of key equipment (such as trunk transmission lines) and non-key equipment (such as branch distribution boxes) are distinguished, the grid topology is modeled (such as the physical connection relationship between substations and transmission lines), and the heterogeneity of spatial dependence is reflected (such as the load difference between industrial areas and residential areas).
[0075] 5) Through the spatiotemporal cue fusion and spatiotemporal cue guidance modules, the spatiotemporal weights are dynamically adjusted to effectively resolve the prediction bias caused by spatiotemporal heterogeneity (such as the difference between the surge in residential electricity consumption during holidays and the steady-state load in industrial areas). BRIEF DESCRIPTION OF THE DRAWINGS
[0076] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. By referring to the drawings, the features and advantages of the present invention can be more clearly understood. The drawings are schematic and should not be understood as limiting the present invention in any way. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0077] Figure 1 It is a principle diagram of an urban power pipeline network prediction method based on spatiotemporal prompt generation and guidance provided according to an embodiment of the present invention.
[0078] Figure 2 It is a schematic block diagram of an urban power network prediction system based on spatiotemporal prompt generation and guidance provided according to an embodiment of the present invention.
[0079] Figure 3 A schematic diagram showing a portion of electricity consumption data collected from historical spatiotemporal data within a spatial area to be predicted in an embodiment of an urban power network prediction method based on spatiotemporal prompt generation and guidance provided in accordance with an embodiment of the present invention is shown.
[0080] Figure 4 This is a comparison curve diagram of the power consumption prediction value and the actual value obtained in an embodiment of the urban power network prediction method based on spatiotemporal prompt generation and guidance provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0081] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present invention and the features therein can be combined with each other without conflict.
[0082] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the scope of protection of the present invention is not limited to the specific embodiments disclosed below.
[0083] The following describes in detail the urban power pipeline network prediction method and system based on spatiotemporal prompt generation and guidance provided in accordance with an embodiment of the present invention with reference to the accompanying drawings.
[0084] like Figure 1 As shown, according to an embodiment of the present invention, a method for predicting an urban power pipeline network based on spatiotemporal prompt generation and guidance is provided, which includes first collecting spatiotemporal data in the spatial area to be predicted, and constructing a standard data set based on this; then constructing a prediction model based on spatiotemporal prompt generation and guidance, the prediction model including a spatiotemporal prompt generation module and a spatiotemporal prompt guidance module; using a standard data set to train the prediction model to obtain a trained prediction model; finally, applying the trained prediction model to the prediction of future spatiotemporal data to obtain a prediction result.
[0085] According to one embodiment of the present invention, a method for predicting an urban power network based on spatiotemporal prompt generation and guidance is provided, which is used to provide spatiotemporal prediction of an urban power network and includes the following steps.
[0086] Step S1: Obtain multi-scale temporal prior knowledge, collect historical spatiotemporal data within the spatial region to be predicted, and perform normalization processing to obtain a standard dataset comprising historical spatiotemporal sequences. The historical spatiotemporal data may include one of the following: peak power grid usage, power grid congestion events, and power grid load. This multi-scale temporal prior knowledge may include information such as month, date, time step, weekday, whether it is a weekday, whether it is a holiday, etc., obtained from a standard calendar. This temporal prior knowledge corresponds one-to-one with the time dimension of the historical spatiotemporal data. Normalizing the historical spatiotemporal data within the spatial region to be predicted includes dividing the spatial region to be predicted into N subregions, collecting historical spatiotemporal data for each time period within each subregion, and inputting the historical spatiotemporal data for each time period within each subregion into a three-dimensional array in the format of B*T*N to obtain a standard dataset comprising historical spatiotemporal sequences, where B represents the data batch, T represents the time series length, and N represents the total number of spatial nodes. Each data point in the standard dataset represents one of the following: peak power grid usage, power grid congestion events, power grid load, etc., for that node within that data batch at that time step.
[0087] Step S2: Construct a prediction model based on spatiotemporal cue generation and guidance. The prediction model includes an encoder, a decoder, a spatiotemporal cue generation module, and a spatiotemporal cue guidance module. This prediction model is a unified framework with an encoder and a decoder. It encodes historical spatiotemporal sequences through a graph convolutional network and a temporal convolutional network to capture spatial and temporal dependencies. It captures temporal and spatial heterogeneity by generating multi-scale temporal cues and semantic spatial cues, respectively. It then fuses temporal and spatial cues through spatiotemporal interaction modeling to obtain comprehensive spatiotemporal cues, thereby guiding the spatiotemporal modeling process to overcome the interference of spatiotemporal heterogeneity.
[0088] The prediction model based on spatiotemporal cue generation and guidance is as follows:
[0089]
[0090] in, is a prediction model based on spatiotemporal cue generation and guidance, θ represents all trainable parameters in the prediction model, X t-P+1:t represents the historical spatiotemporal data from t-P+1 to time t, represents the future spatiotemporal data from time t+1 to time t+Q, Represents the historical real time and space sequence, Represents the future prediction spatiotemporal sequence, t represents the time step, P represents the historical window size, and Q represents the future window size.
[0091] Step S2 specifically includes the following steps.
[0092] Step S2.1: Build the backbone network of the prediction model. The encoder and decoder capture spatiotemporal dependencies and generate spatiotemporal representations through stacked graph convolutional networks and temporal convolutional networks. Taking layer l as an example, the graph convolution operation and temporal convolution operation are defined as:
[0093]
[0094] Among them, Z (l) is the l-th layer of spatiotemporal representation. When l = 0, it is the spatiotemporal sequence input. is the hidden representation obtained by graph convolution, W (l) is the mapping weight, σ(·) is the GELU activation function, Conv1D2(·) and Conv1D1(·) are two layers of one-dimensional convolution operations, A adp is the adaptive adjacency matrix.
[0095] Adaptive adjacency matrix powered by trainable node embeddings To build:
[0096]
[0097] Step S2.2 constructs a spatiotemporal cue generation module. This module captures temporal heterogeneity through multi-scale temporal cue generation and spatial heterogeneity through semantic spatial cue generation. It then fuses temporal and spatial cues through spatiotemporal interaction modeling to produce comprehensive spatiotemporal cues. The spatiotemporal cue generation module includes a temporal cue generation component, a spatial cue generation component, and a spatiotemporal cue fusion component. Step S2.2 specifically includes the following steps:
[0098] In step S2.2.1, the temporal cue generation part is constructed to capture temporal heterogeneity by combining prior embedding with memory network and generate temporal cues through embedding query.
[0099] First, the multi-scale time prior knowledge is mapped from discrete to continuous feature space to obtain the mapped time prior knowledge:
[0100] e i =Embedding(t i )
[0101] Among them, e i represents the embedding vector of the i-th time prior knowledge, Embedding(·) represents the embedding operation, t i represents the value of the i-th time prior knowledge, i represents the number of the time prior knowledge, and i=1,2,…,M, and M is the total number of selected time prior knowledge.
[0102] Then, based on the mapped temporal prior knowledge, the importance of different prior knowledge is adaptively learned through the feature fusion network to obtain a multi-scale temporal fusion representation:
[0103] E t =concat(e1,e2,…e i ,…,e M )W t +b t
[0104] Among them, E t It is a multi-scale temporal fusion representation and W t is the weight of the feature fusion network and sum(·) represents the sum function, b t is the bias of the feature fusion network and represents the domain, T represents the total length of the time step, d i represents the embedding dimension of the i-th time prior knowledge, d h It represents the feature dimension of multi-scale temporal fusion representation, and concat(·) represents the concatenation process.
[0105] Next, build the memory network Store long-term temporal memories learned from history, comprehensively model complex long-term temporal dependencies, and further enhance temporal fusion representation. Where m represents the number of memory units stored in the memory network, d m Represents the feature dimension of the memory unit stored in the memory network.
[0106] The query process of the memory network is as follows:
[0107] Q t =E t W q +b q
[0108]
[0109] O t =V t W o +b o
[0110] Among them, Q t Represented by time fusion representation e t The query vector obtained by mapping exp(·) represents the natural exponential function, W q represents the weight of the query mapping, b q represents the bias of the query mapping, j represents the number of the memory unit and j = 1, 2, ... m, represents the jth memory unit and a j is the jth memory unit The corresponding attention score, V t represents the weighted sum of the memory cells and O t represents the memory-enhanced temporal fusion representation obtained by output mapping and W o represents the weight of the output mapping, b o Represents the bias of the output mapping. The memory unit is a randomly initialized learnable parameter that is automatically stored as long-term memory through model training.
[0111] The memory-enhanced temporal fusion representation O obtained by output mapping t That is, multi-scale temporal cues are generated, which capture temporal heterogeneity.
[0112] Through the above multi-scale time cue generation part, combined with the time prior, the periodicity (intraday fluctuations, seasonal changes) and suddenness (failures or peak loads) of the power load are captured, and the representation of key time points is strengthened through the memory network.
[0113] In step S2.2.2, the spatial cue generation part is constructed, which captures spatial heterogeneity through adaptive node embedding, and based on this, a spatial adjacency matrix is constructed for dependency modeling and representation learning, and the representations are fused to generate semantic spatial cues.
[0114] First, a pair of trainable node embeddings E1 are randomly initialized based on the number of spatial nodes. To capture spatial heterogeneity, d e represents the feature dimension of node embedding, and N represents the number of spatial nodes, so as to more comprehensively model the complex dependencies between nodes from multiple perspectives. Among them, a pair of trainable node embeddings is randomly initialized for each spatial node.
[0115] Based on the obtained pair of trainable node embeddings, their interactions are simulated by matrix multiplication, weak correlations are eliminated by ReLU(·) activation function, and normalized by softmax(·) normalized exponential function to construct an adaptive adjacency matrix. As follows:
[0116] A adp =softmax(ReLU(E1E2 T )).
[0117] Next, we apply graph convolutional networks to model spatial dependencies and automatically learn node features by aggregating multi-order neighbor information to capture spatial heterogeneity, as shown in the following formula:
[0118] H k =σ(A adp H k-1 W k )
[0119] H s =MLP(concat(H0,…,H k ))
[0120] Among them, σ(·) is the GeLU activation function, H0 is the input spatiotemporal representation, H k Represents the output features of the k-th order graph convolution, k represents the order index of the graph convolution, H s represents the multi-order spatial aggregation representation, W k is the weight of the k-th order graph convolution and MLP(·) represents a multi-layer perceptron for output mapping.
[0121] Next, after end-to-end training, node embeddings E1 and E2 automatically learn representations and capture potential spatial heterogeneity from different perspectives. Based on this, feature fusion is performed on node embeddings to automatically extract features and generate spatial cues, as shown in the following formula:
[0122] Es =Concat(E1,E2)W s +b s
[0123] Among them, E s represents the fused representation of node embedding and It captures the semantic spatial heterogeneity, W s is the weight of the feature fusion network and b s is the bias of the feature fusion network and
[0124] The obtained node embedding fusion representation E s As a space reminder.
[0125] Through the above semantic spatial cue generation part, the load characteristics of key equipment (such as trunk transmission lines) and non-key equipment (such as branch distribution boxes) are distinguished, the grid topology (such as the physical connection relationship between substations and transmission lines) is modeled, and the heterogeneity of spatial dependence (such as the load difference between industrial areas and residential areas) is reflected.
[0126] In step S2.2.3, the spatiotemporal cue fusion part is constructed, and the complex interaction between the two is modeled using a learnable spatiotemporal interaction tensor. The fusion process of spatiotemporal cues is regarded as the reverse process of tensor decomposition, and adaptive updates are achieved through backpropagation to obtain comprehensive spatiotemporal cues.
[0127] First, randomly initialize the learnable tensor Used to model complex spatiotemporal interactions, where d c is the space-time interaction dimension, and d c <<d h .
[0128] Next, combine the generated time prompt O t With space prompt E s , comprehensively models the spatiotemporal interaction process with low computational complexity, achieving effective spatiotemporal cue fusion:
[0129] E st =(O t W t′ )·W c ·(E s W s′ ) T
[0130] Among them, E st represents the fused spatiotemporal cues and W t ′ is the weight that maps the time tensor to the interaction dimension and and Ws′ are weights that map spatial tensors to interaction dimensions and W c represents a learnable tensor after random initialization. The fused spatiotemporal cues capture the comprehensive spatiotemporal heterogeneity.
[0131] Step S2.3, construct a spatiotemporal cue guidance module. After inputting comprehensive spatiotemporal cues into the encoder, the encoded spatiotemporal representation is cue-guided to overcome the interference of heterogeneity on spatiotemporal modeling.
[0132] Specifically, the spatiotemporal cue guidance module guides the spatiotemporal modeling process through the spatiotemporal cues generated previously, thereby overcoming the interference of spatiotemporal heterogeneity, improving prediction accuracy and robustness, and making the model more adaptable to dynamic and complex spatiotemporal changes.
[0133] This step S2.3 specifically includes inputting the fully integrated spatiotemporal cues into the encoder, performing spatiotemporal cue guidance, and obtaining a spatiotemporal representation after spatiotemporal cue guidance:
[0134] H′=H⊙E st
[0135] Among them, H is the spatiotemporal representation before spatiotemporal cue guidance, H′ is the spatiotemporal representation after spatiotemporal cue guidance, and E st is the fused spatiotemporal hint, and ⊙ represents the Hadamard product operation.
[0136] The obtained spatiotemporal representation guided by the spatiotemporal cue is an enhanced spatiotemporal representation. The obtained spatiotemporal representation guided by the spatiotemporal cue is processed by a decoder to obtain and output a predicted value of the future spatiotemporal sequence.
[0137] Through the above-mentioned spatiotemporal cue fusion part and the spatiotemporal cue guidance module, the spatiotemporal weights are dynamically adjusted to effectively solve the prediction bias caused by spatiotemporal heterogeneity (such as the difference between the surge in residential electricity consumption during holidays and the steady-state load in industrial areas).
[0138] Step S3: Use the standard data set to train the prediction model based on spatiotemporal prompt generation and guidance to obtain a trained prediction model.
[0139] The mean absolute error (MAE) is obtained as the prediction loss to optimize the prediction model as follows:
[0140]
[0141] Among them, L mae represents the prediction loss, n represents the number of spatial nodes and n=1,2…N, q represents the time step in the prediction window, Q represents the future window size, represents the predicted value of the future space-time series, Represents the true value of the future space-time series.
[0142] Based on the obtained prediction loss, the gradient is calculated through back propagation, and the parameters of the prediction model are updated using the stochastic gradient descent algorithm to obtain a trained prediction model.
[0143] Step S4: Apply the trained prediction model to predict future spatiotemporal data to obtain spatiotemporal prediction results for the urban power network. This spatiotemporal prediction result can be used in fields such as power network load monitoring and for power network resource allocation planning.
[0144] The following describes an urban power network prediction system based on spatiotemporal prompt generation and guidance according to another embodiment of the present invention with reference to the accompanying drawings.
[0145] like Figure 2 As shown, the urban power pipeline prediction system based on spatiotemporal prompt generation and guidance provided according to another embodiment of the present invention includes: a data collection and processing module, which is used to collect historical spatiotemporal data in the spatial area to be predicted, standardize the historical spatiotemporal data, and obtain a standard data set including historical spatiotemporal sequences; a prediction model based on spatiotemporal prompt generation and guidance, which captures temporal and spatial heterogeneity by generating multi-scale temporal prompts and semantic spatial prompts respectively, and obtains comprehensive spatiotemporal prompts by fusing time and space prompts through spatiotemporal interaction modeling, thereby guiding the spatiotemporal modeling process to overcome the interference of spatiotemporal heterogeneity; a training module, which uses a standard data set to train the prediction model.
[0146] The prediction model based on spatiotemporal cue generation and guidance may include: an encoder and a decoder, which capture spatiotemporal dependencies and generate spatiotemporal representations layer by layer through stacked graph convolutional networks and temporal convolutional networks, thereby performing spatiotemporal prediction; a spatiotemporal cue generation module, which captures temporal heterogeneity through multi-scale temporal cue generation and spatial heterogeneity through semantic spatial cue generation, and then fuses temporal cues and spatial cues through complex spatiotemporal interaction modeling to obtain comprehensive spatiotemporal cues; a spatiotemporal cue guidance module, which guides the spatiotemporal modeling process through the generated spatiotemporal cues, thereby overcoming the interference of spatiotemporal heterogeneity.
[0147] The spatiotemporal cue generation module may include: a temporal cue generation part, which captures temporal heterogeneity by combining prior embedding and memory network, and generates temporal cues through embedding query; a spatial cue generation part, which captures spatial heterogeneity through adaptive node embedding, and constructs a spatial adjacency matrix based on this for dependency modeling and representation learning, and fuses the representations to generate semantic spatial cues; a spatiotemporal cue fusion part, which uses a learnable spatiotemporal interaction tensor to model the complex interaction between the two, and regards the fusion process of spatiotemporal cues as the inverse process of tensor decomposition, and realizes adaptive update through backpropagation to obtain comprehensive spatiotemporal cues.
[0148] Example 1
[0149] For ease of understanding, the following uses the power network load in a city as an example to provide a more detailed illustrative description of the urban power network prediction method based on spatiotemporal prompt generation and guidance of the present invention.
[0150] In step S1, statistical data on the city's power grid load is collected from power load sensors at N spatial locations over a period of time. This data is then standardized, with statistics collected for each spatial location and time period. This generates a standard dataset consisting of historical spatiotemporal sequences. The standard dataset is a three-dimensional array of size B × T × N, where B is the number of batches, T is the length of the time series, and N is the number of spatial locations.
[0151] Step S2: construct a prediction model based on spatiotemporal prompt generation and guidance (STMP2G).
[0152] Step S3: training the prediction model using the standard data set.
[0153] Step S4: input the historical spatiotemporal data of the spatial region to be predicted into the trained prediction model, and output the future spatiotemporal data of each region.
[0154] In this embodiment 1, the Beijing power network load data set is used to train the prediction model. The statistical data from January 1, 2022 to December 31, 2024 are intercepted, covering a total of 321 spatial locations, with a time interval of 1 hour. The data set is divided into a training set (70%), a validation set (10%), and a test set (20%) in the time dimension. In this embodiment, the historical 24-hour power network load is used to predict the future 24-hour power network load. The training set is used to train the model, the validation set is used to save the optimal model, and the test set is used to test the model performance. See Figure 3 , showing a part of the historical spatiotemporal data collected in the spatial area to be predicted in Example 1. In order to avoid being too long, only the power network electricity consumption data collected from the first to sixth spatial positions from 0:00 to 12:00 on January 1, 2022 are shown.
[0155] The constructed deep learning model was trained using the partitioned training set. The data was Z-score normalized, and all parameters in the prediction model based on spatiotemporal cue generation and guidance were randomly initialized.
[0156] Training was performed on Intel(R) Xeon(R) Processors CPU and NVIDIA Tesla V100S GPU on Linux operating system using PyTorch framework, with batch size set to 64 and initial learning rate set to 0.001.
[0157] Using AdamW as the optimizer, this deep learning model was trained for 200 epochs on the complete training set. The model was validated using a loss function at each training epoch, and the optimal model was saved based on the loss function value. An early stopping strategy was used during training, terminating training early if the loss function value did not decrease for 20 consecutive epochs.
[0158] See also Figure 4 , shows a comparison curve diagram of the power consumption prediction value obtained in this embodiment 1 and the actual value. It can be concluded from the figure that the prediction value obtained in embodiment 1 has a good fitting result for the actual value, providing an accurate prediction.
[0159] The prediction results of the above embodiment were compared with those of the prior art. Power network load prediction was performed on the same dataset. The comparison results are shown in Table 1. The prediction results were evaluated using mean absolute error (MAE), root mean square error (RMSE), and mean absolute percentage error (MAPE). The lower the error shown in Table 1, the better the prediction effect. Example 1 was compared with nine prior art prediction methods.
[0160] The first is STGCN, which integrates graph convolution and gated temporal convolution via spatiotemporal convolution blocks to capture spatiotemporal dependencies.
[0161] The second is GraphWaveNet, which proposes an adaptive adjacency matrix to capture the hidden spatial dependencies in the data and captures the temporal dependencies through stacked dilated one-dimensional convolutions.
[0162] The third is AGCRN, which captures node-specific patterns through node-adaptive parameter learning, captures potential spatial dependencies with unified node embeddings, and automatically captures spatiotemporal correlations in combination with recurrent networks.
[0163] The fourth is DMSTGCN, which extends the existing graph convolution to dynamic graph convolution by constructing an adaptive spatial adjacency matrix with a day-cycle to model the changing spatial correlation.
[0164] The fifth is STSSL, which adaptively enhances traffic flow graph data at the data level and topological structure level, and captures spatiotemporal heterogeneity through auxiliary self-supervised learning tasks.
[0165] The sixth is MegaCRN, which captures spatiotemporal heterogeneity through spatiotemporal meta-graph learning and combines graph convolution and recurrent networks on the meta-graph to capture spatiotemporal correlation.
[0166] The seventh is TESTAM, which selects a specific spatial modeling method for each node through a hybrid expert model and combines it with a time-enhanced attention model to capture spatiotemporal dependencies.
[0167] The eighth is TGCRN, which learns a time-varying graph structure that can perceive periodicity and trends, and combines it with a gated recurrent unit to jointly capture dynamic spatiotemporal dependencies.
[0168] The ninth is HimNet, which implicitly captures spatiotemporal heterogeneity through spatiotemporal embedding and learns spatiotemporal specific parameters from a meta-parameter pool.
[0169] It can be clearly seen from the comparison results in Table 1 that the prediction effect of the urban power pipeline network prediction method based on spatiotemporal prompt generation and guidance in Example 1 is better than the prediction effects of the nine solutions in the prior art.
[0170] Table 1 Comparison of power network load prediction results for Beijing data set
[0171] Comparison plan MAE(kWh) RMSE(kWh) MAPE (%) STGCN 0.2215 1.7379 13.5446 GraphWaveNet 0.1950 1.6101 11.4839 AGCRN 0.2429 1.9157 15.1936 DMSTGCN 0.1942 1.6026 11.3239 STSSL 0.2248 1.7783 13.5406 MegaCRN 0.1972 1.6075 11.8172 TESTAM 0.2380 1.8181 13.9036 TGCRN 0.2281 1.7716 14.5071 HimNet 0.2146 1.6806 12.8958 Example 1 0.1889 1.5714 10.7779
[0172] Furthermore, several ablation experiments were conducted to demonstrate the effectiveness of the prediction method of the present invention. The experimental results are shown in Table 2.
[0173] Example 1 was compared with four post-ablation models.
[0174] (1) basemodel: The spatiotemporal cue guidance module is deleted, representing the base model that only captures spatiotemporal dependencies but cannot capture spatiotemporal heterogeneity.
[0175] (2) w / o Ot: The time prompt generation module was deleted.
[0176] (3) w / o Es: The spatial hint generation module was deleted.
[0177] (4) w / o Wc: The spatiotemporal cue fusion module was deleted.
[0178] Table 2 Comparison of ablation experiment results on Beijing dataset
[0179] Comparison plan MAE(kWh) RMSE(kWh) MAPE (%) basemodel 0.1937 1.6033 11.1210 w / o Ot 0.1917 1.5916 11.0308 w / o Es 0.1919 1.5945 11.0358 w / o Wc 0.1902 1.5767 11.0141 STMP2G (Example 1) 0.1889 1.5714 10.7779
[0180] It can be seen from the experimental results that the prediction effect of the prediction method according to Example 1 of the present invention is better than that of the other four post-ablation models.
[0181] All of the above optional technical solutions can be combined in any way to form optional embodiments of the present application, and will not be described in detail here.
[0182] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0183] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by any technician familiar with this technical field within the technical scope disclosed by the present invention should be covered by the scope of protection of the present invention.
Claims
1. Urban power network prediction method based on spatiotemporal prompt generation and guidance, characterized by: The following steps are involved: Step S1: obtaining multi-scale time prior knowledge, collecting historical spatiotemporal data in the spatial area to be predicted, and performing standardization processing to obtain a standard data set including historical spatiotemporal sequences. The collected historical spatiotemporal data includes power network load. Step S2: constructing a prediction model based on spatiotemporal cue generation and guidance. The prediction model includes an encoder, a decoder, a spatiotemporal cue generation module, and a spatiotemporal cue guidance module. The model generates multi-scale temporal cues and semantic spatial cues, and integrates temporal and spatial cues through spatiotemporal interaction modeling to obtain comprehensive spatiotemporal cues, thereby guiding the spatiotemporal modeling process to overcome the interference of spatiotemporal heterogeneity. Step S3, using the standard data set to train the constructed prediction model based on spatiotemporal cue generation and guidance to obtain a trained prediction model; Step S4: Apply the trained prediction model to the prediction of future spatiotemporal data to obtain spatiotemporal prediction results for the urban power network, and use the spatiotemporal prediction results for power network resource allocation planning.
2. The urban power network prediction method based on spatiotemporal prompt generation and guidance according to claim 1 is characterized in that: In step S1: Multi-scale time prior knowledge includes month, date, time step, week, whether it is a weekday, and whether it is a holiday; The standardization processing of the historical spatiotemporal data in the spatial area to be predicted includes dividing the spatial area to be predicted into N sub-areas, counting the historical spatiotemporal data of each time period in each sub-area, and inputting the historical spatiotemporal data of each time period in each sub-area into a three-dimensional array in the format of B*T*N to obtain a standard data set including historical spatiotemporal sequences, where B represents the data batch, T represents the length of the time series, and N represents the total number of spatial nodes. Each data point in the standard data set represents the power network load of the node in the data batch at one time step.
3. The urban power network prediction method based on spatiotemporal prompt generation and guidance according to claim 1 is characterized in that: Step S2 specifically includes the following steps: Step S2.1: Build the backbone network of the prediction model, which captures spatiotemporal dependencies and generates spatiotemporal representations through stacked graph convolutional networks and temporal convolutional networks. Step S2.2: Construct a spatiotemporal cue generation module to capture temporal heterogeneity through multi-scale temporal cue generation, capture spatial heterogeneity through semantic spatial cue generation, and fuse temporal and spatial cues through spatiotemporal interaction modeling to obtain comprehensive spatiotemporal cues. Step S2.3, construct a spatiotemporal cue guidance module. After inputting comprehensive spatiotemporal cues into the encoder, the encoded spatiotemporal representation is cue-guided to overcome the interference of heterogeneity on spatiotemporal modeling.
4. The urban power network prediction method based on spatiotemporal prompt generation and guidance according to claim 3 is characterized in that: Step S2.2 specifically includes the following steps: Step S2.2.1, construct the temporal cue generation part, which captures temporal heterogeneity by combining prior embeddings with memory networks and generates temporal cues through embedding queries; Step S2.2.2: Construct the spatial cue generation component, which captures spatial heterogeneity through adaptive node embedding, and constructs a spatial adjacency matrix based on this to perform dependency modeling and representation learning, fusing the representations to generate semantic spatial cues. In step S2.2.3, the spatiotemporal cue fusion part is constructed, and the complex interaction between the two is modeled using a learnable spatiotemporal interaction tensor. The fusion process of spatiotemporal cues is regarded as the reverse process of tensor decomposition, and adaptive updates are achieved through backpropagation to obtain comprehensive spatiotemporal cues.
5. The urban power network prediction method based on spatiotemporal prompt generation and guidance according to claim 4 is characterized in that: Step S2.2.1 specifically includes the following steps: First, the multi-scale time prior knowledge is mapped from discrete to continuous feature space to obtain the mapped time prior knowledge: e i =Embedding(t i ) Among them, e i represents the embedding vector of the i-th time prior knowledge, Embedding(·) represents the embedding operation, t i represents the value of the i-th time prior knowledge, i represents the number of the time prior knowledge and i = 1, 2, ..., M, and M is the total number of selected time prior knowledge; Then, based on the mapped temporal prior knowledge, the importance of different prior knowledge is adaptively learned through the feature fusion network to obtain a multi-scale temporal fusion representation: AND t =concat(e1,e2,…e i ,…,and M )W t +b t Among them, E t It is a multi-scale temporal fusion representation and represents the domain, T represents the total length of the time step, d h represents the feature dimension of multi-scale temporal fusion representation, concat(·) represents the concatenation process, and W t is the weight of the feature fusion network and sum(·) represents the sum function, d i represents the embedding dimension of the i-th time prior knowledge, b t is the bias of the feature fusion network and Next, build the memory network Stores long-term temporal memory learned from history, where m represents the number of memory units stored in the memory network, and d m Represents the characteristic dimension of the memory unit stored in the memory network; The query process of the memory network is as follows: Q t =E t W q +b q O t =V t W o +b o Among them, Q t Represented by time fusion representation E t The query vector obtained by mapping exp(·) represents the natural exponential function, W q represents the weight of the query mapping, b q represents the bias of the query mapping, j represents the number of the memory unit and j = 1, 2, ... m, represents the jth memory unit and a j is the jth memory unit The corresponding attention score, V t represents the weighted sum of the memory cells and O t represents the memory-enhanced temporal fusion representation obtained by output mapping and W o represents the weight of the output mapping, b o represents the bias of the output mapping; The memory-enhanced temporal fusion representation O obtained by output mapping t As a reminder of the time of generation.
6. The urban power network prediction method based on spatiotemporal prompt generation and guidance according to claim 5 is characterized in that: Step S2.2.2 specifically includes the following steps: First, a pair of trainable node embeddings are randomly initialized based on the number of spatial nodes To capture spatial heterogeneity, d e Represents the feature dimension of node embedding; Based on the obtained pair of trainable node embeddings, construct an adaptive adjacency matrix: YOUR adp =softmax(ReLU(E1E2 T )) Among them, A adp is an adaptive adjacency matrix and ReLU(·) is the activation function, and softmax(·) is the normalized exponential function; Next, to capture spatial heterogeneity, a graph convolutional network is applied to model spatial dependencies: H k =σ(A adp H k-1 W k ) H s =MLP(concat(H0,…,H k )) Among them, H k represents the output feature of the k-th order graph convolution, k represents the graph convolution order index, σ(·) is the GeLU activation function, H s represents the multi-order spatial aggregation representation, H0 is the input spatiotemporal representation, W k is the weight of the k-th order graph convolution and MLP(·) represents the multilayer perceptron used for output mapping; Perform feature fusion on node embeddings to automatically extract features and generate spatial cues: AND s =concat(E1,E2)W s +b s Among them, E s represents the fused representation of node embedding and W s is the weight of the feature fusion network and b s is the bias of the feature fusion network and The obtained node embedding fusion representation E s As a space reminder.
7. The urban power network prediction method based on spatiotemporal prompt generation and guidance according to claim 6 is characterized in that: Step S2.2.3 specifically includes the following steps: First, randomly initialize the learnable tensor Used to model complex spatiotemporal interactions, where d c is the space-time interaction dimension, and d c <<d h ; Next, combine the generated time prompt O t With space prompt E s , comprehensively modeling the spatiotemporal interaction process and obtaining fused spatiotemporal cues: HAVE BEEN st =(O t W t′ )·W c ·(HAVE BEEN s W s′ ) T Among them, E st represents the fused spatiotemporal cues and W t ′ is the weight that maps the time tensor to the interaction dimension and and W s′ are weights that map spatial tensors to interaction dimensions and W c Represents a randomly initialized learnable tensor.
8. The urban power network prediction method based on spatiotemporal prompt generation and guidance according to claim 7 is characterized in that: Step S2.3 specifically includes: After the fused spatiotemporal cue is input into the encoder, the spatiotemporal representation H obtained by the encoder is guided by spatiotemporal cue to obtain the spatiotemporal representation guided by spatiotemporal cue: H′=H⊙E st Among them, H is the spatiotemporal representation before spatiotemporal cue guidance, H′ is the spatiotemporal representation after spatiotemporal cue guidance, and E st is the fused spatiotemporal cue, ⊙ represents the Hadamard product operation; The obtained spatiotemporal representation guided by the spatiotemporal cues is processed by the decoder to obtain and output the predicted value of the future spatiotemporal sequence.
9. The urban power network prediction method based on spatiotemporal prompt generation and guidance according to claim 8 is characterized in that: Step S3 specifically includes: Get the mean absolute error as the prediction loss: Among them, L mae represents the prediction loss, n represents the number of spatial nodes and n=1,2…N, q represents the time step in the prediction window, Q represents the future window size, represents the predicted value of the future space-time series, Represents the true value of the future space-time series; Based on the obtained prediction loss, the gradient is calculated through back propagation, and the parameters of the prediction model are updated using the stochastic gradient descent algorithm to obtain a trained prediction model.
10. A system for executing the urban power network prediction method based on spatiotemporal prompt generation and guidance according to any one of claims 1 to 9, characterized in that: include: The data collection and processing module is used to collect multi-scale time prior knowledge and historical spatiotemporal data in the spatial area to be predicted, perform standardization on the spatial area to be predicted, and obtain a standard data set including historical spatiotemporal sequences; A prediction model based on spatiotemporal cue generation and guidance captures temporal and spatial heterogeneity by generating multi-scale temporal cues and semantic spatial cues, and fuses temporal and spatial cues through spatiotemporal interaction modeling to obtain comprehensive spatiotemporal cues, thereby guiding the spatiotemporal modeling process to overcome the interference of spatiotemporal heterogeneity. The training module uses a standard data set to train the prediction model; The prediction model based on spatiotemporal cue generation and guidance includes: The encoder and decoder use stacked graph convolutional networks and temporal convolutional networks to capture spatiotemporal dependencies and generate spatiotemporal representations layer by layer to perform spatiotemporal predictions; The spatiotemporal cue generation module captures temporal heterogeneity through multi-scale temporal cue generation and spatial heterogeneity through semantic spatial cue generation. It then fuses temporal and spatial cues through complex spatiotemporal interaction modeling to obtain comprehensive spatiotemporal cues. The spatiotemporal cue guidance module guides the spatiotemporal modeling process through the generated spatiotemporal cues, thereby overcoming the interference of spatiotemporal heterogeneity.