Building electrical load prediction method and system based on domain knowledge constraint
By constructing domain knowledge physical constraints and loss calculation functions in building power load prediction, the prediction integration model of KAN network and LSTM units is optimized, and the problems of poor performance and overfitting of prediction parameters in the existing prediction methods are solved, achieving higher prediction accuracy and rationality.
Patent Information
- Application Number
- CN202510138097.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-08
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2045-02-08
AI Technical Summary
The existing building power load prediction methods lack construction based on actual physical analytical models and domain knowledge, resulting in poor performance of prediction parameters, low model accuracy, large deviations in prediction results, and overfitting is prone to occur when processing complex data models.
Using a method based on domain knowledge constraints, the parameters of the prediction integration model combined with periodic KAN network and LSTM units are optimized to obtain an optimized prediction integration model for predicting the building energy consumption per hour the next day.
Through the embedding of domain knowledge, prediction values that are significantly different from actual physical values are prevented, the rationality and accuracy of prediction results are improved, the number of model parameters is reduced, and the prediction performance under low computing resources is improved.
Smart Images

Figure CN119582213A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of power load forecasting, and in particular to a method and system for forecasting building power load based on domain knowledge constraints. Background Art
[0002] The statements in this section merely provide background information related to the present disclosure and do not necessarily constitute prior art.
[0003] Building power load forecasting is a key link in modern building energy management systems, and its accuracy directly affects the optimization of building energy consumption and energy-saving effects. With the increase in the penetration rate of renewable energy and the development trend of decentralization and multi-energy synergy and complementarity of building energy systems, higher requirements are placed on building power load forecasting. Traditional load forecasting methods mainly rely on empirical models and statistical models. Although these methods can meet basic forecasting needs to a certain extent, their prediction accuracy and generalization ability are limited by the quality of historical data and models.
[0004] In recent years, with the rapid development of technologies such as big data and artificial intelligence, data-driven forecasting methods have been widely used in the field of building power load forecasting. These methods can significantly improve the accuracy and stability of power load forecasting by mining and analyzing a large amount of historical data and establishing high-precision forecasting models. However, pure data-driven methods often lack an in-depth understanding of the physical characteristics and operating mechanisms of buildings, which may lead to deviations in the forecasting process, especially under special conditions. Specifically, the current building power load forecasting model still has the following problems: (1) The prediction indicators in the building energy system are not based on actual physical analytical models and domain knowledge, resulting in poor performance of prediction parameters, low model accuracy, large deviations in prediction results, and often situations that are inconsistent with common sense.
[0005] (2) When faced with complex data models, traditional algorithms require a large number of parameters to fit complex functions, which increases the computational cost of model training, easily leads to overfitting, and lacks generalization capabilities when dealing with time series problems. Summary of the invention
[0006] In order to solve the above problems, the present invention proposes a building electricity load prediction method and system based on domain knowledge constraints, constructs an objective function, and gradually optimizes the prediction model by physically constraining the objective function and calculating the physical constraint loss. The optimized prediction model is used to predict the building energy consumption per hour for the next day, thereby improving the rationality of the prediction results and the prediction accuracy.
[0007] According to some embodiments, the present disclosure adopts the following technical solutions: The building power load forecasting method based on domain knowledge constraints includes: Obtain original building electricity load data; Adaptive K-nearest neighbor algorithm is used to find abnormal data in the original building power load data and remove the abnormal data; Construct domain knowledge physical constraints, construct a loss calculation function based on the domain knowledge physical constraints, optimize the parameters of the prediction integration model combining the periodic KAN network and the LSTM unit based on the loss calculation function, and obtain the optimized prediction integration model; The original building electricity load data after removing abnormal data is input into the optimized prediction integration model. First, a compound operation is performed through each function matrix in the KAN network, and the output after the compound operation is input into the LSTM unit to obtain effective time series features. Finally, the linear layer is used to predict the output, and the predicted output is pruned to finally obtain the building energy consumption forecast result for each hour of the next day.
[0008] According to some embodiments, the present disclosure adopts the following technical solutions: The building power load forecasting system based on domain knowledge constraints includes: A data acquisition module is used to obtain original building power load data; A data filtering module is used to find abnormal data in the original building power load data using an adaptive K-nearest neighbor algorithm and remove the abnormal data; Physical constraint loss calculation module, used to construct domain knowledge physical constraints and build loss calculation functions based on domain knowledge physical constraints; A model building module is used to optimize the parameters of the prediction integration model combining the periodic KAN network and the LSTM unit based on the loss calculation function to obtain the optimized prediction integration model; The prediction module is used to input the original building power load data after removing abnormal data into the optimized prediction integration model, first perform compound operations through each function matrix in the KAN network, input the output after the compound operation into the LSTM unit to obtain effective time series features, and finally use the linear layer to predict the output; The output pruning module is used to prune the forecast output and finally obtain the building energy consumption forecast result for each hour of the next day.
[0009] According to some embodiments, the present disclosure adopts the following technical solutions: A computer program product includes a computer program, which, when executed by a processor, implements the method for predicting building electricity load based on domain knowledge constraints.
[0010] According to some embodiments, the present disclosure adopts the following technical solutions: A non-transitory computer-readable storage medium is used to store computer instructions. When the computer instructions are executed by a processor, the method for predicting building power load based on domain knowledge constraints is implemented.
[0011] According to some embodiments, the present disclosure adopts the following technical solutions: An electronic device comprises: a processor, a memory and a computer program; wherein the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device is running, the processor executes the computer program stored in the memory so that the electronic device executes the method for predicting building power load based on domain knowledge constraints.
[0012] Compared with the prior art, the present invention has the following beneficial effects: The building electricity load prediction method based on domain knowledge constraints disclosed in the present invention constructs domain knowledge physical constraints, constructs a loss calculation function based on the domain knowledge physical constraints, and optimizes the parameters of the prediction integration model combining a periodic KAN network and an LSTM unit based on the loss calculation function. By embedding domain knowledge, the emergence of predicted values that are significantly different from the actual physical values is prevented, the rationality of the prediction results is improved, and it helps to improve the prediction accuracy.
[0013] The disclosed method for forecasting building electricity load based on domain knowledge constraints builds a forecasting integration model that combines a periodic KAN network and an LSTM unit. The proposed forecasting integration model has significant advantages in terms of time series dependency and processing complex data models. The forecasting integration model can reasonably utilize time series information and greatly reduce the setting of the number of parameters in the forecasting integration model, and can achieve better forecasting performance with low computing resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The accompanying drawings constituting a part of the present disclosure are used to provide a further understanding of the present disclosure. The illustrative embodiments of the present disclosure and their descriptions are used to explain the present disclosure and do not constitute an improper limitation on the present disclosure.
[0015] Figure 1 This is a process system architecture diagram of the building power load forecasting method based on domain knowledge constraints disclosed in the present invention. DETAILED DESCRIPTION
[0016] The present disclosure is further described below in conjunction with the accompanying drawings and embodiments.
[0017] It should be noted that the following detailed descriptions are all illustrative and are intended to provide further explanation of the present disclosure. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present disclosure belongs.
[0018] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present disclosure. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0019] Example 1 In one embodiment of the present disclosure, a method for predicting building power load based on domain knowledge constraints is provided, comprising: Obtain original building electricity load data; Adaptive K-nearest neighbor algorithm is used to find abnormal data in the original building power load data and remove the abnormal data; Construct domain knowledge physical constraints, construct a loss calculation function based on the domain knowledge physical constraints, optimize the parameters of the prediction integration model combining the periodic KAN network and the LSTM unit based on the loss calculation function, and obtain the optimized prediction integration model; The original building electricity load data after removing abnormal data is input into the optimized prediction integration model. First, a compound operation is performed through each function matrix in the KAN network, and the output after the compound operation is input into the LSTM unit to obtain effective time series features. Finally, the linear layer is used to predict the output, and the predicted output is pruned to finally obtain the building energy consumption forecast result for each hour of the next day.
[0020] As an embodiment, the present invention discloses a method for predicting building power load based on domain knowledge constraints. By embedding domain knowledge, it prevents the appearance of predicted values that are significantly different from actual physical values, improves the rationality of the prediction results, and helps to improve the prediction accuracy. The specific implementation process of the overall method is as follows: Step 1: Obtain the original building power load data, use the adaptive K nearest neighbor algorithm to find abnormal data in the original building power load data, and remove the abnormal data; Specifically, the original building electricity load data for one quarter is collected, and the data sampling frequency is 1 Hz.
[0021] Furthermore, the original building power load data is obtained, and the original power load data is filtered into different time periods according to the flag variable, and time tags are added to the original building power load data to form a time data sequence. Among them, the flag variable is a specific variable used to distinguish and filter the original building power load data into different time periods. Then the distance between any two data points in the time data sequence is calculated, and the abnormal data that deviates relatively far from the data cluster is filtered out. Specifically, the adaptive K nearest neighbor value algorithm of iterative query is used to search for abnormal M values, and the data greater than the abnormal threshold is used as the abnormal M value. The M value is output and the M abnormal data points are eliminated. The specific steps are as follows: (1) Let the time series of data points be , where N is the total number of days, , t For time.
[0022] Calculate any two data points in the sequence and Distance : (1) (2) Adopt the K nearest neighbor algorithm to iteratively query the adaptive K nearest neighbor value of the data set, and regard the data greater than the abnormal threshold as abnormal data. KNN ( ) is the data The number of K nearest neighbors of For data The number of reverse K nearest neighbors.
[0023] (3) Let the number of searches m = 1, and find The m-nearest neighbor value, record the reverse m-nearest neighbor value And the number of them whose value is 0 is M.
[0024] (4) Set the search times to m+1 and iterate again to find the value of M. When the value of M remains unchanged in three consecutive iterations, the iteration ends and the algorithm becomes stable. Output the value of M and remove the M abnormal data points.
[0025] Step 2: Construct domain knowledge physical constraints and build a loss calculation function based on domain knowledge physical constraints; Specifically, the daily data points are fitted to obtain the function expression of the building electricity load within a day, the sample mean and sample variance are calculated, the regional upper limit function and the regional lower limit function for limiting the sample value are calculated based on the sample mean and sample variance, and the loss calculation function is constructed based on the regional upper limit function and the regional lower limit function.
[0026] Among them, the domain knowledge physical constraints are used to provide a loss calculation function for subsequent model construction to prevent abnormal prediction values such as excessively high energy consumption at midnight and too low energy consumption at noon in the trained prediction model. Among them, the domain knowledge physical constraints are based on basic physical laws and common sense, considering that the surrounding environmental factors or human factors will have an impact on the building's power load. For example, under normal circumstances in the field of building load power consumption, power consumption will not be negative, noon energy consumption is generally the highest peak of the day, and midnight users suddenly reduce energy consumption. The lowest valley of the day; these domain knowledge physical constraint rules are derived from daily experience, and loss functions are constructed based on these physical laws. If the actual value deviates from these basic physical laws beyond the threshold, a loss function is added to the model to correct the predicted value. The specific steps to construct a loss calculation function are as follows: (1) Fit the daily data points to obtain the functional expression of the building electricity load within one day x ( t ), , calculate the sample mean , sample variance : (2) (3) (2) Calculate the region upper limit function that limits the sample value , the lower limit function of the region , respectively: (4) (5) (3) Calculate the loss function : (6) in, is the predicted value output by the model building module, is the true value, is the intensity of the penalty on the loss function, , is the region function that limits the sample values.
[0027] Step 3: Based on the loss calculation function, the parameters of the prediction integration model combining the periodic KAN network and the LSTM unit are optimized to obtain the optimized prediction integration model; First, the prediction integration model includes a KAN network and an LSTM unit. The prediction integration model is composed of a periodic KAN network and an LSTM unit. The original building power load data after removing abnormal data is input into the optimized prediction integration model. First, a composite operation is performed through each function matrix in the KAN network. After the load data after abnormal data cleaning is input into the KAN network, the KAN network processing process is as follows: (7) in, It is KAN The function matrix corresponding to the layer (B-spline function matrix), the operation symbol " " is a composite operation, that is, the input matrix Through each function matrix in turn The output of each layer becomes the input of the next layer.
[0028] For any function f A series of simple one-variable functions can be used to form a multi-segment function. The function is a simple B-spline function, which is the activation function between each neuron. i It means the l layer of neurons, j It is l +1 layer of neurons, l +1st floor j A neuron can be represented as: (8) The transformation of each layer is expressed by the following formula: When the l When the layer is used as input, the above transformation results in l +1 layer, l The +1 layer is used as the input of the next layer, so formula (7) is a nested composite operation. l Layer transition to l+ 1 The function matrix of the layer is expressed as: (9) Furthermore, the KAN network output is used as the input of the LSTM unit, and the gating mechanism of LSTM is used to manage the information flow, determine which information is forgotten in the previous state, control which new information is included, and output which useful information. Finally, the linear layer is used to generate the prediction output, thereby obtaining the final output of the prediction integration model, including: Activation function of forget gate It is expressed as: (10) in, is the sigmoid function, h t-1 is the cell output at the previous time step.
[0029] Activation function of input gate It is expressed as: (11) The cell updates its status: (12) in, c t is the updated cell state, Represents the exclusive OR operator.
[0030] (13) in, W i 、W c 、W f is the weight matrix, b f 、b i 、b c is the bias vector, is the candidate cell state.
[0031] Output gate activation function It is expressed as, (14) The cell output is represented as: (15) The final prediction value output is represented using a linear layer; (16) As an embodiment, the method of optimizing the parameters of the prediction integration model combining the periodic KAN network and the LSTM unit based on the loss calculation function is as follows: Call the calculation loss function , calculate the loss function to return the control parameters and then optimize the parameters of the prediction integration model, judge whether the prediction integration model obtained after optimization reaches the required accuracy, if the accuracy does not meet the requirements, iterate again, and when the accuracy reaches the requirements, obtain the final prediction integration model and output the model.
[0032] Among them, the parameter optimization process can use the stochastic gradient descent method, and the control parameter is the partial derivative of the loss function with respect to the parameters of the integrated model. The parameters that can be optimized by the integrated model are , call the partial derivative to find the optimal solution for the model parameters.
[0033] Step 4: Prune the forecast output to finally obtain the building energy consumption forecast results for each hour of the next day.
[0034] For the output prediction value, the pruning module is used to prune it to prevent abnormal predictions such as negative prediction values. Output value The pruning formula is restricted: (17) in, It is a linear rectifier function. When the input is positive or 0, it returns the original value. When the input is negative, it returns 0. To predict the output, This is the predicted result of the building energy consumption per hour on the final day after pruning.
[0035] Example 2 In one embodiment of the present disclosure, a building power load forecasting system based on domain knowledge constraints is provided, comprising: A data acquisition module is used to obtain original building power load data; A data filtering module is used to find abnormal data in the original building power load data using an adaptive K-nearest neighbor algorithm and remove the abnormal data; Physical constraint loss calculation module, used to construct domain knowledge physical constraints and build loss calculation functions based on domain knowledge physical constraints; A model building module is used to optimize the parameters of the prediction integration model combining the periodic KAN network and the LSTM unit based on the loss calculation function to obtain the optimized prediction integration model; The prediction module is used to input the original building power load data after removing abnormal data into the optimized prediction integration model, first perform compound operations through each function matrix in the KAN network, input the output after the compound operation into the LSTM unit to obtain effective time series features, and finally use the linear layer to predict the output; The output pruning module is used to prune the forecast output and finally obtain the building energy consumption forecast result for each hour of the next day.
[0036] Example 3 In one embodiment of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the method for predicting building power load based on domain knowledge constraints.
[0037] Example 4 In one embodiment of the present disclosure, a non-transitory computer-readable storage medium is provided, wherein the non-transitory computer-readable storage medium is used to store computer instructions. When the computer instructions are executed by a processor, the method for predicting building power load based on domain knowledge constraints is implemented.
[0038] Example 5 In one embodiment of the present disclosure, an electronic device is provided, including: a processor, a memory, and a computer program; wherein the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device is running, the processor executes the computer program stored in the memory, so that the electronic device executes the method for predicting building power load based on domain knowledge constraints.
[0039] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0040] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0041] Although the above describes the specific implementation methods of the present disclosure in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present disclosure. Technical personnel in the relevant field should understand that on the basis of the technical solution of the present disclosure, various modifications or variations that can be made by those skilled in the art without creative work are still within the scope of protection of the present disclosure.
Claims
1. A building power load forecasting method based on domain knowledge constraints, characterized in that: include: Obtain original building electricity load data; Adaptive K-nearest neighbor algorithm is used to find abnormal data in the original building power load data and remove the abnormal data; Construct domain knowledge physical constraints, construct a loss calculation function based on the domain knowledge physical constraints, optimize the parameters of the prediction integration model combining the periodic KAN network and the LSTM unit based on the loss calculation function, and obtain the optimized prediction integration model; The original building electricity load data after removing abnormal data is input into the optimized prediction integration model. First, a compound operation is performed through each function matrix in the KAN network, and the output after the compound operation is input into the LSTM unit to obtain effective time series features. Finally, the linear layer is used to predict the output, and the predicted output is pruned to finally obtain the building energy consumption forecast result for each hour of the next day.
2. The method for predicting building power load based on domain knowledge constraints according to claim 1 is characterized in that: The original building electricity load data is obtained, time tags are added to the original building electricity load data to form a time data series, the distance between any two data points in the time data series is calculated, and the adaptive K nearest neighbor value algorithm with iterative query is used to search for abnormal M values. Data greater than the abnormal threshold is regarded as abnormal M values, and the M values are output and the M abnormal data points are eliminated.
3. The method for predicting building power load based on domain knowledge constraints according to claim 1, characterized in that: Construct domain knowledge physical constraints, and construct a loss calculation function based on domain knowledge physical constraints, including: fitting daily data points to obtain a functional expression of building electricity load within a day, calculating the sample mean and sample variance, calculating the regional upper limit function and the regional lower limit function that limit the sample value based on the sample mean and sample variance, and constructing a loss calculation function based on the regional upper limit function and the regional lower limit function.
4. The method for predicting building power load based on domain knowledge constraints according to claim 1, characterized in that: The prediction integration model includes KAN network and LSTM unit. After constructing KAN network, the power load data after abnormal cleaning is input into KAN network, and then a composite operation is performed through each function matrix in KAN network, which is: in, It is the first The function matrix corresponding to the layer, is a compound operator, that is, the input matrix Through each function matrix in turn The output of each layer becomes the input of the next layer.
5. The method for predicting building power load based on domain knowledge constraints according to claim 1, characterized in that: The output of the KAN network is used as the input of the LSTM unit, and the gating mechanism of the LSTM unit is used to manage the information flow, obtain effective time series features, and finally use the linear layer to predict the output.
6. The method for predicting building power load based on domain knowledge constraints according to claim 1, characterized in that: For the output forecast value, the pruning formula is used to prune it to prevent abnormal load forecast values. The pruning formula for the output value is: in, It is a linear rectifier function. When the input is positive or 0, it returns the original value. When the input is negative, it returns 0. To predict the output, This is the predicted result of the building energy consumption per hour on the final day after pruning.
7. The building power load forecasting system based on domain knowledge constraints is characterized by: include: A data acquisition module is used to obtain original building power load data; A data filtering module is used to find abnormal data in the original building power load data using an adaptive K-nearest neighbor algorithm and remove the abnormal data; Physical constraint loss calculation module, used to construct domain knowledge physical constraints and build loss calculation functions based on domain knowledge physical constraints; A model building module is used to optimize the parameters of the prediction integration model combining the periodic KAN network and the LSTM unit based on the loss calculation function to obtain the optimized prediction integration model; The prediction module is used to input the original building power load data after removing abnormal data into the optimized prediction integration model, first perform compound operations through each function matrix in the KAN network, input the output after the compound operation into the LSTM unit to obtain effective time series features, and finally use the linear layer to predict the output; The output pruning module is used to prune the forecast output and finally obtain the building energy consumption forecast result for each hour of the next day.
8. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for predicting building electricity load based on domain knowledge constraints as described in any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium is used to store computer instructions. When the computer instructions are executed by the processor, the building power load forecasting method based on domain knowledge constraints as described in any one of claims 1-6 is implemented.
10. An electronic device, characterized in that: include: A processor, a memory and a computer program; wherein the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device is running, the processor executes the computer program stored in the memory to enable the electronic device to implement the building power load forecasting method based on domain knowledge constraints as described in any one of claims 1-6.
Citation Information
Patent Citations
Building power load multi-step prediction method and system based on deep learning
CN111080002A
New frame photovoltaic power prediction method and system, and computer readable storage medium
CN118586442A
Wireless network load prediction method, device, equipment, medium and program product
CN119402115A
Cited By
Cross-building energy consumption collaborative prediction method and device based on improved KAN network
CN120387597A