Power load prediction method and device, terminal equipment and storage medium
By using the Transformer neural network framework and mask multi-head attention layer in power load prediction, combining weather information and time nodes to generate feature coding sequences, the problem of insufficient power load prediction accuracy in the existing technology is solved, and a higher Predictive accuracy and computational efficiency.
Patent Information
- Application Number
- CN202411331090.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-01-10
AI Technical Summary
Existing power load prediction methods are difficult to accurately capture complex timing relationships and long-distance dependencies, and have low computational efficiency, especially in the face of weather sudden changes and market dynamic fluctuations, the prediction accuracy is insufficient.
Using the Transformer neural network framework, combining the mask multi-head attention layer and autonomous force distillation mechanism, a feature encoding sequence is generated by fusing power load information, weather information and time nodes, and capturing load cycle changes, weather characteristics and fusion characteristics to perform power. Load forecast.
It effectively improves the accuracy of power load prediction, overcomes the autoregression problem and the problem of under-mining the dependence of sequence data, and improves the ability to capture nonlinear timing dependence.
Smart Images

Figure CN119297995A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power load forecasting, and in particular to a power load forecasting method, device, terminal equipment and storage medium. Background Art
[0002] In the power industry, accurate short-term load forecasting (STLF) has become the key to ensuring stable operation and efficient dispatch of the power grid. With the incorporation of a large number of renewable energy sources with uncertain output into the power grid, accurate load forecasting has become an important prerequisite for formulating reasonable power generation plans and maintaining system balance. However, load forecasting is a complex task, and its accuracy is easily affected by variable external factors, especially sudden weather changes and market dynamic fluctuations, which have caused difficulties in short-term and even ultra-short-term load forecasting.
[0003] Traditional methods such as autoregressive models can capture some trends in load time series, but they are often difficult to cope with complex and changing actual situations due to their excessive reliance on historical data and insufficient nonlinear modeling capabilities, and their computational efficiency is low. In recent years, the long short-term memory network (LSTM) in recurrent neural networks has effectively improved the prediction accuracy of load forecasting by virtue of its advantage in processing long-term dependent information. However, the LSTM model usually only uses the output of the final unit when extracting features, which to a certain extent ignores the rich contextual information and potential important features in the time series data, limiting its full mining of complex time series relationships. Summary of the invention
[0004] The embodiments of the present invention provide a method, apparatus, terminal device and storage medium for power load forecasting, which can overcome the autoregression problem existing in the prior art and the problem of not being able to fully mine the dependency relationship between sequence data, so that the power load forecasting model can effectively capture enough feature information in the feature coding sequence to perform power load forecasting, thereby effectively improving the accuracy of power load forecasting.
[0005] An embodiment of the present invention provides a method for predicting power load, comprising:
[0006] Obtaining a number of power load information, a time node corresponding to each power load information, and weather information corresponding to each time node;
[0007] Perform fusion coding according to the power load information, the weather information and the time node to generate a feature coding sequence having load cycle variation characteristics, weather characteristics and fusion characteristics;
[0008] The feature coding sequence is input into a preset power load forecasting model so that the power load forecasting model performs power load forecasting according to the feature coding sequence and outputs power load forecasting results for several future time nodes; wherein the power load forecasting model is a Transformer neural network framework, and a masked multi-head attention layer is added to each convolutional layer of the encoder and decoder.
[0009] Furthermore, the fusion coding is performed according to the power load information, the weather information and the time node to generate a feature coding sequence having load cycle variation characteristics, weather characteristics and fusion characteristics, including:
[0010] According to the two power load information at adjacent time nodes, the load difference between each time node is calculated;
[0011] generating a load cycle variation characteristic according to the load difference;
[0012] Encoding the weather information to generate weather characteristics at each time node;
[0013] Using a position encoder, the weather feature is fused with the load cycle change feature according to a time node to generate a fused feature;
[0014] The load cycle variation characteristics, weather characteristics, and the fusion characteristics are encoded to generate the characteristic coding sequence.
[0015] Furthermore, the construction of the power load forecasting model includes:
[0016] Obtaining a number of historical power load information, historical time nodes corresponding to each historical power load information, and historical weather information corresponding to each historical time node;
[0017] Perform fusion coding according to the historical power load information, the historical weather information and the historical time nodes to generate a historical feature coding sequence;
[0018] According to the historical time nodes corresponding to each of the historical feature coding sequences, target power load information at several future time nodes is obtained, and a training data set is constructed according to the historical feature coding sequences and the target power load information;
[0019] Construct an initial neural network model based on the Transformer framework, introduce a masked multi-head attention layer in each convolutional layer of the encoder and decoder of the initial neural network model, and use an autonomous distillation mechanism to connect adjacent convolutional layers in the encoder;
[0020] The historical feature coding sequence of the training data set is used as input, and the target power load information corresponding to the historical feature coding sequence is used to train the initial neural network model, and during the training process, a preset loss function is used to evaluate the initial neural network model according to the power load prediction result output by the initial neural network model, and a corresponding evaluation result is generated;
[0021] When it is determined that the evaluation result is minimized and converged, it is determined that the training of the initial neural network model is completed, and the trained initial neural network model is used as the power load prediction model.
[0022] Furthermore, during the training process, a preset loss function is used to evaluate the initial neural network model according to the power load prediction result output by the initial neural network model, and a corresponding evaluation result is generated, including:
[0023] The following loss function is used to evaluate the initial neural network model:
[0024]
[0025] Wherein, LOSS is the evaluation result, n is the total number of historical feature coding sequences in the training data set, is the power load forecasting result output by the initial neural network model according to the i-th historical feature coding sequence, X i is the target power load information corresponding to the i-th historical feature coding sequence.
[0026] Another embodiment of the present invention provides a power load forecasting device, comprising:
[0027] A data acquisition module is used to acquire a number of power load information, a time node corresponding to each power load information, and weather information corresponding to each time node;
[0028] A data processing module, used to perform fusion coding according to the power load information, the weather information and the time node, and generate a feature coding sequence with load cycle change characteristics, weather characteristics and fusion characteristics;
[0029] The load prediction module is used to input the feature coding sequence into a preset power load prediction model so that the power load prediction model performs power load prediction according to the feature coding sequence and outputs power load prediction results for several future time nodes; wherein the power load prediction model is a Transformer neural network framework, and a masked multi-head attention layer is added to each convolution layer of the encoder and decoder.
[0030] Furthermore, the fusion coding is performed according to the power load information, the weather information and the time node to generate a feature coding sequence having load cycle variation characteristics, weather characteristics and fusion characteristics, including:
[0031] According to the two power load information at adjacent time nodes, the load difference between each time node is calculated;
[0032] generating a load cycle variation characteristic according to the load difference;
[0033] Encoding the weather information to generate weather characteristics at each time node;
[0034] Using a position encoder, the weather feature is fused with the load cycle change feature according to a time node to generate a fused feature;
[0035] The load cycle variation characteristics, weather characteristics, and the fusion characteristics are encoded to generate the characteristic coding sequence.
[0036] Furthermore, the construction of the power load forecasting model includes:
[0037] Obtaining a number of historical power load information, historical time nodes corresponding to each historical power load information, and historical weather information corresponding to each historical time node;
[0038] Perform fusion coding according to the historical power load information, the historical weather information and the historical time nodes to generate a historical feature coding sequence;
[0039] According to the historical time nodes corresponding to each of the historical feature coding sequences, target power load information at several future time nodes is obtained, and a training data set is constructed according to the historical feature coding sequences and the target power load information;
[0040] Construct an initial neural network model based on the Transformer framework, introduce a masked multi-head attention layer in each convolutional layer of the encoder and decoder of the initial neural network model, and use an autonomous distillation mechanism to connect adjacent convolutional layers in the encoder;
[0041] The historical feature coding sequence of the training data set is used as input, and the target power load information corresponding to the historical feature coding sequence is used to train the initial neural network model, and during the training process, a preset loss function is used to evaluate the initial neural network model according to the power load prediction result output by the initial neural network model, and a corresponding evaluation result is generated;
[0042] When it is determined that the evaluation result is minimized and converged, it is determined that the training of the initial neural network model is completed, and the trained initial neural network model is used as the power load prediction model.
[0043] Furthermore, during the training process, a preset loss function is used to evaluate the initial neural network model according to the power load prediction result output by the initial neural network model, and a corresponding evaluation result is generated, including:
[0044] The following loss function is used to evaluate the initial neural network model:
[0045]
[0046] Wherein, LOSS is the evaluation result, n is the total number of historical feature coding sequences in the training data set, is the power load forecasting result output by the initial neural network model according to the i-th historical feature coding sequence, X i is the target power load information corresponding to the i-th historical feature coding sequence.
[0047] Another embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, an electric power load forecasting method as described in any one of the embodiments is implemented.
[0048] Another embodiment of the present invention provides a storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute a power load forecasting method as described in any one of the above embodiments.
[0049] The following beneficial effects are achieved by implementing the present invention:
[0050] The present invention discloses a method, device, terminal equipment and storage medium for predicting electric load. By fusing electric load information, weather information and time nodes, a feature coding sequence with load cycle variation characteristics, weather characteristics and fusion characteristics is generated, and an electric load prediction model based on a Transformer framework is used to predict electric load according to the feature coding sequence. It can be understood that the present invention utilizes the advantage that the Transformer model can calculate the correlation between any two elements in the sequence, thereby effectively capturing the long-distance dependency relationship, so that the electric load prediction model can capture the nonlinear time series dependency relationship in the feature coding sequence. Secondly, a masked multi-head attention mechanism is added to the encoder and decoder of the electric load prediction model, which effectively avoids the problem of autoregression. Therefore, the present invention can overcome the autoregression problem existing in the prior art and the problem that the dependency relationship between sequence data cannot be fully mined, so that the electric load prediction model can effectively capture enough feature information in the feature coding sequence for electric load prediction, thereby effectively improving the accuracy of electric load prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 It is a flow chart of a method for predicting power load provided by one embodiment of the present invention.
[0052] Figure 2 It is a structural schematic diagram of a power load prediction device provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0054] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" in the specification and claims of this application and the above-mentioned figure descriptions and any variations thereof are intended to cover non-exclusive inclusions.
[0055] In the description of the embodiments of the present application, the technical terms "first", "second", etc. are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.
[0056] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0057] In the description of the embodiments of the present application, the term "and / or" is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0058] In the description of the embodiments of the present application, the term "multiple" refers to more than two (including two). Similarly, "multiple groups" refers to more than two groups (including two groups), and "multiple pieces" refers to more than two pieces (including two pieces).
[0059] In the description of the embodiments of the present application, unless otherwise clearly specified and limited, technical terms such as "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal connection of two elements or the interaction relationship between two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the embodiments of the present application can be understood according to the specific circumstances.
[0060] See also Figure 1 , is a flow chart of a method for predicting power load provided by an embodiment of the present invention, comprising:
[0061] S1. Obtaining a number of power load information, a time node corresponding to each power load information, and weather information corresponding to each time node;
[0062] In a preferred embodiment of the present invention, the power load information for each hour in the past seven days is obtained. i ∈R 1*m , and the weather information W corresponding to each hour in the past seven days i∈R 1*m , where R 1*m The initial data set is constructed for power load information, weather information, and time nodes, and m is the length of the initial data set, that is, in this embodiment, m is 7*24.
[0063] S2. Perform fusion coding according to the power load information, the weather information and the time node to generate a feature coding sequence having load cycle variation characteristics, weather characteristics and fusion characteristics;
[0064] Preferably, the fusion coding is performed according to the power load information, the weather information and the time node to generate a feature coding sequence having load cycle variation characteristics, weather characteristics and fusion characteristics, including:
[0065] S21, calculating the load difference between each time node according to two power load information at adjacent time nodes;
[0066] S22, generating a load cycle variation characteristic according to the load difference;
[0067] S23, encoding the weather information to generate weather characteristics at each time node;
[0068] S24, using a position encoder to fuse the weather feature with the load cycle change feature according to a time node to generate a fusion feature;
[0069] S25. Encode the load cycle variation characteristics, weather characteristics, and the fusion characteristics to generate the characteristic coding sequence.
[0070] In a preferred embodiment of the present invention, the power load information l i ∈R 1*m is an m-dimensional vector, first use differential coding to convert it, and then calculate l i The load information of the previous hour i-1 The load difference between i = l i -l i-1 In order to capture the long-term pattern and trend characteristics of historical load, a sliding window with a step size of 1 is used to describe the load cycle variation characteristics. Weather Features i ={wT,wh,wq,...}∈R 1*m , specifically including the weather information corresponding to i, where wT, wh, and wq represent temperature, humidity, and weather conditions (sunny, rainy, snowy, and windy), respectively.
[0071] Furthermore, a position encoder is used to fuse the weather characteristics with the load cycle variation characteristics:
[0072]
[0073] Among them, D i is the fusion feature of the i-th time node, a∈(0,m-1), which represents the dimension index in the position encoding vector.
[0074] It should be noted that the position code uses the sine and cosine functions, which are periodic functions. The code value is limited, can output a unique code, and the distance between the two timestamps is consistent. The position information is the order in the sequence. In the short-term forecast (7 days), the weather characteristics are considered on a daily basis, that is, 24 hours, and the periodicity is added. represents the position encoding of the input vector i, where the period corresponding to the ath dimension is After combining position encoding, the i-th feature encoding sequence is
[0075] S3, inputting the characteristic coding sequence into a preset power load forecasting model, so that the power load forecasting model performs power load forecasting according to the characteristic coding sequence, and outputs power load forecasting results for several future time nodes;
[0076] Among them, the power load prediction model is a Transformer neural network framework, and a masked multi-head attention layer is added to each convolutional layer of the encoder and decoder.
[0077] Preferably, the construction of the power load forecasting model includes:
[0078] S31, obtaining some historical power load information, historical time nodes corresponding to each historical power load information, and historical weather information corresponding to each historical time node;
[0079] S32, performing fusion coding according to the historical power load information, the historical weather information and the historical time nodes to generate a historical feature coding sequence;
[0080] S33, according to the historical time nodes corresponding to each of the historical feature coding sequences, obtaining target power load information at several future time nodes, and constructing a training data set according to the historical feature coding sequences and the target power load information;
[0081] S34, constructing an initial neural network model based on the Transformer framework, and introducing a masked multi-head attention layer in each convolutional layer of the encoder and decoder of the initial neural network model, and using an autonomous distillation mechanism to connect adjacent convolutional layers in the encoder;
[0082] S35, using the historical feature coding sequence of the training data set as input, and using the target power load information corresponding to the historical feature coding sequence to train the initial neural network model, and using a preset loss function during the training process to evaluate the initial neural network model according to the power load prediction result output by the initial neural network model, and generating a corresponding evaluation result;
[0083] Preferably, the initial neural network model is evaluated according to the power load prediction result output by the initial neural network model using a preset loss function during the training process, and a corresponding evaluation result is generated, including:
[0084] S351, using the following loss function to evaluate the initial neural network model:
[0085]
[0086] Wherein, LOSS is the evaluation result, n is the total number of historical feature coding sequences in the training data set, is the power load forecasting result output by the initial neural network model according to the i-th historical feature coding sequence, X i is the target power load information corresponding to the i-th historical feature coding sequence.
[0087] S36. When it is determined that the evaluation result is minimized and converged, it is determined that the training of the initial neural network model is completed, and the trained initial neural network model is used as the power load prediction model.
[0088] In a preferred embodiment of the present invention, in power load forecasting, only historical load data can be used to predict future loads. In order to improve the prediction accuracy and avoid leaking future information to the current position, this embodiment adopts a masked multi-head attention mechanism, introduces a mask matrix in the Transformer framework, and sets the attention weight of the future position to negative infinity, so that the model cannot use future information at the current position. Secondly, the hyperparameter settings: learning rate lr = 0.0001, optimizer is Adam, batch size = 32.
[0089] Let the output vector Y i ={y1,y2,...,y h}, where h is the number of attention heads. In the Transformer framework, let Q be the query matrix, K be the keyword matrix, and the dimensions of Q and K be d. Let V be the value matrix. And qj is the jth row of Q, kj is the jth row of K, then construct the sparsity matrix M(q,K)=sparse(q j,kj) to achieve sparse query. For Q, consider the sparsity matrix M, and only query the first half of M, which is Then the masked multi-head attention mechanism power load forecasting model is:
[0090]
[0091] In the encoder, the masked multi-head attention mechanism and self-attention distillation are combined, and a one-dimensional convolution layer is added to generate a focused self-attention feature map for the next layer. Each layer halves the input sequence through convolution and maximum pooling, gradually reducing the feature layer to achieve the reduction of the input sequence and update it in the next layer.
[0092] For the αth layer, X i have:
[0093]
[0094] Among them, h represents the attention block, Conv ld is the convolution of the time series, and the activation function RELU is used.
[0095] In the decoder, a rolling generation mechanism is used to efficiently process long sequences. The masked dot product in the decoder input vector is set to 0, and masked multi-head attention is applied, namely:
[0096]
[0097] in, That is, the target sequence is positioned at 0 to prevent each position from paying attention to the subsequent position, thereby avoiding autoregression. Then, in each attention head, the similarity score between the current position and other positions is calculated, and the score is used as the attention weight. Then, the representation of other positions is weighted and aggregated according to the attention weight to generate a new representation of the current position, which contains the feature Xtran of nonlinear time series information. i .
[0098] Xtran i = Transformer(X i );
[0099] Finally, a fully connected network is used as the prediction layer to further process and transform the output of the Transformer to obtain the final load forecast result.
[0100] In addition, this embodiment uses the following loss function to evaluate the initial neural network model:
[0101]
[0102] Wherein, LOSS is the evaluation result, n is the total number of historical feature coding sequences in the training data set, is the power load forecasting result output by the initial neural network model according to the i-th historical feature coding sequence, X i is the target power load information corresponding to the i-th historical feature coding sequence.
[0103] It should be noted that the mean square error (MSE) or mean absolute error (MAE) can also be used as a loss function to evaluate the initial neural network model during the training process.
[0104] This embodiment provides a method for predicting electric load, by fusing electric load information, weather information, and time nodes, generating a feature coding sequence with load cycle variation characteristics, weather characteristics, and fusion characteristics, and using an electric load prediction model based on a Transformer framework to perform electric load prediction according to the feature coding sequence. It can be understood that the present invention utilizes the advantage that the Transformer model can calculate the correlation between any two elements in the sequence, thereby effectively capturing the long-distance dependency relationship, so that the electric load prediction model can capture the nonlinear time series dependency relationship in the feature coding sequence. Secondly, a masked multi-head attention mechanism is added to the encoder and decoder of the electric load prediction model, which effectively avoids the problem of autoregression. Therefore, the present invention can overcome the autoregression problem existing in the prior art and the problem of not being able to fully mine the dependency relationship between sequence data, so that the electric load prediction model can effectively capture enough feature information in the feature coding sequence to predict the electric load, thereby effectively improving the accuracy of the electric load prediction.
[0105] See also Figure 2 , is a schematic diagram of the structure of a power load prediction device provided by an embodiment of the present invention, comprising:
[0106] A data acquisition module is used to acquire a number of power load information, a time node corresponding to each power load information, and weather information corresponding to each time node;
[0107] A data processing module, used to perform fusion coding according to the power load information, the weather information and the time node, and generate a feature coding sequence with load cycle change characteristics, weather characteristics and fusion characteristics;
[0108] A load prediction module, used for inputting the characteristic coding sequence into a preset power load prediction model, so that the power load prediction model performs power load prediction according to the characteristic coding sequence and outputs power load prediction results for several future time nodes;
[0109] Among them, the power load prediction model is a Transformer neural network framework, and a masked multi-head attention layer is added to each convolutional layer of the encoder and decoder.
[0110] Preferably, the fusion coding is performed according to the power load information, the weather information and the time node to generate a feature coding sequence having load cycle variation characteristics, weather characteristics and fusion characteristics, including:
[0111] According to the two power load information at adjacent time nodes, the load difference between each time node is calculated;
[0112] generating a load cycle variation characteristic according to the load difference;
[0113] Encoding the weather information to generate weather characteristics at each time node;
[0114] Using a position encoder, the weather feature is fused with the load cycle change feature according to a time node to generate a fused feature;
[0115] The load cycle variation characteristics, weather characteristics, and the fusion characteristics are encoded to generate the characteristic coding sequence.
[0116] Preferably, the construction of the power load forecasting model includes:
[0117] Obtaining a number of historical power load information, historical time nodes corresponding to each historical power load information, and historical weather information corresponding to each historical time node;
[0118] Perform fusion coding according to the historical power load information, the historical weather information and the historical time nodes to generate a historical feature coding sequence;
[0119] According to the historical time nodes corresponding to each of the historical feature coding sequences, target power load information at several future time nodes is obtained, and a training data set is constructed according to the historical feature coding sequences and the target power load information;
[0120] Construct an initial neural network model based on the Transformer framework, introduce a masked multi-head attention layer in each convolutional layer of the encoder and decoder of the initial neural network model, and use an autonomous distillation mechanism to connect adjacent convolutional layers in the encoder;
[0121] The historical feature coding sequence of the training data set is used as input, and the target power load information corresponding to the historical feature coding sequence is used to train the initial neural network model, and during the training process, a preset loss function is used to evaluate the initial neural network model according to the power load prediction result output by the initial neural network model, and a corresponding evaluation result is generated;
[0122] When it is determined that the evaluation result is minimized and converged, it is determined that the training of the initial neural network model is completed, and the trained initial neural network model is used as the power load prediction model.
[0123] Preferably, the initial neural network model is evaluated according to the power load prediction result output by the initial neural network model using a preset loss function during the training process, and a corresponding evaluation result is generated, including:
[0124] The following loss function is used to evaluate the initial neural network model:
[0125]
[0126] Wherein, LOSS is the evaluation result, n is the total number of historical feature coding sequences in the training data set, is the power load forecasting result output by the initial neural network model according to the i-th historical feature coding sequence, X i is the target power load information corresponding to the i-th historical feature coding sequence.
[0127] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.
[0128] Those skilled in the art can clearly understand that for the sake of convenience and brevity, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0129] Another preferred embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements a power load forecasting method as described in any one of the above embodiments.
[0130] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.
[0131] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, and uses various interfaces and lines to connect various parts of the entire terminal device.
[0132] The memory can be used to store the computer program, and the processor realizes various functions of the terminal device by running or executing the computer program stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Med i aCard, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0133] Another preferred embodiment of the present invention provides a storage medium, the storage medium is a computer-readable storage medium, the computer program is stored in the computer-readable storage medium, and the computer program, when executed by the processor, can implement the steps of the above-mentioned various method embodiments. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc.
[0134] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for predicting power load, characterized in that: include: Obtaining a number of power load information, a time node corresponding to each power load information, and weather information corresponding to each time node; Perform fusion coding according to the power load information, the weather information and the time node to generate a feature coding sequence having load cycle variation characteristics, weather characteristics and fusion characteristics; The feature coding sequence is input into a preset power load forecasting model so that the power load forecasting model performs power load forecasting according to the feature coding sequence and outputs power load forecasting results for several future time nodes; wherein the power load forecasting model is a Transformer neural network framework, and a masked multi-head attention layer is added to each convolutional layer of the encoder and decoder.
2. A method for predicting power load according to claim 1, characterized in that: The step of performing fusion coding according to the power load information, the weather information and the time node to generate a feature coding sequence having load cycle variation characteristics, weather characteristics and fusion characteristics includes: According to the two power load information at adjacent time nodes, the load difference between each time node is calculated; generating a load cycle variation characteristic according to the load difference; Encoding the weather information to generate weather characteristics at each time node; Using a position encoder, the weather feature is fused with the load cycle change feature according to a time node to generate a fused feature; The load cycle variation characteristics, weather characteristics, and the fusion characteristics are encoded to generate the characteristic coding sequence.
3. A method for predicting power load according to claim 2, characterized in that: The construction of the power load prediction model includes: Obtaining a number of historical power load information, historical time nodes corresponding to each historical power load information, and historical weather information corresponding to each historical time node; Perform fusion coding according to the historical power load information, the historical weather information and the historical time nodes to generate a historical feature coding sequence; According to the historical time nodes corresponding to each of the historical feature coding sequences, target power load information at several future time nodes is obtained, and a training data set is constructed according to the historical feature coding sequences and the target power load information; Construct an initial neural network model based on the Transformer framework, introduce a masked multi-head attention layer in each convolutional layer of the encoder and decoder of the initial neural network model, and use an autonomous distillation mechanism to connect adjacent convolutional layers in the encoder; The historical feature coding sequence of the training data set is used as input, and the target power load information corresponding to the historical feature coding sequence is used to train the initial neural network model, and during the training process, a preset loss function is used to evaluate the initial neural network model according to the power load prediction result output by the initial neural network model, and a corresponding evaluation result is generated; When it is determined that the evaluation result is minimized and converged, it is determined that the training of the initial neural network model is completed, and the trained initial neural network model is used as the power load prediction model.
4. A method for predicting power load according to claim 3, characterized in that: The initial neural network model is evaluated according to the power load prediction result output by the initial neural network model using a preset loss function during the training process, and a corresponding evaluation result is generated, including: The following loss function is used to evaluate the initial neural network model: Wherein, LOSS is the evaluation result, n is the total number of historical feature coding sequences in the training data set, is the power load forecasting result output by the initial neural network model according to the i-th historical feature coding sequence, X i is the target power load information corresponding to the i-th historical feature coding sequence.
5. A power load forecasting device, characterized in that: include: A data acquisition module is used to acquire a number of power load information, a time node corresponding to each power load information, and weather information corresponding to each time node; A data processing module, used to perform fusion coding according to the power load information, the weather information and the time node, and generate a feature coding sequence with load cycle change characteristics, weather characteristics and fusion characteristics; The load prediction module is used to input the feature coding sequence into a preset power load prediction model so that the power load prediction model performs power load prediction according to the feature coding sequence and outputs power load prediction results for several future time nodes; wherein the power load prediction model is a Transformer neural network framework, and a masked multi-head attention layer is added to each convolution layer of the encoder and decoder.
6. The power load prediction device according to claim 5, characterized in that: The step of performing fusion coding according to the power load information, the weather information and the time node to generate a feature coding sequence having load cycle variation characteristics, weather characteristics and fusion characteristics includes: According to the two power load information at adjacent time nodes, the load difference between each time node is calculated; generating a load cycle variation characteristic according to the load difference; Encoding the weather information to generate weather characteristics at each time node; Using a position encoder, the weather feature is fused with the load cycle change feature according to a time node to generate a fused feature; The load cycle variation characteristics, weather characteristics, and the fusion characteristics are encoded to generate the characteristic coding sequence.
7. The power load prediction device according to claim 6, characterized in that: The construction of the power load prediction model includes: Obtaining a number of historical power load information, historical time nodes corresponding to each historical power load information, and historical weather information corresponding to each historical time node; Perform fusion coding according to the historical power load information, the historical weather information and the historical time nodes to generate a historical feature coding sequence; According to the historical time nodes corresponding to each of the historical feature coding sequences, target power load information at several future time nodes is obtained, and a training data set is constructed according to the historical feature coding sequences and the target power load information; Construct an initial neural network model based on the Transformer framework, introduce a masked multi-head attention layer in each convolutional layer of the encoder and decoder of the initial neural network model, and use an autonomous distillation mechanism to connect adjacent convolutional layers in the encoder; The historical feature coding sequence of the training data set is used as input, and the target power load information corresponding to the historical feature coding sequence is used to train the initial neural network model, and during the training process, a preset loss function is used to evaluate the initial neural network model according to the power load prediction result output by the initial neural network model, and a corresponding evaluation result is generated; When it is determined that the evaluation result is minimized and converged, it is determined that the training of the initial neural network model is completed, and the trained initial neural network model is used as the power load prediction model.
8. The power load forecasting device according to claim 7, characterized in that: The initial neural network model is evaluated according to the power load prediction result output by the initial neural network model using a preset loss function during the training process, and a corresponding evaluation result is generated, including: The following loss function is used to evaluate the initial neural network model: Wherein, LOSS is the evaluation result, n is the total number of historical feature coding sequences in the training data set, is the power load forecasting result output by the initial neural network model according to the i-th historical feature coding sequence, X i is the target power load information corresponding to the i-th historical feature coding sequence.
9. A terminal device, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, an electric power load forecasting method as claimed in any one of claims 1 to 4 is implemented.
10. A storage medium, characterized in that: The storage medium includes a stored computer program, wherein when the computer program is executed, the device where the storage medium is located is controlled to execute a power load forecasting method as described in any one of claims 1 to 4.
Citation Information
Cited By
Load prediction model dynamic adjustment method based on Hurst index guidance
CN120163294A
Industrial load prediction method and system
CN120471241A