## 2 Overview of the IMBPC HVAC Solution Hardware and Software
### Software  
The current version of IMBPC assumes the existence of a Building Management System (BMS), able to measure and control the HVAC equipment. The software is composed of three major blocks: an interface to the BMS, a data acquisition module responsible for communicating with the intelligent weather station, the SPWS, and with the BMS interface module, and a control module, to execute model predictions, the MBPC algorithm, and the communication of the control actions to the BMS interface. These interfaces and the data acquisition use a small IOT platform, described in Section 4. The details of the control algorithm, as well as other results by IMBPC HVAC achieved in real-time control can be seen in [9], and are briefly summarized here. The IMPBC HVAC approach assumes the existence of schedules for each room under control. Denoting one occupation period by \(t_{oc}=\left[ \begin{array}{cc}t_{os}&t_{oe}\end{array} \right]\), \(t_{os}\) being the start of occupation, \(t_{oe}\) its end, and by \(t_{op}\) a time prior to \(t_{os}\), where the HVAC is turned on to ensure thermal comfort since the beginning of the occupation period, and by \(k_{os}\), \(k_{oe}\) and \(k_{op}\), the corresponding sample indices assuming a user-specified constant sampling interval, the sequence of reference temperatures, \(U[k]=\left\{ \begin{array}{cccc}u[k+1]&u[k+2]&\cdots&u[k+PH]\end{array} \right\}\), to be applied to the HVAC is given as the solution of:  
\[\min_{U[k]\in p_{H}}\left(\sum_{i=k+1}^{k+PH}[i]\right)\Bigg{|}_{ U_{k}},k\in\Big{[} \begin{array}{cc}k_{op}&k_{oe}\end{array} \Big{]}. \tag{1}\]In Equation (1), \(v_{PH}\) denotes the set of allowable control action sequences; in this case the control actions will be reference temperatures in degrees Celsius, or the value 0 that denotes that the HVAC is off. In order to enable the smooth operation of the system, each control action can only deviate by 3 \({}^{\circ}\)C around the previous control action, i.e., \(u[m]\in\{\{u[m-1]-3\cdots u[m-1]+3\}\cup\{0\}\}\). \(J[i]\) is an estimate of the economic cost at the \(i\)th sample, and \(\Theta[j]\) denotes the thermal comfort at sample \(j\), and \(\sum\limits_{i=k+1}^{k+PH}J[i]\) the total economic cost over \(PH\). This way, we are determining the control sequence that minimizes, at each sample instant, the economic cost over a \(PH\), ensuring that the thermal comfort over this \(PH\) is ensured. According to the receding horizon principle, only the first value of the optimal sequence will be applied to the HVAC system. Equation (1) is solved by a modified version of the Branch and Bound algorithm [13], previously applied by the authors on an energy-efficient HVAC MBPC pilot system [8]. As a note, the time format used in this work is the complete date, plus hours, minutes and seconds. In order to solve Equation (1), we need forecasts of the economic cost of each control action, within \(PH\). This can be easily obtained by translating the estimated energy spent, at each step, into economic costs, using the tariffs used by each contract [14]. Although different methods were tested, the easiest method for estimating the energy, in each step, is assigning the value of 0 to the situations where the HVAC is off, and a constant value, different from 0, to each period where the HVAC is on. During recent years, HVAC control has gradually changed from dealing with temperature regulation to being about occupants' thermal comfort [6; 8; 9; 15; 16; 17], mainly due to the fact that temperature is not the only factor affecting thermal comfort and that a constant temperature is not required for humans to achieve thermal comfort, and to the consequent potential for energy savings. Although different indices can be used to characterize the thermal sensation, [PERSON]'s Predictive Mean Vote (PMV) is still the most used. It predicts the mean response (in a statistical sense) of the thermal sensation of a large group of people exposed to certain thermal conditions for a long time.