Implementation of MPC for an all-air system in an educational building

. The building sector has to significantly reduce the total energy use. A predictive control could be a solution to control an HVAC system more energy efficiently since it takes into account the current measurements and the future demand. In this study a predictive control framework is implemented in an educational building with two lecture rooms. The airflow rate is controlled by VAV boxes based on measurements of CO 2 concentration and operative temperature. T he dynamic model used for optimization of the control input is a grey-box model, previously identified using measurement data. Weather forecasts and weekly lecture schedules are used as forecasts for the optimization of future control actions. The control actions resulting from the optimization are written to the set points for supply air temperature and VAV damper position using the BACnet interface. Results of the first trial indicate that the predictive control is able to control the room temperature and CO 2 concentration, even with uncertainty introduced by the forecasts. Prediction errors observed were 0.17 ˚ C for room temperature and 87 ppm for indoor CO 2 concentration.


Introduction
Facing the climate change, the building sector has to significantly reduce the total energy use. Buildings worldwide are reported to use approximately 36% of the total energy use, and account for 39% of the total worldwide CO2 emission [1]. HVAC is reported to use 50% of this energy use in buildings [2]. To reduce the high energy use HVAC systems can be optimized to use energy more efficiently. However, HVAC systems are challenging to control, due to time varying dynamics and varying internal/external disturbances [3], [4]. Currently, most used control strategies in buildings are still PI or PID controllers, where the specific parameters are tuned based on simple rules and knowledge of the engineer [3]. However, a control strategy that is both reactive and predictive could result in a more energy efficient control [5]. Therefore, a model predictive control (MPC) could be a solution to control an HVAC system more energy efficiently, since it takes into account the current measurements and the future demand. Already in buildings with hydronic systems the reported energy reductions after implementation of a predictive control are significant [6], [7]. However, the question remains if MPC also has an energy saving potential for all-air systems, since the time dynamics of the system are shorter compared to hydronic systems. In * Corresponding author: bart.merema@kuleuven.be addition, for all-air systems the impact of predictive control on the energy use might be smaller since the system is fast responding, reducing the possibilities to shift the demand. For all-air systems there is often a contradiction between ventilation demand to guarantee the indoor air quality (IAQ), and heating demand for thermal comfort. Since, the system uses a feedback controller it is even more challenging to balance between the ventilation demand and the heating demand. Furthermore, the occupancy pattern can be varying over time resulting in changing dynamics inside the room. To optimize the control of an all-air system, a predictive control could be used to solve the dual optimization problem between the fresh air demand and the heating demand.
One of the earlier examples of implementation of a predictive control for an all-air system is shown in [8]. In this study a grey box model is used to predict the future states and control the airflow based on CO2 and temperature predictions. The reported energy saving was 20% of the total energy use in an office building. However, results indicated that in all zones, except one, CO2 levels post retrofit were at maximum 600 ppm, indicating a low occupancy density. In a similar study [9], an optimized supervisory MPC was implemented in two commercial buildings to control the room temperature. The trial demonstrated that the implemented predictive control could minimize the total energy use of the HVAC system by 19% up to 32%, while even improving the thermal comfort. In addition, the performance of an MPC can also be related to the conditions inside the building. In buildings with an alternating occupancy the energy savings in simulations were reported up to 60% for an MPC compared to a more homogenous occupancy [10]. This indicates the energy saving potential for MPC in large spaces served by all-air systems with intermittent use. However, in literature there are not many examples of real implementation for MPC of an all-air system controlling both the room temperature and CO2 concentration in large spaces with intermittent use. This paper presents a method to implement a predictive control for a smart controlled ventilation system in an educational building.
The challenge for implementation of predictive control in real buildings is the effect of uncertainty related to the forecasts and unexpected changes in the room. In addition, a simple grey-box model is used to generate predictions. Since the forecasts are not perfect, the impact of this uncertainty on predictions is studied during operation. This paper presents the first trial results of the operation for the all-air system, and evaluates the performance of the implemented predictive control. The paper is structured as followed. First, a description of the case study building is given. Afterwards, the MPC framework used is presented and described, including the optimal control problem. The third section describes the implementation of the predictive control in the case study building. In the fourth section results are presented of the first experimental trial. Finally, a conclusion is given summarizing the main findings after implementation of the predictive control.

Case study building
For this research, an existing university building is used as case study building. Figure 1, shows the outside view and cross-section of the test lecture rooms. The building is located at the Ghent Technology Campus of KU Leuven in Ghent, Belgium. The studied building includes two large lecture rooms with 140 m2 floor area and a maximum occupancy of 80 students each. The Uvalue for the building envelope is 0.15 W/m 2 K. The building is built in 2014 according to the Passive House standard. Balanced mechanical ventilation is provided with a total airflow supply of 4400 m³/h for two lecture rooms. Fresh air is supplied by air diffusers (displacement ventilation) in each corner of the room, as indicated in Figure 2. The air handling unit (AHU) regulates the VAV dampers by sending a request signal to control the airflow, based on CO2 concentrations and operative temperature in the lecture room. Each room is a single zone with a supply and return VAV. Set point for CO2 and indoor temperature (heating) are set at respectively 1000 ppm, and 22 °C. During weekdays the AHU is switched on at 7:30, and switched off at 18:00h. For heating purposes, the air is preheated by air-toair heat recovery, i.e. two cross flow plate heat exchangers connected in series with an efficiency of 78%. Additionally, a heating coil of 7.9 kW is integrated in the supply ducts of each lecture room. A modular bypass is included.
The building includes an extensive building monitoring system (BMS). A set of sensors has been installed to monitor indoor and outdoor conditions. A weather station is located on the roof of the building and monitors the main outdoor parameters: global horizontal irradiation, the outdoor temperature, relative humidity and the wind speed and direction. For the indoor conditions, the indoor temperature, the CO2 concentration and the indoor humidity are continuously monitored. The occupancy of the lecture room is measured by use of counting cameras which were installed in the lecture room.

Predictive control framework
Ventilation control is often non-linear resulting in an MPC with a control problem that can be complex to solve, due to the non-linear constraints. The aim of this all-air MPC is to control the supply air temperature and airflow rate to minimize the energy use. At the same time we want to guarantee the indoor environmental quality (IEQ), by maintaining the CO2 levels and the room temperature below the predetermined set points. The ventilation energy supplied to the zone, given in equation 1, is the parameter that is optimized within the all-air MPC. This parameter includes the two controlled variables, supply air temperature (Tsupply) and the airflow rate (mair).

Qvent = mair*ρ*(Tsupply-Troom)
(1) The complete predictive control framework implemented in the building, as shown in Figure 3, controls the VAV boxes in the ventilation system for each room and the heating coils connected to each air supply duct. In step one of the non-linear MPC framework the forecast of solar radiation, outdoor temperature, and occupancy are collected and forwarded to the predictive controller. For occupancy, the number of persons are obtained from the weekly lecture schedules, made available by the university administration. The comfort criteria include the heating set point and minimum airflow rate set point that changes over time. In step 2, a previously identified grey-box model [11] is used as prediction model in the predictive controller. This grey-box model of the room consist of four states: thermal mass temperature, indoor air temperature, supply air temperature and indoor CO2 concentration. At each time step a prediction is made of all these four states. Based on these predictions the future control action is optimized.
To solve the remaining OCP the following multiobjective cost function, shown in equation 2, is defined to minimize the energy use with respect to the indoor CO2 concentration, and room temperature. The slack variables zCO2 and z are used for the comfort constraints to penalize exceeding the set point and to avoid using hard constraints. This is needed to guarantee the IEQ while reducing the energy use. For the room temperature a lower and upper bound is defined, where for CO2 concentration the set point is set at 1000 ppm. The weight factors used for each cost function parameter are determined by using a Pareto Front to obtain the Pareto optimal solution.  The jModelica framework [12] is used to define and solve the resulting optimal control problem (OCP). To solve the optimization problem for this non-linear MPC, the direct collocation method [13] is used, that is the default optimization algorithm present in jModelica. In the direct collocation method the non-linear problem is solved using polynomial splines. The thermal mass temperature is an unmeasured state present in the greybox controller and is estimated using an unscented Kalman filter (UKF). In the UKF at each time step the prediction of the state for the thermal mass temperature is corrected based on measurements of the room temperature. This was needed since this parameters is not measured in the case study building. The OCP is solved every time step (15 minutes) in which the optimal control output is calculated for the complete prediction horizon. The prediction and control horizon used in this MPC framework is 8 steps ahead (i.e. 120 minutes).
In the final step of the MPC framework the optimized control output, supply air temperature and air flow rate, is sent to the AHU. Here the set points for the VAV damper position and the supply air temperature are set accordingly. At each time step, the future disturbances and constraints are updated and passed to the OCP to obtain the next control input trajectory.

Implementation of predictive control in the building
In this educational building the AHU control is connected to a BACnet interface with the building monitoring system. The existing BACnet interface is used to implement the predictive control framework. Using a BACnet/IP driver, available through the Python package BACØ [14], measurement values can be read and control actions can be written to the desired set point. To switch back to a rule based control (RBC) the release of the BMS can be deactivated to enable a RBC, ignoring all the previously written set points by the predictive controller.
The complete framework used for the predictive control, as illustrated in Figure 4, is written in Python where each part of the process is in a separate Python file. Each task is executed at a fixed time interval of 15 minutes. The complete process is running on an industrial computer (IPC), located in the technical room of the building. This IPC is also used for the lighting control and for storage of building monitoring data. Data is exchanged between the different tasks using JSON files containing the essential information (e.g. forecasts, optimized control set points, estimated states) to execute a process. The first process considers reading the measurement values and obtaining the weather forecasts. Measurement values are read using the BACnet related objects. The analog input objects for room temperature and room CO2 concentration are read to update the measurement values at each time step. These two parameters are needed in the optimization and estimator tasks respectively. The forecaster uses an existing weather forecasting API DarkSky [15] to obtain hourly updated forecasts of the outdoor temperature and the cloud-cover. The global horizontal irradiation (GHI) is calculated using the clearsky scaling algorithm, present in the pvlib python package. Based on the cloud cover the solar radiation forecasts is computed for the building location. In addition, the forecasts include the weekly lecture schedule that is used for occupancy forecasts.
The second process, MPC.py, considers the predictive control for the all-air system. The optimizer is based on the MPC object, available in jModelica, where modifications have been made to enable the update of disturbances at each time step in the optimization process, as illustrated in Figure 3. The optimized airflow rate obtained from the optimizer is translated to the requested VAV damper position needed in the next step.
The third process involves writing of the optimized control action to the corresponding BACnet objects. In BACnet the analogue values for VAV damper request position and the minimum supply air temperature are written for the two lecture rooms. This involves translating the optimal airflow rate to a damper position.

Results
Implementing a predictive control in a building involves some uncertainty present in the forecasts for both the weather and occupancy. In addition, unexpected changes might occur regarding the occupancy. In Figure 5, the hourly weather forecast errors are shown for the outdoor temperature and the global horizontal irradiation (GHI). The forecast error here is defined as the forecasted values obtained from the weather forecast API minus the measured values from the local weather station. For the GHI only the values during daytime are considered. It is observed that the highest frequencies are found for the value 0 for both the outdoor temperature and the GHI, indicating an accurate forecast. However, large errors can occur when using weather forecasts form existing applications. GHI is especially sensitive to large errors up to 300 W/m 2 during days that are partly cloudy indicating that this parameters is difficult to forecast accurately. These results indicate that although a weather forecast API is used there is still some uncertainty in the forecasts. To evaluate if the written BACnet set points are respected by the ventilation system the optimized VAV damper position and supply air temperature are compared to the measured values in Figure 8. Overall we can see that the optimized actions derived from the MPC are actually observed for the controlled parameters. During night-time the measured values for supply air temperature shows large difference up to 8˚C, however this is a result of no airflow since the AHU is not active thus the difference can be ignored. Furthermore, it is observed that on the third and fourth day, during the middle of the day, there is a difference in supply air temperature of 7 ˚C between MPC and measured. This is the effect of the control for the bypass of the heat exchanger that is activated when one of the two lecture rooms exceeds a room temperature of 24 ˚C. Figure 7 presents the operation of the all-air system using the predictive control. The room temperature is controlled according to the requested temperature heating set point. The thermal comfort achieved with the predictive control is good. Only 12.5 K*h were noticed as discomfort hours, where the heating temperature set point of the room was not met. On the 5th of March there were problems with trapped air in the heating circuit, as illustrated in Figure 7, since the set point is not met and the supply air temperature did not increase. The CO2 concentration inside the room is controlled by increasing the supply airflow rate as indicated. Total discomfort regarding CO2 was 559 ppm*h.
The occupancy, indicated in Figure 7, is the expected occupancy according to the lecture schedule. However, it is shown that during the expected occupancy the CO2 concentration did not increase on both the first day and fourth day. At the same time it is shown that the VAV damper position opens since occupancy is expected. The CO2 concentration however remains stable and did not increase, this indicates that the lecture is cancelled. In addition, on day 2 it is noticed that the end time, according to the lecture schedule is not respected. To avoid mismatch between expected occupancy and actual measured occupancy we used a reactive and predictive approach. To correct the occupancy forecast due to cancelled classes or different start or end time, the forecast of the next time step is corrected using the estimated CO2 room concentration. For the remaining time steps in the control horizon the lecture schedule is used for the forecast of occupancy. The results depicted in Figure 6 shows that the corrected CO2 concentration, based on both measurement and forecasts, produces better predictions compared to the lecture schedule (only forecasts). The predictive control framework relies on accurate predictions of the room CO2 concentration and the room temperature. Figure 6 illustrates the one step ahead prediction error for the room CO2 concentration and room temperature. The predictions of these two parameters are affected by uncertainty in forecast of both the weather and occupancy data. Often in simulation studies a perfect prediction is assumed, however this can result in large errors, especially for CO2, as indicated in Figure 6. In some cases the one step ahead prediction error using the lecture schedule resulted in an error up to 1800 ppm while with using the corrected value, based on the measurements, the error is at maximum 300 ppm. For room temperature it is indicated that the highest frequencies are found for the smallest prediction errors in the range of -0.5 up to 0.5˚C. The mean prediction error for room temperature during this period was 0.17˚C.

Conclusion
This paper presented the first trial results for the implementation of a predictive control for an all-air system. In general, the results indicate that a predictive control can be used to control the all-air ventilation system while guarantee the IEQ. A relative simple greybox model with four states is used to predict the room temperature and CO2 concentration. Using an available weather forecast tool and weekly lecture schedules, internal and external disturbances are forecasted. The existing BACnet interface, present in the AHU control, is used to write the optimized control inputs. Measurement results of the supply air temperature and VAV damper position indicate that the written control actions through BACnet are respected. Results for the operation of the all-air system indicated that room temperature and indoor CO2 concentration could be predicted with a high accuracy, even regarding the uncertainty related to real implementation of MPC. The prediction error observed for room temperature was 0.17˚C, and for CO2 concentration 87 ppm. The IEQ is guaranteed using a cost function for the optimization that minimizes both the room temperature and CO2 set point violations while minimizing the energy use. Results indicated a few violations for room temperature and CO2 concentration, but in general the MPC framework is able to control the building indoor climate and air quality.
In the future a shorter time step of 5 minutes will be tested, since CO2 concentration is a fast responding parameter. In this way, using the measurement update, unexpected changes can be corrected in the optimization process. Furthermore, the temperature set point will be adapted based on the occupancy status of the lecture room to introduce an occupancy based predictive control for further reductions of the energy use.