Indoor thermal comfort prediction method based on BP neural network optimized by improved particle swarm optimization
By improving the particle swarm algorithm to optimize the BP neural network, the computational complexity and overfitting problems of the traditional method are solved, and accurate prediction of indoor thermal comfort and intelligent control of the air-conditioning system are achieved, achieving energy-saving effects.
Patent Information
- Application Number
- CN202510783142.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-12
- Publication Date
- 2025-09-26
Smart Images

Figure CN120705501A_ABST
Abstract
Description
Technical field
[0001] The present invention relates to the field of indoor thermal comfort prediction, and in particular to an indoor thermal comfort prediction method based on an improved particle swarm algorithm to optimize a BP neural network. [Background Technology]
[0002] In modern society, indoor environmental comfort is of great importance, especially in daily life and workplaces such as offices, residences, and commercial spaces. The comfort of the indoor environment directly affects individual health, quality of life, and work efficiency, and thermal comfort, as a key aspect, has attracted considerable attention.
[0003] Establishing a thermal comfort control system for the indoor thermal environment based on indoor thermal comfort evaluation indices is particularly important. Traditional prediction methods are dominated by the Predicted Mean Vote (PMV) model proposed by Professor Fanger. This model calculates thermal sensation indices using six parameters: air temperature, mean radiant temperature, relative humidity, air velocity, clothing thermal resistance, and metabolic rate. However, the PMV calculation formula is a nonlinear function that requires repeated iterations. This complex process makes it impossible for air conditioning systems to control the PMV value in real time.
[0004] To overcome these limitations, artificial intelligence technology has been gradually introduced into the field of thermal comfort prediction. BP neural networks, with their nonlinear mapping capabilities, demonstrate advantages in processing multi-parameter coupling relationships. However, traditional implementations face two major technical obstacles: the initial weight randomization trap and the risk of overfitting. As a representative of swarm intelligence optimization algorithms, the standard particle swarm algorithm (PSO) optimizes the initial weights and thresholds of BP neural networks and reduces the risk of overfitting by collaboratively searching for the optimal solution between particles. However, it also has its own flaws in certain scenarios. First, there is the problem of premature convergence. Fixed inertia weights lead to insufficient global exploration in the early stages of the algorithm and excessive local development in the later stages, resulting in premature convergence. Second, there is a bottleneck in search accuracy. The linear decrease strategy of the learning factor in the speed update formula cannot balance exploration and development. In the weight optimization scenario, there is still an oscillation error of ±5% near the optimal solution.
[0005] Therefore, there is an urgent need to develop a new prediction method that integrates improved optimization algorithms with deep learning networks. This method, through dynamic optimization mechanisms, can overcome the bottlenecks of traditional technologies and achieve accurate, real-time, and dynamic prediction of indoor thermal comfort, thus providing support for intelligent building environmental control systems. The improved particle swarm optimization method for optimizing BP neural networks proposed in this paper is a solution to this technical problem. [Summary of the invention]
[0006] The purpose of this invention is to provide an indoor thermal comfort prediction method based on an improved particle swarm algorithm to optimize the BP neural network, aiming to solve the problems existing in traditional thermal comfort prediction methods, provide a more accurate indoor thermal comfort prediction scheme, and facilitate intelligent control and energy saving of air conditioners.
[0007] To achieve the above objectives, the present invention provides a method for predicting indoor thermal comfort based on an improved particle swarm optimization algorithm and a BP neural network. The specific steps are as follows:
[0008] Step 1: Generate input data and calculate data samples using the PMV formula;
[0009] Step 2: Build a BP neural network based on the input variables in step 1, determine the number of neural network layers, and the number of indicators in the input layer, hidden layer, and output layer;
[0010] Step 3: Use the improved particle swarm algorithm to optimize the BP neural network by iteratively searching for the optimal weight threshold combination by simulating group behavior;
[0011] Step 4: Train the BP neural network model based on the optimal weights and thresholds, and evaluate the training results.
[0012] Preferably, the specific steps of step 1 are as follows:
[0013] Step 1.1: Generate input data that complies with ASHRAE Standard 55 and use the PMV calculation formula to calculate the output. A total of 100,000 data samples were generated. Each sample included six input values (air dry-bulb temperature tdb, mean radiant temperature tr, wind speed vr, air humidity rh, metabolic rate met, clothing thermal resistance clo) and one output value (PMV value).
[0014] Step 1.2: Eliminate invalid samples, that is, data samples that do not conform to reality;
[0015] Step 1.3: Weight each type of data and extract 5,000 groups of data that are more in line with the actual situation as sample data;
[0016] Step 1.4: Standardize the selected data.
[0017] Preferably, the dataset obtained in step 1 is divided into a training set, a validation set, and a test set in a ratio of 7:2:1.
[0018] Preferably, the specific steps of step 2 are as follows:
[0019] Step 2.1: The structure of the BP neural network consists of three layers: input layer, hidden layer, and output layer. The number of neurons in the input layer is the same as the number of inputs, denoted by m. The number of neurons in the output layer corresponds to the number of outputs, denoted by n.
[0020] Step 2.2: Determine the number of hidden layers to be 2, and the number of neurons in the hidden layer is denoted as h, which is determined by the following formula:
[0021]
[0022] Where b is the adjustment constant, and the common value range is 1 to 10.
[0023] Preferably, the specific steps of step 3 are as follows:
[0024] Step 3.1: Initialize the particle swarm;
[0025] Step 3.2: Calculate its fitness value and update the global optimal solution and individual optimal solution;
[0026] Step 3.3: Use speed clipping to limit the speed to prevent excessive speed from affecting the training effect;
[0027] Step 3.4: Dynamically adjust the algorithm parameters to adjust the particle inertia weight, individual learning factor, and social learning factor;
[0028] Step 3.5: Update the particle velocity and position, and retain some historical velocities to balance global exploration and local development capabilities, and avoid the optimization process falling into local optimality;
[0029] Step 3.6: Repeat steps 3.2 to 3.5 and stop iterating after reaching the maximum number of iterations.
[0030] Step 3.7: Output the global optimal parameters of the particle swarm and decode the initial weights and thresholds assigned to the BP neural network. Preferably, the specific steps of dynamically adjusting the algorithm parameters in step 3.4 are as follows:
[0031] Step 3.4.1: Dynamically adjust the inertia weight of the particle swarm algorithm, which is determined by the following formula:
[0032]
[0033] Where w is the inertia weight, w initial is the initial inertia weight, w final is the final inertia weight, t is the current iteration number, and T is the maximum iteration number;
[0034] Step 3.4.2: Dynamically adjust the cognitive coefficient and social coefficient, determined by the following formula:
[0035]
[0036] Where c1 is the individual learning factor, c 1,initial is the initial individual learning factor, c 1,final is the final individual learning factor, c2 is the social learning factor, and c 2,initial is the initial social learning factor, c 2,final is the ultimate social learning factor.
[0037] Preferably, the specific steps of step 3.5 are as follows:
[0038] Step 3.5.1: Update the particle velocity and position using the following formula:
[0039]
[0040] in is the velocity of particle i in the tth iteration, is the position of particle i at the tth iteration, r1, r2 are random numbers in the interval [0,1], p best,i is the historical optimal position of particle i, g best is the global optimal position of the entire population.
[0041] Step 3.5.2: Retain some historical velocity information to avoid sudden changes in particle motion patterns caused by completely resetting the velocity. This is determined according to the following formula:
[0042]
[0043] Where a is the particle velocity retention ratio and σ is the noise intensity.
[0044] Preferably, in step 4, the weights and thresholds obtained by training the improved PSO algorithm are assigned to the BP neural network for model training of the BP neural network.
[0045] The prediction model effect is evaluated using the mean absolute error (MAE), mean square error (RMSE) and coefficient of determination (R). 2 The calculation formula is as follows:
[0046]
[0047] where y i is the actual observed value, is the predicted value, is the actual observed mean, and n is the number of samples.
[0048] Compared with the prior art, the present invention has the following beneficial effects:
[0049] 1. The present invention automatically adjusts the particle swarm inertia weight, individual learning factor, and social learning factor according to the number of iterations, and retains some particle velocities. Compared with the original PSO algorithm, the improved PSO algorithm can help the BP neural network find better weights and thresholds, making the BP neural network training effect better.
[0050] 2. This invention constructs a neural network indoor thermal comfort prediction model. Based on input data, a PMV index is derived, which is then used to determine a person's thermal comfort. This model can be used in air conditioning control systems to facilitate indoor thermal comfort control, achieving a comfortable indoor environment while also saving energy.
Brief Description of the Drawings
[0051] Figure 1 It is a flow chart of the overall solution of the present invention;
[0052] Figure 2 The present invention provides an algorithm flow chart for optimizing the weight threshold of BP neural network based on improved particle swarm optimization algorithm;
[0053] Figure 3 This is a diagram of the BP neural network structure used in the present invention;
[0054] Figure 4 This is a comparison chart of the prediction effect of the model of the present invention and that of other models.
Specific implementation method
[0055] In order to describe the technical solution of the present invention more clearly and completely, the present invention is further described in detail below through specific embodiments in conjunction with the accompanying drawings.
[0056] See also Figures 1-4 , a method for indoor thermal comfort prediction based on improved particle swarm optimization and BP neural network, including the following steps:
[0057] Step 1: Generate input data and calculate data samples using the PMV formula;
[0058] Step 1.1: Generate input data that complies with ASHRAE Standard 55 and use the PMV calculation formula to calculate the output. A total of 100,000 data samples were generated. Each sample included six input values (air dry-bulb temperature tdb, mean radiant temperature tr, wind speed vr, air humidity rh, metabolic rate met, clothing thermal resistance clo) and one output value (PMV value).
[0059] Step 1.2: Eliminate invalid samples, including data whose PMV range is not within [-3, 3] and some data whose input data does not conform to the actual situation;
[0060] Step 1.3: Weight each type of data and extract 5,000 sets of data that are more in line with the actual situation as sample data. The purpose of weighting the data is to obtain more realistic training data. The temperature between 22 and 25°C accounts for 40% of the total, the humidity between 20 and 80% accounts for 80% of the total, the wind speed less than 0.3 m / s accounts for 40% of the total, the metabolic rate data in the range of [0.9, 1.1] accounts for 50% of the total, and the clothing thermal resistance data in the range of [0.5, 1.0] accounts for 80% of the total;
[0061] Step 1.4: Standardize the selected data. The specific standardization formula is as follows:
[0062]
[0063] where X N is the standardized result, X is the original input data, μ is the data eigenvalue, and σ is the data characteristic standard deviation.
[0064] The obtained dataset is then divided into training set, validation set and test set with a ratio of 7:2:1.
[0065] Step 2: Build a BP neural network based on the input variables in step 1, determine the number of neural network layers, and the number of indicators in the input layer, hidden layer, and output layer;
[0066] Step 2.1: The BP neural network structure consists of three layers: input layer, hidden layer, and output layer. The input layer has six data points: air dry-bulb temperature tdb, mean radiant temperature tr, wind speed vr, air humidity rh, metabolic rate met, and clothing thermal resistance clo. The output layer outputs one data point: PMV value. The activation function between the hidden layer and the output layer uses the ReLU function, and its calculation formula is:
[0067] f(x)=max(0,x)
[0068] Where x is the input data.
[0069] Step 2.2: Determine the number of hidden layers to be 2, and the number of neurons in the hidden layer is denoted as h, which is determined by the following formula:
[0070]
[0071] Where b is the adjustment constant, which usually ranges from 1 to 10, m is the number of neurons in the input layer, and n is the number of neurons in the hidden layer. The number of nodes in the hidden layer of the neural network is determined to be 13 through experiments.
[0072] Step 3: Use the improved particle swarm algorithm to optimize the BP neural network by iteratively searching for the optimal weight threshold combination by simulating group behavior;
[0073] Step 3.1: Initialize the particle swarm;
[0074] Step 3.2: Calculate its fitness value, calculate the predicted value of the validation set through forward propagation, use the mean square error (MSE) as the fitness value, and update the global optimal solution and individual optimal solution;
[0075] Step 3.3: Use speed clipping to limit the speed to [-0.3, 0.3] to prevent excessive speed from affecting the training effect; Step 3.4: Dynamically adjust the algorithm parameters to adjust the particle inertia weight, individual learning factor, and social learning factor;
[0076] Step 3.4.1: Dynamically adjust the inertia weight of the particle swarm algorithm, which is determined by the following formula:
[0077]
[0078] Where w is the inertia weight, w initial is the initial inertia weight, w final is the final inertia weight, t is the current iteration number, and T is the maximum iteration number;
[0079] Step 3.4.2: Dynamically adjust the cognitive coefficient and social coefficient, determined by the following formula:
[0080]
[0081] Where c1 is the individual learning factor, c 1,initial is the individual learning factor, c 1,final is the final individual learning factor, c2 is the social learning factor, and c 2,initial is the initial social learning factor, c 2,final is the ultimate social learning factor.
[0082] Step 3.5: Update the particle velocity and position, retain some historical velocities, balance global exploration and local development capabilities, and avoid the optimization process falling into local optimality;
[0083] Step 3.5.1: Update the particle velocity and position using the following formula:
[0084]
[0085] in is the velocity of particle i in the tth iteration, is the position of particle i at the tth iteration, r1 and r2 are random numbers in the interval [0,1], and p best,i is the historical optimal position of particle i, g best is the global optimal position of the entire population.
[0086] Step 3.5.2: Retain some historical velocity information to avoid sudden changes in particle motion patterns caused by completely resetting the velocity. This is determined according to the following formula:
[0087]
[0088] Where a is the particle velocity retention ratio and σ is the noise intensity.
[0089] After experiments, it was determined that a is 0.165 and σ is 0.01.
[0090] Step 3.6: Repeat steps 3.2 to 3.5 until the maximum number of iterations is reached and the iteration stops.
[0091] Step 3.7: Decode the particles under the global optimal solution and assign them to the initial weights and thresholds of the BP neural network.
[0092] Step 4: Train the BP neural network model based on the optimal weights and thresholds, and evaluate the training results;
[0093] The prediction model effect is evaluated using the mean absolute error (MAE), mean square error (RMSE) and coefficient of determination (R). 2 The characterization and evaluation results are shown in Table 1, and the calculation formula is as follows:
[0094]
[0095] where y i is the actual observed value, is the predicted value, is the actual observed mean, and n is the number of samples.
[0096] Table 1 Comparison of model effects
[0097] Model MAE RMSE <![CDATA[R 2 ]]> BP 0.04197 0.05757 0.99708 PSO-BP 0.03402 0.04696 0.99806 Improved PSO-BP (this method) 0.03048 0.04328 0.99835
[0098] It should be emphasized that the above embodiments only show part of the technical implementation path and are not used to limit this creation. Any modifications, equivalent replacements, and improvements made within the spirit and principles of this creation, and any technical achievements obtained without creative labor, are within the scope of protection of this patent.
Claims
1. A method for predicting indoor thermal comfort based on an improved particle swarm optimization BP neural network, characterized in that: The following steps are involved: Step 1: Generate input data and calculate data samples using the PMV formula; Step 2: Build a BP neural network based on the input variables in step 1, determine the number of neural network layers, and the number of indicators in the input layer, hidden layer, and output layer; Step 3: Use the improved particle swarm algorithm to optimize the BP neural network by iteratively searching for the optimal weight threshold combination by simulating group behavior; Step 4: Train the BP neural network model based on the optimal weights and thresholds, and evaluate the training results.
2. The indoor thermal comfort prediction method based on particle swarm optimization and BP neural network according to claim 1 is characterized in that: The specific steps of step 1 are as follows: Step 1.1: Generate input data that complies with ASHRAE Standard 55 and calculate the output using the PMV calculation formula; Step 1.2: Eliminate invalid samples; Step 1.3: Weight each type of data and extract the data that is more in line with the actual situation as sample data; Step 1.4: Standardize the selected data.
3. The indoor thermal comfort prediction method based on particle swarm optimization and BP neural network according to claim 1 is characterized in that: The obtained dataset is divided into training set, validation set and test set with a ratio of 7:2:
1.
4. The indoor thermal comfort prediction method based on particle swarm optimization and BP neural network according to claim 1 is characterized in that: The specific steps of step 2 are as follows: Step 2.1: The structure of the BP neural network consists of three layers: input layer, hidden layer, and output layer. The number of neurons in the input layer is the same as the number of inputs, denoted by m. The number of neurons in the output layer corresponds to the number of outputs, denoted by n. Step 2.2: Determine the number of hidden layers to be 2, and the number of neurons in the hidden layer is denoted as h, which is determined by the following formula: Where b is the adjustment constant, which usually ranges from 1 to 10.
5. The indoor thermal comfort prediction method based on particle swarm optimization and BP neural network according to claim 1 is characterized in that: The specific steps of step 3 are as follows: Step 3.1: Initialize the particle swarm; Step 3.2: Calculate its fitness value and update the global optimal solution and individual optimal solution; Step 3.3: Use speed clipping to limit the speed; Step 3.4: Dynamically adjust algorithm parameters; Step 3.5: Update particle velocity and position, retaining some historical velocity; Step 3.6: Repeat steps 3.2 to 3.5 and stop iterating after reaching the maximum number of iterations. Step 3.7: Output the global optimal parameters of the particle swarm and decode the initial weights and thresholds assigned to the BP neural network.
6. The indoor thermal comfort prediction method based on particle swarm optimization and BP neural network according to claim 5 is characterized in that: The specific steps of step 3.4 are as follows: Step 3.4.1: Dynamically adjust the inertia weight of the particle swarm algorithm, which is determined by the following formula: Where w is the inertia weight, w initial is the initial inertia weight, w final is the final inertia weight, t is the current iteration number, and T is the maximum iteration number; Step 3.4.2: Dynamically adjust the cognitive coefficient and social coefficient, determined by the following formula: Where c1 is the learning factor, c 1,initial is the initial individual learning factor, c 1,final is the final individual learning factor, c2 is the social learning factor, and c 2,initial is the initial social learning factor, c 2,final is the ultimate social learning factor.
7. The indoor thermal comfort prediction method based on particle swarm optimization and BP neural network according to claim 5 is characterized in that: The specific steps of step 3.5 are as follows: Step 3.5.1: Update the particle velocity and position using the following formula: in is the velocity of particle i in the tth iteration, is the position of particle i at the tth iteration, r1, r2 are random numbers in the interval [0,1], p best,i is the historical optimal position of particle i, g best is the global optimal position of the entire population. Step 3.5.2: Retain some historical velocity information to avoid sudden changes in particle motion patterns caused by completely resetting the velocity. This is determined according to the following formula: Where a is the particle velocity retention ratio and σ is the noise intensity.
8. The indoor thermal comfort prediction method based on particle swarm optimization and BP neural network according to claim 1 is characterized in that: In step 4, the prediction model effect is evaluated using the mean absolute error (MAE), mean square error (RMSE), and coefficient of determination (R). 2 The calculation formula is as follows: where y i is the actual observed value, is the predicted value, is the actual observed mean, and n is the number of samples.