Building energy consumption prediction method and device based on GANs
By grouping building energy consumption data and establishing separate prediction models, the prediction performance problem of GANs models in unbalanced data and complex energy consumption data processing is solved, and more stable and accurate building energy consumption prediction is achieved.
Patent Information
- Application Number
- CN202510100924.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-05-06
- 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 when processing unbalanced data, and when facing complex and variable energy consumption data, it is difficult to achieve an ideal equilibrium state, affecting the prediction performance.
By obtaining the historical energy consumption data of the target building and grouping it into normal energy consumption data and deviation energy consumption data, a normal energy consumption prediction model and deviation energy consumption prediction model based on GANs are established, and a Gaussian kernel function is used to group data, and an attention mechanism is introduced to improve the prediction ability of the model.
Improve the stability and accuracy of building energy consumption prediction. By modeling separately for different energy consumption types, data bias problems are avoided, special energy consumption situations are accurately captured, complex data changes are reduced, and the interference of complex data changes on the model is reduced, and the risks such as pattern collapse are reduced, making the model performance more reliable.
Smart Images

Figure CN119939744A_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 predicting building energy consumption based on GANs. Background Art
[0002] With the growing demand for building energy consumption management, accurate energy consumption forecasting is of great significance for optimizing energy use and reducing costs. In the field of energy consumption forecasting, many studies are devoted to using deep learning technology to build efficient and accurate prediction models. Generative adversarial networks (GANs), as a powerful deep learning model, have shown great potential in many fields due to their unique advantages in data generation and feature learning. However, in the actual collected building energy consumption data, the number of data samples of different energy consumption modes or energy consumption levels may vary greatly. For example, normal energy consumption data may occupy most of the samples, while the samples of deviated energy consumption data are relatively few. This imbalance will cause the GANs model to be biased towards the majority class (normal energy consumption data) during training, making it difficult for the generator to learn the features of the minority class (deviant energy consumption data). In the prediction stage, the model's prediction accuracy for minority class data is greatly 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 a variety of complex factors, such as seasonal changes, sudden weather changes, and adjustments to building operation strategies, which lead to large volatility and variability in energy consumption data. When learning such a large-scale data distribution, the generator in the GANs model finds it difficult to accurately capture the complex patterns of energy consumption data under different conditions. When faced with such variable data, the discriminator also finds it difficult to accurately judge the authenticity of the generated data, making it difficult for the adversarial training between the generator and the discriminator to achieve an ideal balance, which in turn affects 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 building energy consumption prediction method based on GANs, which can improve the stability and accuracy of building energy consumption prediction.
[0004] In order to achieve these purposes and other advantages of the present invention, according to one aspect of the present invention, the present invention provides a building energy consumption prediction method 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 a GANs network, establishing a normal energy consumption prediction model using the normal energy consumption data; S3: determining the deviation factor of the deviated energy consumption data; S4: establishing a deviated energy consumption prediction model using the deviated energy consumption data and the deviation factor; 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] Furthermore, 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 below the predetermined threshold are classified as the deviation energy consumption data.
[0006] Furthermore, 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 layer LSTM is used as the input of the attention mechanism, and the discriminator is MLP.
[0007] Furthermore, in S3, environmental data and operating data of the target building at a time point corresponding to the deviated energy consumption data are obtained, the correlation between the deviated energy consumption data and the environmental data and the operating data is calculated, and the deviation factor of the deviated energy consumption data is determined according to the correlation result.
[0008] Furthermore, in S4, the deviation energy consumption data are grouped according to the deviation factors corresponding to the deviation energy consumption data, and the deviation energy consumption prediction model is constructed for each group of the deviation energy consumption data using a machine learning model.
[0009] Furthermore, energy consumption data and deviation factors at the current time are obtained, and input into the normal energy consumption prediction model or the deviation energy consumption prediction model to obtain the future energy consumption.
[0010] According to another aspect of the present invention, a GANs-based building energy consumption prediction device is also provided, which is characterized in that it includes 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.
[0011] According to another aspect of the present invention, a computer-readable storage medium is also provided, characterized in that the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the GANs-based building energy consumption prediction method is implemented.
[0012] The present invention has at least the following beneficial effects: The present invention obtains historical energy consumption data of a target building and groups the data into normal energy consumption data and deviation energy consumption data. Based on a GANs network, a normal energy consumption prediction model is established using the normal energy consumption data, and a deviation energy consumption prediction model is established using the deviation energy consumption data and the deviation factors. The present invention can improve prediction accuracy. To address the problem of data imbalance, different energy consumptions are modeled separately after grouping, thereby avoiding the model from ignoring minority class features due to data bias. Separate analysis of the deviation energy consumption data can more accurately capture special energy consumption situations, improve overall prediction accuracy, reduce interference of complex data changes on the model, make the training process smoother, reduce risks such as model collapse, and make the model performance more reliable.
[0013] Other advantages, objectives and features of the present invention will be embodied in part through the following description, and in part will be understood by those skilled in the art through study and practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 This is a flow chart of an embodiment of the present application. DETAILED DESCRIPTION
[0015] The present invention is further described in detail below in conjunction with the accompanying drawings so that those skilled in the art can implement the invention with reference to the description.
[0016] It should be understood that the terms such as "having", "including" and "comprising" 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, movement, etc. between the components in a certain specific posture. If the specific posture changes, the directional indication will also change accordingly. When an element is referred to as "fixed on" or "set on" another element, it can be directly on the other element or there may be a centering element at the same time. When an element is referred to as "connecting" another element, it can be directly connected to another element or it can be indirectly connected to another element through a centering element. The description of "first", "second", etc. in the embodiments of the present application is only for descriptive purposes, and cannot be understood as indicating or implying its relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" can explicitly or implicitly include at least one of the features.
[0017] 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 ordinary technicians in the field can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0018] like Figure 1 As shown, the embodiment of the present application provides a building energy consumption prediction method based on GANs, including: S1: Obtain historical energy consumption data of the target building and group it into normal energy consumption data and deviation energy consumption data; For example, the target building can be an office building, hotel, shopping mall, etc. The energy consumption data is mainly electricity data, and there can also be consumption data of gas, heat, tap water and other energy sources, such as recording every 15 minutes or every hour to capture the dynamic changes of energy consumption. This article takes electricity data as an example; In order to determine the deviation factors in the subsequent S3, environmental data and operation data of the target building are further collected. Environmental data include environmental parameters such as temperature, humidity, wind speed, and sunshine duration. The collection frequency can be synchronized with energy consumption data and can be obtained from the local meteorological department or website. It is usually updated in hours or days. The temperature, humidity, and wind speed can also be obtained by setting temperature sensors, humidity sensors, and wind speed sensors near the target building. Operation data include business hours, passenger flow, equipment operation status, etc. Business hours are generally fixed values. 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 actual conditions. For example, passenger flow can be counted by hour. S2: Based on the GANs network, a normal energy consumption prediction model is established using the normal energy consumption data; S3: Determine the deviation factor of the deviation energy consumption data; S4: establishing a deviation energy consumption prediction model using the deviation 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 deviation energy consumption prediction model.
[0019] 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 below the predetermined threshold are classified as the deviation energy consumption data.
[0020] This embodiment uses Gaussian kernel function to calculate probability density and then perform grouping. The actual energy consumption data distribution is often not a simple normal distribution or other standard distribution types. The probability density estimation method does not rely on the prior assumption of data distribution. Whether it is a unimodal, multimodal or skewed data distribution, its probability density can be estimated by kernel function and other methods. It can learn the intrinsic structure and distribution law of the data from the data itself. Compared with some grouping methods based on simple statistics (such as mean, standard deviation), it can better reflect the real characteristics of the data because it considers the relationship between the entire data set, not just the local statistical characteristics. The probability density p(x i ) is calculated by referring to the following formula. For example, the predetermined threshold is set to 0.01, and this value is used to distinguish between normal energy consumption data and deviated energy consumption data.
[0021] Among them, p(x i ) is the probability density, n is the amount of data, x i 、x j is the energy consumption value at a time point, is the sample mean, μ is the population mean, and It is estimated that K(x) is the Gaussian kernel function and σ is the standard deviation.
[0022] In another embodiment, 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 layer LSTM is used as the input of the attention mechanism, and the discriminator is an MLP; Specifically, the input of the first layer LSTM is the data of a time series window. This layer will extract features from the input time series and output a hidden state by learning the temporal information of the time series. The parameters of the LSTM layer include the number of hidden units, activation function (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 to further mine the deep information in the time series and obtain the output. This layer can capture dependencies over a longer time range and help the generator better understand the temporal dynamics of energy consumption data. The output of the second layer LSTM is used as the input of the attention mechanism. The attention mechanism can help the generator pay more attention to the important parts of the time series, such as the parts that have a greater impact on energy consumption in different seasons or different time periods. The Transformer encoder takes the processing results of the attention mechanism as input, and uses its self-attention mechanism and feedforward neural network to further encode and transform the features. The final output layer converts the output of the Transformer encoder into predicted energy consumption data. The discriminator uses MLP (multi-layer perceptron), and the input is a time series data, which can be 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 middle layer can set different numbers of neurons as needed to form a hierarchical structure to extract data features; 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; After testing, the MSE of the prediction results of the GANs network without the introduction of the attention mechanism is 0.085. After the introduction of the attention mechanism, the generator can focus more on the key time segments and features in the energy consumption data, making the prediction results closer to the true value, and the MSE is reduced to 0.062; the Pearson correlation coefficient between the predicted value and the true value is calculated. The correlation coefficient between the predicted value and the true value of the GANs without the introduction of the attention mechanism is 0.82, and after the introduction of the attention mechanism, the correlation coefficient is increased to 0.90, which shows that after the introduction of the attention mechanism, the linear correlation between the predicted value and the true value is stronger, and the model can better reflect the internal laws of the real energy consumption data; during the training process, the loss value changes of the generator and the discriminator are recorded. During the training process of the GANs without the introduction of 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 the introduction of the attention mechanism, the fluctuation of the loss value is significantly reduced, and the training process is more stable.
[0023] In another embodiment, in S3, environmental data and operation data of the target building at a time point corresponding to the deviated energy consumption data are obtained, correlation between the deviated energy consumption data and the environmental data and the operation data is calculated, and a deviation factor of the deviated energy consumption data is determined according to the correlation result; Environmental data include temperature, humidity, wind speed, sunshine duration, and sunshine intensity. If the data is too high or too low (the threshold is determined according to the actual situation), it will cause energy consumption to deviate from normal. For example, temperature has a significant impact on building energy consumption. For example, air conditioning and cooling energy consumption increases in high temperatures in summer, and heating energy consumption increases in low temperatures in winter. Humidity affects indoor comfort and may indirectly affect the energy consumption of ventilation, dehumidification and other equipment. Wind speed affects the heat transfer of the building, thereby affecting energy consumption. Sufficient sunshine may reduce indoor lighting needs, but excessive sunshine intensity may increase air conditioning and cooling loads. Operational data includes business hours, passenger flow, equipment status, large-scale events, etc. Excessive data (thresholds are determined based on actual conditions) will cause energy consumption to deviate from normal. For example, extending business hours will increase energy consumption for lighting and equipment operation. Increased passenger flow will increase the frequency of use of equipment such as elevators, lighting, and air conditioning, leading to increased energy consumption. Whether the equipment is operating at full capacity, whether there are equipment failures, etc. Equipment failures may cause abnormally high energy consumption. Large-scale events such as promotional activities and exhibitions will increase the use of additional lighting and audio equipment, greatly increasing energy consumption. Standardize the environmental data and operational data, and then use the following formula to calculate the correlation numerically; Where n is the number of data, X is the deviation energy consumption data, and Y is the environmental data or operation data; A preset threshold value of the correlation coefficient is set according to actual conditions and experience, for example, 0.5, and the calculated correlation value is compared with the threshold value. All environmental or operational data variables greater than the threshold value are determined as deviation factors that deviate from the energy consumption data.
[0024] In another embodiment, in S4, the deviation energy consumption data is grouped according to the deviation factors corresponding to the deviation energy consumption data, and the deviation energy consumption prediction model is constructed for each group of the deviation energy consumption data using a machine learning model; This step uses a machine learning model to build a deviation energy consumption prediction model. In actual production and life, the amount of deviation energy consumption data is small, and the machine learning model can effectively deal with it. Compared with deep learning models such as LSTM (which have little data and cannot fully learn the characteristics of the data, and are prone to overfitting), the structure is simple, and it can extract general rules from limited data, reduce the risk of overfitting, and achieve accurate prediction; Exemplarily, group one deviation factors: low temperature (less than a low temperature threshold); At this time, the linear regression model is used 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. The relationship between each factor and energy consumption is relatively simple and approximately linear, so the linear regression model is more appropriate; The linear regression model determines the model parameters by minimizing the loss function. The commonly used loss function is the mean square error (MSE). During the training process, the model will continuously adjust the parameters based on the training set data to find the optimal linear relationship between temperature and energy consumption.
[0025] Deviation factors for group 2: high temperature (higher than the high temperature threshold), large number of passengers (greater than the passenger flow threshold), large equipment load (greater than the load rate threshold) At this time, the random forest model is used to build a deviation energy consumption prediction model; in this scenario, high temperature causes a significant increase in air conditioning and refrigeration energy consumption, passenger flow increases the use of equipment, equipment load is large, and multiple factors interact with each other, resulting in a complex nonlinear relationship between energy consumption and various factors; the random forest model, as an integrated learning method, can effectively handle this complex nonlinear relationship and has good anti-overfitting ability and generalization performance; During the specific training, the ambient temperature, passenger flow data, equipment load rate and corresponding energy consumption data of the deviation factors 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 features randomly selected at each node is the square root of the total number of features. The deviation energy consumption prediction model is obtained through training. Group 3 Deviation Factor: Large Events At this time, the support vector regression (SVR) model is used to build a deviation energy consumption prediction model; in this scenario, the relationship between energy consumption and the number of people participating in the activity, the duration of the activity, etc. is relatively complex and nonlinear. The SVR model is based on the principle of structural risk minimization and can find the optimal hyperplane in high-dimensional space to effectively fit this complex nonlinear relationship, which is suitable for processing such data; The number of active people, activity duration and corresponding energy consumption data in the deviation factors were extracted to establish a data set. The support vector regression (SVR) model was selected, and the radial basis kernel function was used with penalty parameter C=10 and kernel function parameter gamma=0.1. The SVR model with the selected parameters was trained using the training set data to obtain the deviation energy consumption prediction model for this group.
[0026] In another embodiment, energy consumption data and deviation factors at the current time are obtained, and input into the normal energy consumption prediction model or the deviation energy consumption prediction model to obtain the future energy consumption; Exemplarily, through the energy monitoring system, the energy consumption data of multiple time points in the current time period are obtained, the current temperature is known from the temperature sensor that it is high, the number of passengers is large from the operation management system, and the air-conditioning load rate is high from the equipment management system. Then, the deviation energy consumption prediction model constructed by random forest in grouping two is used to predict future energy consumption. If it is known from the operation management system that the passenger flow is undergoing a large-scale promotion, the deviation energy consumption prediction model constructed by SVR in grouping three is used to predict future energy consumption. If there is no any of the above grouping situations, the energy consumption data of multiple time points are input into the normal energy consumption prediction model to obtain the future energy consumption.
[0027] An embodiment of the present application also provides a GANs-based building energy consumption prediction device, including a processor and a memory, wherein 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; the device of this embodiment can be a mobile phone, a laptop computer, a tablet computer, etc., which has a memory and a processor arranged therein to execute the fault prediction method of the above-mentioned embodiment.
[0028] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the GANs-based building energy consumption prediction method; the device of this embodiment can be a mobile phone, a laptop computer, a tablet computer, etc., which has a memory and a processor inside to execute the fault prediction method of the above embodiment.
[0029] Although the embodiments of the present invention have been disclosed as above, they are not limited to the applications listed in the specification and the implementation modes, and they can be fully applied to various fields suitable for the present invention. For those familiar with the art, additional modifications can be easily implemented. Therefore, without departing from the general concept defined by the claims and the scope of equivalents, the present invention is not limited to the specific details and the illustrations shown and described herein.
Claims
1. A GANs-based building energy consumption prediction method, characterized in that: include: S1: Obtain historical energy consumption data of the target building and group it into normal energy consumption data and deviation energy consumption data; S2: Based on the GANs network, a normal energy consumption prediction model is established using the normal energy consumption data; S3: Determine the deviation factor of the deviation energy consumption data; S4: establishing a deviation energy consumption prediction model using the deviation 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 deviation energy consumption prediction model.
2. The GANs-based building energy consumption prediction method according to claim 1, characterized in that: 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 below the predetermined threshold are classified as the deviation energy consumption data.
3. The GANs-based building energy consumption prediction method according to claim 1, characterized in that: 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 layer LSTM is used as the input of the attention mechanism. The discriminator is MLP.
4. The GANs-based building energy consumption prediction method according to claim 1, characterized in that: In S3, the environmental data and the operating data of the target building at the time point corresponding to the deviated energy consumption data are obtained, the correlation between the deviated energy consumption data and the environmental data and the operating data is calculated, and the deviation factor of the deviated energy consumption data is determined according to the correlation result.
5. The GANs-based building energy consumption prediction method according to claim 4, characterized in that: In S4, the deviation energy consumption data are grouped according to the deviation factors corresponding to the deviation energy consumption data, and the deviation energy consumption prediction model is constructed for each group of the deviation energy consumption data using a machine learning model.
6. The GANs-based building energy consumption prediction method according to claim 5, characterized in that: The energy consumption data and deviation factors at the current time are obtained, and the normal energy consumption prediction model or the deviation energy consumption prediction model is input to obtain the future energy consumption.
7. A building energy consumption prediction device based on GANs, characterized in that: It includes a processor and a memory, wherein 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 described in any one of claims 1-6.
8. 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, the GANs-based building energy consumption prediction method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Building energy consumption prediction method based on WGAN algorithm and monitoring and prediction system
CN111178626A
Building energy consumption prediction method and system
CN117454168A
Building energy consumption rapid prediction method
CN118114816A
Building energy consumption prediction method based on machine learning, product, equipment and medium
CN119005631A
Building energy consumption prediction method and device, terminal equipment and storage medium
CN119026759A