GANs-Based Building Energy Consumption Prediction Method and Device
Through the grouping and feature extraction methods, combined with GANs network and machine learning models, the problems of data imbalance and complex changes in building energy consumption prediction are solved, and higher prediction accuracy and stability are achieved.
Patent Information
- Application Number
- CN202510100924.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2045-01-22
AI Technical Summary
The existing building energy consumption prediction model based on GANs is difficult to accurately capture a few types of data characteristics and data change patterns when facing unbalanced data and complex dynamic energy consumption data, resulting in insufficient prediction accuracy and stability.
By grouping historical energy consumption data as normal and deviation energy consumption data, the Gaussian kernel function is used to divide probability density, a normal and deviation energy consumption prediction model based on GANs network is established, and a generator and MLP discriminator of LSTM, Transformer and attention mechanism are combined, deviation factors are determined based on environmental and operational data, and a machine learning model is used to build a deviation energy consumption prediction model.
It improves the accuracy and stability of building energy consumption prediction, and special modeling is carried out for different energy consumption situations, reducing the interference of complex data changes, reducing the risk of pattern collapse, and improving the reliability of the model.
Smart Images

Figure CN119939744B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field related to building energy consumption prediction. More specifically, the present invention relates to a method and device for building energy consumption prediction based on GANs. Background Art
[0002] With the increasing demand for building energy consumption management, accurate energy consumption prediction is of great significance for optimizing energy use and reducing costs. In the field of energy consumption prediction, many studies have been devoted to constructing efficient and accurate prediction models using deep learning techniques. As a powerful deep learning model, Generative Adversarial Networks (GANs) have shown great potential in many fields due to their unique advantages in data generation and feature learning. However, in the actually collected building energy consumption data, the number of data samples with different energy consumption patterns or levels may vary greatly. For example, normal energy consumption data may occupy most of the samples, while deviated energy consumption data samples are relatively few. This imbalance will cause the GANs model to bias towards the majority class (normal energy consumption data) during training, making it difficult for the generator to learn the features of the minority class (deviated energy consumption data). In the prediction stage, the prediction accuracy of the model for the minority class data is significantly reduced, and it is unable to accurately capture energy consumption anomalies, affecting the stable and accurate prediction of building energy consumption. In addition, building energy consumption is dynamically affected by various complex factors, such as seasonal changes, sudden weather changes, and adjustments of building operation strategies, resulting in large fluctuations and variations in energy consumption data. When the generator in the GANs model learns this highly variable data distribution, it is difficult to accurately capture the complex patterns of energy consumption data under different conditions. When the discriminator faces such changing data, it is also difficult to accurately judge the authenticity of the generated data, making it difficult for the adversarial training between the generator and the discriminator to reach an ideal balance state, thereby affecting the prediction performance of the model. Therefore, it is necessary to design a technical solution that can overcome the above defects. Summary of the Invention
[0003] An object of the present invention is to provide a method for building energy consumption prediction based on GANs, which can improve the stability and accuracy of building energy consumption prediction.
[0004] To achieve these objects and other advantages of the present invention, according to one aspect of the present invention, there is provided a method for building energy consumption prediction based on GANs, including: S1: obtaining historical energy consumption data of a target building and grouping it into normal energy consumption data and deviated energy consumption data; S2: based on the GANs network, establishing a normal energy consumption prediction model using the normal energy consumption data; S3: determining the deviation factors of the deviated energy consumption data; S4: establishing a deviated energy consumption prediction model using the deviated energy consumption data and the deviation factors; S5: predicting the future energy consumption of the target building using the normal energy consumption prediction model and the deviated energy consumption prediction model.
[0005] Further, in the step S1, the probability density of each historical energy consumption data value is calculated by using a Gaussian kernel function. The historical energy consumption data values with a probability density greater than a predetermined threshold are classified as the normal energy consumption data, and the historical energy consumption data values lower than the predetermined threshold are classified as the deviated energy consumption data.
[0006] Further, in the step S2, the GANs network includes a generator and a discriminator. The generator includes two LSTM layers, a Transformer encoder, and an output layer, and an attention mechanism is introduced. The output of the second LSTM is used as the input of the attention mechanism, and the discriminator is an MLP.
[0007] Further, in the step S3, the environmental data and the operation data of the target building corresponding to the time point of the deviated energy consumption data are obtained, the correlation between the deviated energy consumption data and the environmental data and the operation data is calculated, and the deviation factors of the deviated energy consumption data are determined according to the correlation result.
[0008] Further, in the step S4, according to the deviation factors corresponding to the deviated energy consumption data, the deviated energy consumption data are grouped, and a deviated energy consumption prediction model is constructed for each group of the deviated energy consumption data by using a machine learning model.
[0009] Further, the energy consumption data and deviation factors at the current time are obtained and input into the normal energy consumption prediction model or the deviated energy consumption prediction model to obtain the future energy consumption.
[0010] According to another aspect of the present invention, there is also provided a building energy consumption prediction device based on GANs, which is characterized by including a processor and a memory. The memory is used for storing program instructions, and the processor is used for calling the program instructions to execute the building energy consumption prediction method based on GANs.
[0011] According to still another aspect of the present invention, there is also provided a computer-readable storage medium, which is characterized in that the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the building energy consumption prediction method based on GANs is implemented.
[0012] The present invention has at least the following beneficial effects:
[0013] The present invention obtains the historical energy consumption data of a target building, groups it into normal energy consumption data and deviated energy consumption data, and based on the GANs network, uses the normal energy consumption data to establish a normal energy consumption prediction model, and uses the deviated energy consumption data and the deviation factors to establish a deviated energy consumption prediction model; the present invention can improve the prediction accuracy. For the problem of data imbalance, after grouping, different energy consumptions are modeled separately, avoiding the model ignoring the features of the minority class due to data bias; analyzing the deviated energy consumption data separately can more accurately capture special energy consumption situations, improve the overall prediction accuracy, reduce the interference of complex data changes on the model, make the training process more stable, reduce risks such as mode collapse, and make the model performance more reliable.
[0014] Other advantages, objectives, and features of the present invention will be partially reflected by the following description, and partially will be understood by those skilled in the art through the research and practice of the present invention. Brief Description of the Drawings
[0015] Figure 1 It is a flowchart of an embodiment of the present application. Detailed Embodiments
[0016] The following further describes the present invention in detail with reference to the drawings, so that those skilled in the art can implement it according to the description in the specification.
[0017] It should be understood that terms such as "having", "comprising", and "including" used in the embodiments of the present application do not exclude the existence or addition of one or more other elements or their combinations. All directional indications (such as up, down, left, right, front, back...) in the embodiments of the present application are only used to explain the relative position relationship and movement situation between components in a specific posture. If the specific posture changes, the directional indication will also change accordingly. When an element is referred to as being "fixed to" or "disposed on" another element, it can be directly on the other element or there may be a middle element at the same time. When an element is referred to as being "connected" to another element, it can be directly connected to the other element or indirectly connected to the other element through a middle element. The descriptions in the embodiments of the present application involving "first", "second", etc. are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include at least one of such features.
[0018] It should be noted that the technical solutions between the various embodiments of the present application can be combined with each other, but it must be based on the fact that those skilled in the art can implement it. When the combination of technical solutions conflicts or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the protection scope required by the present application.
[0019] As Figure 1 shown, an embodiment of the present application provides a building energy consumption prediction method based on GANs, including:
[0020] S1: Obtain the historical energy consumption data of the target building and group it into normal energy consumption data and deviated energy consumption data;
[0021] Exemplarily, the target building can be an office building, a hotel, a shopping mall, etc. The energy consumption data is mainly electricity data, and there can also be consumption data of energy sources such as gas, heat, and tap water. For example, it is recorded every 15 minutes or every hour to capture the dynamic changes of energy consumption. In this article, electricity data is taken as an example;
[0022] In order to determine the deviation factors in S3 later, environmental data and operation data of the target building are further collected. The environmental data includes environmental parameters such as temperature, humidity, wind speed, and sunshine duration. The collection frequency can be synchronized with the energy consumption data and can be obtained from the local meteorological department or website, usually updated hourly or daily. The temperature, humidity, and wind speed can also be obtained by setting temperature sensors, humidity sensors, and wind speed sensors near the target building; the operation data includes business hours, passenger flow, equipment operation status, etc. The business hours are generally fixed values. The passenger flow can be counted through the access control system or video surveillance, and the equipment operation status can be obtained from the equipment management system. The collection frequency of these data can be flexibly determined according to the actual situation. For example, the passenger flow can be counted hourly;
[0023] S2: Based on the GANs network, use the normal energy consumption data to establish a normal energy consumption prediction model;
[0024] S3: Determine the deviation factors of the deviated energy consumption data;
[0025] S4: Use the deviated energy consumption data and the deviation factors to establish a deviated energy consumption prediction model;
[0026] S5: Use the normal energy consumption prediction model and the deviated energy consumption prediction model to predict the future energy consumption of the target building.
[0027] In another embodiment, in S1, the probability density of each historical energy consumption data value is calculated using a Gaussian kernel function, and the historical energy consumption data values with a probability density greater than a predetermined threshold are classified as the normal energy consumption data, and the historical energy consumption data values lower than the predetermined threshold are classified as the deviated energy consumption data.
[0028] In this embodiment, the Gaussian kernel function is used to calculate the probability density, and then grouping is carried out. The actual distribution of energy consumption data often is not a simple normal distribution or other standard distribution types; the probability density estimation method does not depend on the prior assumption of the data distribution. Whether it is a unimodal, multimodal or skewed data distribution, the probability density can be estimated by means of kernel functions, etc. It can start from the data itself and learn the internal structure and distribution law of the data. Compared with some grouping methods based on simple statistics (such as mean, standard deviation), it can better reflect the true characteristics of the data because it considers the mutual relationship of the entire data set, rather than just local statistical features; the probability density p(x i ) The specific calculation method is shown in the following formula. For example, if a predetermined threshold is set to 0.01, this value is used to distinguish normal energy consumption data and deviated energy consumption data.
[0029]
[0030]
[0031]
[0032]
[0033]
[0034] Among them, in the above formula, p(x i ) is the probability density, n is the data volume, x i , x j are the energy consumption values at a time point, is the sample mean, μ is the population mean, estimated by , K(x) is the Gaussian kernel function, and σ is the standard deviation.
[0035] In another embodiment, in the S2, the GANs network includes a generator and a discriminator. The generator includes two LSTM layers, a Transformer encoder and an output layer, and an attention mechanism is introduced. The output of the second LSTM is used as the input of the attention mechanism. The discriminator is an MLP;
[0036] Specifically, the input of the first-layer LSTM is data from a time series window. This layer extracts features from the input time series, learns the temporal information of the time series, and outputs a hidden state. The parameters of the LSTM layer include the number of hidden units, activation functions (such as tanh), etc. These parameters can be adjusted according to the complexity of the data and the scale of the problem. The second-layer LSTM takes the output of the first-layer LSTM as input, further mines the deep information in the time series, and obtains the output. This layer can capture dependencies within a longer time range, helping the generator better understand the time dynamics of energy consumption data. The output of the second-layer LSTM is used as the input of the attention mechanism, which can help the generator pay more attention to important parts of the time series, such as parts that have a greater impact on energy consumption in different seasons or different time periods. The Transformer encoder takes the processing result of the attention mechanism as input and further encodes and transforms the features using its self-attention mechanism and feed-forward neural network. The final output layer converts the output of the Transformer encoder into predicted energy consumption data.
[0037] The discriminator uses an MLP (Multi-Layer Perceptron). The input is a time series data, which can be either real normal energy consumption data or fake data generated by the generator. The input data first passes through multiple fully connected layers. Each fully connected layer can use different activation functions (such as ReLU), and the number of neurons in the middle layer can be set differently according to needs to form a hierarchical structure for feature extraction. Finally, an output layer uses the Sigmoid function to limit the output to the range of 0 - 1, and the output represents the probability that the input data is real data.
[0038] After testing, the MSE of the prediction result of the GANs network without the attention mechanism is 0.085. After introducing the attention mechanism, the generator can focus more on the key time segments and features in the energy consumption data, making the prediction result closer to the real value, and the MSE is reduced to 0.062. Calculate the Pearson correlation coefficient between the predicted value and the real value. The correlation coefficient between the predicted value and the real value of the GANs without the attention mechanism is 0.82, while after introducing the attention mechanism, the correlation coefficient is increased to 0.90. This indicates that after introducing the attention mechanism, the linear correlation between the predicted value and the real value is stronger, and the model can better reflect the internal law of the real energy consumption data. During the training process, record the changes in the loss values of the generator and the discriminator. In the training process of the GANs without the attention mechanism, the loss value fluctuates greatly, indicating that the model training is not stable enough and is prone to problems such as mode collapse. After introducing the attention mechanism, the fluctuation of the loss value is significantly reduced, and the training process is more stable.
[0039] In another embodiment, in step S3, environmental data and operation data of the target building corresponding to the time point of the deviation energy consumption data are obtained, the correlation between the deviation energy consumption data and the environmental data and the operation data is calculated, and the deviation factors of the deviation energy consumption data are determined according to the correlation result;
[0040] The environmental data includes temperature, humidity, wind speed, sunshine duration, and sunshine intensity. Excessive or too low (determine the threshold according to the actual situation) will cause the energy consumption to deviate from normal. For example, temperature has a significant impact on building energy consumption. For example, the air-conditioning cooling energy consumption increases in summer high temperature, and the heating energy consumption increases in winter low temperature. Humidity affects indoor comfort and may indirectly affect the energy consumption of equipment such as ventilation and dehumidification. Wind speed affects the heat transfer of the building and thus affects the energy consumption. Sufficient sunshine may reduce the indoor lighting demand, but too high sunshine intensity may increase the air-conditioning cooling load;
[0041] The operation data includes business hours, passenger flow, equipment status, large-scale activities, etc. Excessive (determine the threshold according to the actual situation) will cause the energy consumption to deviate from normal. For example, extending business hours will increase the energy consumption of lighting, equipment operation, etc. An increase in passenger flow will increase the usage frequency of equipment such as elevators, lighting, and air conditioners, resulting in an increase in energy consumption. Whether the equipment is operating at full load or there are equipment failures, etc. Equipment failures may cause the energy consumption to rise abnormally. Large-scale activities such as promotional activities and exhibitions will increase the use of additional lighting and audio equipment, significantly increasing the energy consumption;
[0042] Standardize the environmental data and operation data, and then use the following formula for correlation value calculation;
[0043]
[0044] where n is the number of data, X is the deviation energy consumption data, and Y is the environmental data or operation data;
[0045] Set a preset threshold for the correlation coefficient according to the actual situation and experience. For example, 0.5. Compare the calculated correlation value with the threshold, and all environmental or operation data variables greater than the threshold are determined as the deviation factors of the deviation energy consumption data.
[0046] In another embodiment, in step S4, according to the deviation factors corresponding to the deviation energy consumption data, the deviation energy consumption data is grouped, and a deviation energy consumption prediction model is constructed for each group of the deviation energy consumption data by using a machine learning model;
[0047] In this step, a deviation energy consumption prediction model is constructed using a machine learning model. In actual production and life, the amount of deviation energy consumption data is small, while the machine learning model can effectively handle it. Compared with deep learning models such as LSTM (when the data is small, it cannot fully learn the characteristics of the data and is prone to overfitting), it has a simple structure, can extract general laws from limited data, reduce the risk of overfitting, and achieve accurate prediction;
[0048] Exemplarily, the deviation factors in Group 1: low temperature (less than the low temperature threshold);
[0049] At this time, a linear regression model is selected to construct the deviation energy consumption prediction model; in this scenario, the energy consumption of the office building mainly comes from the energy consumption of the heating system, and the relationship between each factor and the energy consumption is relatively simple and approximately linear, so it is more appropriate to choose a linear regression model;
[0050] The linear regression model determines the model parameters by minimizing the loss function. The commonly used loss function is the mean squared error (MSE); during the training process, the model will continuously adjust the parameters according to the training set data to find the best linear relationship between temperature and energy consumption.
[0051] The deviation factors in Group 2: high temperature (higher than the high temperature threshold), large number of passengers (more than the passenger flow threshold), large equipment load (more than the load rate threshold)
[0052] At this time, a random forest model is selected to construct the deviation energy consumption prediction model; in this scenario, high temperature causes a significant increase in the air conditioning cooling energy consumption, the increase in passenger flow increases the use of equipment, and the large equipment load. The interaction of multiple factors results in a complex non-linear relationship between energy consumption and each factor; as an ensemble learning method, the random forest model can effectively handle this complex non-linear relationship and has good anti-overfitting ability and generalization performance;
[0053] During specific training, the ambient temperature, passenger flow data, equipment load rate in the deviation factors and the corresponding energy consumption data are extracted to establish a data set. The number of decision trees is set to 100, the maximum depth of each decision tree is 10, and the number of randomly selected features for each node is the square root of the total number of features, and the deviation energy consumption prediction model is obtained through training;
[0054] The deviation factor in Group 3: large-scale activities
[0055] At this time, a support vector regression (SVR) model is selected to construct the deviation energy consumption prediction model; in this scenario, the relationship between energy consumption and the number of activity participants, activity duration, etc. is relatively complex and non-linear. Based on the principle of structural risk minimization, the SVR model can find the optimal hyperplane in the high-dimensional space and effectively fit this complex non-linear relationship, which is suitable for processing such data;
[0056] Extract the number of participants, activity duration, and corresponding energy consumption data in the deviation factors, establish a data set, select the Support Vector Regression (SVR) model, use the radial basis kernel function, with the penalty parameter C = 10 and the kernel function parameter gamma = 0.1; use the training set data to train the SVR model with the selected parameters to obtain the deviation energy consumption prediction model for this group.
[0057] In another embodiment, obtain the energy consumption data and deviation factors at the current time, input them into the normal energy consumption prediction model or the deviation energy consumption prediction model to obtain the future energy consumption;
[0058] Exemplarily, through the energy monitoring system, the energy consumption data at multiple time points in the current time period is obtained. It is known from the temperature sensor that the current temperature belongs to high temperature, the passenger flow is large from the operation management system, and the air conditioner load rate is high from the equipment management system. Then, the deviation energy consumption prediction model constructed by using the random forest in Group 2 is used for future energy consumption prediction. If it is known from the operation management system that a large-scale promotion activity is in progress, the deviation energy consumption prediction model constructed by using SVR in Group 3 is used for future energy consumption prediction. If there is no such situation in any of the above groups, the energy consumption data at multiple time points is input into the normal energy consumption prediction model to obtain the future energy consumption.
[0059] The embodiment of the present application also provides a building energy consumption prediction device based on GANs, including a processor and a memory. The memory is used to store program instructions, and the processor is used to call the program instructions to execute the building energy consumption prediction method based on GANs; the device in this embodiment can be a mobile phone, a laptop computer, a tablet computer, etc., with a memory and a processor inside to execute the fault prediction method in the above embodiment.
[0060] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the building energy consumption prediction method based on GANs; the device in this embodiment can be a mobile phone, a laptop computer, a tablet computer, etc., with a memory and a processor inside to execute the fault prediction method in the above embodiment.
[0061] Although the embodiments of the present invention have been disclosed as above, they are not limited to only the applications listed in the specification and the embodiments. It can be fully applied to various fields suitable for the present invention. For those familiar with the field, additional modifications can be easily made. Therefore, without departing from the general concept defined by the claims and the equivalent scope, the present invention is not limited to the specific details and the examples shown and described herein.
Claims
1. A building energy consumption prediction method based on GANs, characterized in that, Including: S1: Obtain the historical energy consumption data of the target building and group it into normal energy consumption data and deviated energy consumption data; S2: Based on the GANs network, establish a normal energy consumption prediction model using the normal energy consumption data; S3: Determine the deviation factors of the deviated energy consumption data; S4: Establish a deviated energy consumption prediction model using the deviated energy consumption data and the deviation factors; S5: Predict the future energy consumption of the target building using the normal energy consumption prediction model and the deviated energy consumption prediction model; In S1, calculate the probability density of each historical energy consumption data value using a Gaussian kernel function, divide the historical energy consumption data values with a probability density greater than a predetermined threshold into the normal energy consumption data, and divide the historical energy consumption data values lower than the predetermined threshold into the deviated energy consumption data.
2. The method for predicting building energy consumption based on GANs according to claim 1, wherein In S2, the GANs network includes a generator and a discriminator. The generator includes two LSTM layers, a Transformer encoder, and an output layer, and an attention mechanism is introduced. The output of the second LSTM is used as the input of the attention mechanism, and the discriminator is an MLP.
3. The building energy consumption prediction method based on GANs according to claim 1, characterized in that In S3, obtain the environmental data corresponding to the time point of the deviated energy consumption data and the operation data of the target building, calculate the correlation between the deviated energy consumption data and the environmental data and the operation data, and determine the deviation factors of the deviated energy consumption data according to the correlation results.
4. The method for predicting building energy consumption based on GANs according to claim 3, wherein In S4, group the deviated energy consumption data according to the deviation factors corresponding to the deviated energy consumption data, and use a machine learning model to construct the deviated energy consumption prediction model for each group of the deviated energy consumption data respectively.
5. The building energy consumption prediction method based on GANs according to claim 4, characterized in that, Obtain the energy consumption data and deviation factors at the current time, input them into the normal energy consumption prediction model or the deviated energy consumption prediction model, and obtain the future energy consumption.
6. A building energy consumption prediction device based on GANs, characterized in that, Including a processor and a memory. The memory is used to store program instructions, and the processor is used to call the program instructions to execute the GANs-based building energy consumption prediction method according to any one of claims 1-5.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the GANs-based building energy consumption prediction method according to any one of claims 1-5.
Citation Information
Patent Citations
Building energy consumption prediction method and device, terminal equipment and storage medium
CN119026759A
Building energy consumption data generation and parallel prediction method and device based on generative adversarial network and medium
CN119272819A