# Predictive Optimization of the Heat Demand in Buildings at the City Level
## 4 Results
### Optimization of the Heat Demand  
#### 4.2.1 Minimum Variance Optimization for 480 h  
Figure 4 shows the total measured heat demand for 201 buildings and for different building groups and the measured outdoor temperature for the 480-h time period. The heat demand follows the outdoor temperature, but daily variation in the heat demand can also be seen. This daily variation is caused by the lowered heating power in many of the buildings during the night. Daily variation is somewhat smaller during the weekends because many of the buildings are unoccupied. Days 3-4, 10-11, and 17-18 are weekends in Figure 4.  
Figure 3: Absolute indoor temperature changes when 30% decrease in heating power is introduced to the indoor temperature model from [26] (\(y\)-axis) and with the indoor temperature model whose parameters are estimated without indoor temperature measurement (\(x\)-axis). Black line is for visual aid marking the line on which the indoor temperature change would be equivalent between the models. Four different sets of parameters for the indoor temperature model (Equation (1)) were estimated for each of 201 buildings. Then the 480-h time period was optimized in each building as presented in Figure 2 and discussed in Section 3.3.1. In Figure 5, 1000 random combinations of optimization results are presented. Each combination contains results using one of the four estimated indoor temperature models for each building. The optimized total heat demand was in all cases 0.2-4.5% lower than the original measured total heat demand and the maximum heat demand was reduced 8-11%. Figure 4: Measured (**a**) outdoor temperature, (**b**) the total heat demand in 201 buildings, (**c**) the total heat demand in apartment buildings, (**d**) the total heat demand in schools, and (**e**) the total heat demand in commercial, public and office buildings. The result with the lowest variance of the heat demand in each building is also shown in Figure 5. In that case, the optimized heat demand was 1.1% lower, and at the maximum heat demand was reduced by 14%, which corresponds to a 4.9% reduction in the total heat demand for the whole district heating system. Compared with the measured total heat demand in Figure 4b, the applied optimization method can be seen to smoothen the heat demand by increasing the heat demand during lower demand and by decreasing the heat demand during high demand. This is possible by utilizing the heat storage capacity of the buildings. As the predictive optimization relies on the accuracy of the heat demand forecast, mean absolute percentage error (MAPE) and Pearson correlation coefficient (r) for the heat demand forecast of individual buildings are presented in Table 2. For individual buildings, MAPE varied from 3.6-59.8% and r from 0.19-0.97 for the 48-h ahead heat demand forecast during the 480-h optimization period. However, the average MAPE and r were 10.2% and 0.78, respectively. For 122 (60.7%) buildings, the MAPE was lower than 10% while r was greater than 0.7. There were 17 buildings with r lower than 0.5. Most of these buildings had heating power that varied highly on hourly intervals making it hard to forecast the exact heat demand and this lowered the r value. In 22 buildings, the MAPE was over 20%. These buildings included some of the ones with low correlation values, but in general these buildings had a clear day and night cycle in their heat demand profile and the model overestimated the heat demand during the day-time while underestimating it during the night-time. Figure 5: Optimization of the heat demand by minimizing the variance of the heat consumption in 201 buildings. Upper figure: Light grey lines are 1000 different optimized total heat demands and the black line is the optimized total heat demand with minimum variance in each building. Lower figure: Light grey lines are the heat demand change in percentages with 1000 different optimized total heat demands and the black line is the heat demand change in percentages with optimized total heat demand and minimum variance in each building.