## 8 Comparison between Centralized MPC and the Genetic Algorithm Approach  
To further investigate the performance of the proposed optimization methodology, a comparison between the developed strategy and a MPC approach has been done. It is important to stress that the GA-based method is a centralized one, thus, to have a fair comparison between the two different strategies, the MPC has been developed in a centralized configuration. Furthermore, both methodologies have been applied to the same system in the same period of the year. However, there are two main differences between the two methods: firstly, the MPC controls directly the inner PID loop in the low-level control layer, while the genetic algorithm approach plans the set-point signal of the outer PID controller. Secondly, the MPC algorithm must solve a minimization problem at each sampling period, because of the receding horizon strategy, while the genetic algorithm approach solves the optimization problem at the beginning of the day for the whole day. Many different constraints affect the system, for example, constraints on the control variable (the water flow inside the radiator system cannot be negative or bigger than a maximum value), or on the controlled variable (the indoor temperature, see (3)). Thus, by considering the state-space model:  
\[ \begin{cases}x(t+1)=Ax(t)+Bu(t)\\ y(t)=Cx(t)+Du(t)\end{cases}  \tag{5}\]  
the generalized constrained optimization problem can be written as  
\[ \begin{split}\min_{u}J(u,y)\\ \text{subject to}&g_{1}(u,y)\leq 0.\end{split}  \tag{6}\]  
where the performance index \(J(u,y)\) is a function of the inputs and the outputs of the system and \(g_{1}(u,y)\leq 0\) is a vector containing all the different constraints that affect the system. The centralized MPC developed is based on a state-space model description of the building, it is, therefore, clear that the ARMAX models of the different rooms has to be rewritten in a MIMO state-space form to be suitable for this kind of centralized MPC. Looking at (5), the matrix \(A\in\mathbb{R}^{(nk)\times(nk)}\) is the state matrix, where \(n\) is the number of rooms of the building and \(k\) is the order of the autoregressive part of the ARMAX model. The matrix \(B\in\mathbb{R}^{(nk)\times(m+l)}\) is the input matrix, where \(m\) and \(l\) are respectively the number of controllable and uncontrollable inputs (which are, respectively, the water flows in the radiators, one for each room, and the weather conditions and the temperatures  
Figure 14: One day simulation (TRNSYS model), 5 December, for room 5 for the case of unoccupied rooms, case of radiators and ramp set-point signals. of the adjacent flats), and matrix \(C\in\mathbb{R}^{p\times(nk)}\) is the output matrix, where \(p\) is the number of outputs. These are, obviously, the temperature inside the rooms of the building. Therefore, it is now possible to write the performance index more specifically as follows:  
\[J(\tilde{u},T)=\sum_{i=1}^{M-1}\left[(T(i)-\tilde{T}(i))^{T}Q_{y}(T(i)-\tilde{T }(i))+\tilde{u}(i)^{T}Q_{u}\tilde{u}(i)\right]+(T(M)-\tilde{T}(M))^{T}S(T(M)- \tilde{T}(M)) \tag{7}\]  
where \(T(i)\) and \(\tilde{u}(i)\) are the outputs and controllable inputs vectors at the \(i\)th time instant, \(Q_{y}\), \(Q_{u}\) and \(S\) are the weight matrices and \(\tilde{T}(i)\) is the reference vector for the output at the \(i\)th time instant. The prediction horizon \(M\) is the same both for the predicted outputs and the control inputs. In this particular case, the prediction horizon has been chosen equal to 5 h, which is actually more than the value of the time constant in case of radiators employed as HVAC system. The weighting matrices have been set equal to:  
\[Q_{y}=I,\ Q_{u}=I,\ S=10. \tag{8}\]  
where \(I\) is the identity matrix.