Energy Optimization of Air Handling Units Using Constrained Predictive Controllers Based on Dynamic Neural Networks

Optimizing energy consumption in buildings is a significant challenge in today’s society. A major part of energy consumption is in heating, ventilation and air conditioning (HVAC) systems. In this paper, the aim is to reduce the energy consumption of air handling units (AHU) by applying optimal control. This system used in this study has four AHUs, all of which are assumed to be the same. Due to the uncertainty of the temperature of the heat exchanger’s (H/E) inlet and outlet water, a model of the system was first made using its hypothetical capacity according to the ASHRAE standards. The inlet and outlet water temperatures are calculated using simulated and real data. In order to increase the model’s accuracy and facilitate implementation on a real system, the data obtained is used to train a dynamic recurrent neural network (RNN) for the H/E. Furthermore, to increase the system’s stability and bolster its response to disturbances, which change system parameters over time and reduce the accuracy of neural network models, an online recursive least squares (RLS-based) adaptive constrained generalized predictive controller (AGPC) is used to control its outlet air temperature. The AGPC attempts to minimize the computational load and estimates the transfer function by using continuously updated input-output data from the model; this model has fewer parameters than the RNN model. Finally, the power consumption of the H/E is calculated. The outlet humidity and airflow are controlled using an optimal controller to minimize energy consumption. The results show a reduction in the energy consumption of 54.95% with respect to the previous work and of 69.9% compared to the dataset from the real system.


I. INTRODUCTION
Increasing energy consumption is one of society's main concerns today. A large portion of overall energy usage takes place in buildings (about 30 %) [1], and a significant part of this energy is related to ventilation, cooling, and heating systems (about 50%) [2]. Maintaining the temperature and humidity of the ambient air within the standard range to create thermal comfort is one of the important points that should be considered in the design of a ventilation system. In this paper, the aim is to maintain these parameters within the desired range for thermal comfort while reducing the HVAC system's energy consumption. This paper builds on many existing studies in the field. Reference [3] investigated the dataset from a four-AHU ventilation system in a medium-large size building located in Romania [4,5]. Romania is a four-season country with hot summers and cold winters, and optimizing cooling and heating systems in this context is particularly important. The data had been collected over a period of one year. The ventilation space model of the system was estimated using series neural networks, and the model predictive controller (MPC) was distributed on the system. The energy efficiency of the system, in general, was specified. Reference [6] implemented an MPC on an HVAC system and then estimated it using recurrent neural networks. That paper investigated energy consumption over a period of just one month in different seasons, and its scope was limited to the cooling system. Reference [7] used a feedforward neural network (FFNN), a radial basis function network (RBFN), and an adaptive neuro fuzzy inference system (ANFIS) to predict the energy consumption of a heating system. Results were investigated over a period of 1.5 months. In all of these references, the main goal is to predict the energy consumption of the system using these neural networks directly that need a lot of data from the system. But, this research's main goal is reducing the total energy consumption of the system in the online form, using an adaptive neural-based predictive controller and constrained optimal controller. Due to the dynamic nature of the heat exchanger system, dynamic and recurrent neural networks (RNN) only have been used for modeling the system s' heat exchanger with good accuracy. Reference [8] discussed different kinds of artificial neural network (ANN)-based MPCs. Reference [9] investigated the computational load problem of MPC controllers. References [10,11] reduced the computational load of an MPC controller by using linear models to simplify the building model . Reference [12] incorporated MPC into the state-space model of an office building. Reference [13] achieved an energy-saving percentage of about 27.01%, which was calculated over a 24hour period. This work, in contrast, calculates the energy-saving percentage over a period of one year and investigates the energy consumption in different parts of the AHU units. The model of each component of the HVAC system has been specified in detail. Some equations, like energy consumption and nonlinear equations, which have been used for modeling components, are quite complex. It should be noted that achieving a good performance can be more challenging when longer time periods are used. This paper uses a variable air volume AHU. The ANN feed-forward neural network approach with 20 layers has been used as a secondary method to specify the setpoint. Ref. [14] used a system state-space model of the whole HVAC system and the zones it supplied. The model is complex, and it has nonlinear states that increase the system's complexity. That study investigated the AHU and building structure. In addition, the authors implemented the controller in the centralized configuration system. In this work, on the other hand, an adaptive constrained GPC controller has been implemented on a simplified estimated model to reduce the computational load. Three types of controllers: integrated fuzzy PI-PD Mamdani, cluster adaptive training based on Takagi Sugeno-Kang (CABTSK), and bang-bang have been applied to the system. Tuning these controllers can be challenging when the system parameters are in flux. The setpoint span of the indoor temperature has been specified according to the ISO7730 standard. In (ref), the energy consumption was investigated over a period of just 24 hours, whereas this work uses a period of one year; the energy efficiency of (ref) is about 37%; this study, meanwhile, has achieved a reduction of 54%. Numerous other techniques have been proposed for energy optimization; however, many of them are complex and increase the computational load. Reference [15] investigated optimization problem solver tools for MPC controllers. Reference [16] specified MPC's limitations that stand in the way of its wider adoption in building control systems. Transfer learning with feed-forward deep neural networks for MPC has been presented in [17]. A predictive adaptive controller has been presented in [18]. A purely data-driven black-box model employing various choices of machine learning approaches has been illustrated in [19]. A comprehensive report of MPC controller benefits can be found in [20]. An RC model has been used to estimate the building model and simplify it in [21]. Reference [22] utilized simulated data from an MPC-controlled HVAC system and the adaptive boosting method to define decision rules. Distributed classic adaptive controllers that are implemented on the white box model have been illustrated in [23]. Reference [24] implemented an MPC strategy with encoderdecoder recurrent neural networks for the smart control of a thermal environment and achieved a 7% increase in energy efficiency. The method was implemented by considering the interaction between some of the system variables, and the result was compared with those of a PI controller and an adaptive PI controller. However, the complexity of the method, the high volume of calculations, the short duration of the experiment (about 4 hours) and the low improvements in energy efficiency (between 4 and 7%) are disadvantages of said work. Furthermore, [24] only addressed the control of the AHU's outlet air temperature. Reference [25] studied the energy efficiency of five structures of the air conditioning system; the study improved the energy consumption of the cooling system by adding airto-air H/E to the structure of each AHU. Energy demand fell by 23.68%, improving the efficiency of the first law by 31.29%. Similarly, the total energy losses were reduced by 26.58%, and the second law's efficiency was improved by 11.79%. A cost analysis showed that the lowest payback time and the highest cost savings were related to the first and fourth structures, respectively and this study in took place over a one-year period. A drawback of [25], however, is that it only investigates the modeling section, and it does not provide information about the performance of different control techniques for layouts with five AHUs. Reference [26] achieved an energy consumption reduction of about 10% in a cooling system with variable air volume (VAV) AHUs using the ANN model and a developed controller. Reference [27] used data mining techniques to reduce the energy required by an HVAC system energy by about 23%. Two energy-based control techniques have been investigated in [28], and the energy usage was reduced by about 13%. Reference [29] developed a dynamic model for an HVAC system using schedule-based temperature and a damper position rest to reduce annual energy consumption. Reference [30] used a heat recovery method to reduce energy consumption in buildings. Ref [31] is about the FPGA-based Taguchi-chaos-particle swarm optimization (PSO) sun tracking system. In this reference, PI controller has been considered as the main controller. PSO algorithm has been used to tune PI controller parameters. Taguchi Method and Logistic Map have been used to increase steady-state convergence of PSO algorithm. The main goal is Maximum PowerPoint Tracking of the solar panel to increase its output power. PI is an unconstrained simple classical controller with a small degree of freedom. Because of its basis in online form implementation, PSO algorithm can increase the computational burden of the system and decrease speed of the controller. Also, the closed-loop system guarantee always is a challenge. Results just have been investigated in the small duration. In this work, an adaptive constrained predictive controller with consideration to computational burden reduction and better closed-loop stability has been developed. Ref [32] is about the solar-powered Stirling engine analysis and optimization with heat transfer considerations. The genetic algorithm has been used to compute the engine's maximum output power and its associated system characteristics. Exact physical model of the system has been used that it can change over the time and all parameters in real system have uncertainties. . There are no details about optimization cost function and its constrains and considered genetic algorithm.
Because the actual structure of air conditioners in the real system is not known, this paper considers a common structure for all air conditioners that is detailed in [33]. Their capacity has been assumed the same to facilitate the system analysis. The capacity of the AHUs is considered the same as that of the AHU used in [3] (i.e. 1000 CFM) to facilitate the comparison of their energy consumption. In this work, the control system is divided into two parts: control of the outlet air temperature and control of the flow and humidity of each AHU's exhaust air. In the outlet air temperature control, since the temperatures of the inlet and outlet water of the H/E are unknown, these variables are first estimated using the proposed dynamic model with parameters from a real water to air H/E of the same capacity. In order to increase the accuracy and flexibility of the model, a dynamic linear neural network is used to estimate the overall model of the H/E. One of the innovations of this paper is that it combines data-based and model-based methods to increase accuracy. Real system data and simulation data are used to estimate the H/E model. The adaptive constrained generalized predictive controller is used to increase the system's stability and ensure an appropriate response to disturbances and possible changes in the system. Another unique contribution of this article is that it considers the computational load in the design of the controller and attempts to reduce it. The humidity and airflow of each AHU are kept within the desired range by using a controller that seeks to optimize the system's energy consumption (Fig. 1). In this paper, MATLAB software is used for simulation. In order to address the research gaps previously described in this section, this work: a) Using a one-year dataset from a four-season country with hot summers and cold winters. The simulation also represents a year-long period. b) Utilizing both physical and RNN-based data-driven models of the H/E. A physical model has been used to c) estimate the unknown data of the H/E and HVAC system and to increase the accuracy of the main dynamic neural d) network model that is estimated for the H/E. In addition, the main RNN model increases the flexibility of the proposed model such that it can be implemented in real system applications; it also ensures that the simulation results are as close to the actual system results as possible. e) Attempting to control all essential HVAC parameters, including AHU outlet airflow rate, temperature, and humidity, and keep them within the standard range while optimizing energy consumption. f) Using dynamic models only for the H/E and AHU outlet air temperature section so as to simplify the model and reduce the computational load. A non-dynamic model is used to control the AHU outlet air humidity and airflow. g) Using online recursive least squares (RLS-based) adaptive constrained generalized predictive control (GPC) to control the system's outlet air temperature and in turn increase the stability of the system. This improves the system's response to disturbances, such as parameters that change over time, which reduce the accuracy of neural network models. The reduction of the computational load is also considered; to that end, the system's transfer function is estimated using continuously updated input-output data from the model, and it thus has fewer parameters than the RNN model.
This study has five sections. Section II reviews water to air H/E modeling. Section III examines AHU output temperature, airflow, and humidity control. In section IV, the controllers' simulation results have been investigated in detail. Section V provides the conclusion of the paper. FIGURE

Methodology scheme
Overall state-space model of the air conditioned zones using AHUi that has been estimated using real system dataset and dynamical neural network. Distributed MPC controller has been applied on the system and the simulation data has been captured.
According to the assumed AHU unit overall capacity , its specifications and ASHRAE standards a popular model of the heat exchanger has been created and inlet and outlet water temperature data have been estimated.

II. WATER TO AIR HEAT EXCHANGER MODELING
As described in [3], the distributed MPC algorithm is implemented on the system state-space model, which is estimated using dynamic neural networks. According to Table1 and the reference signal assigned to the air temperature of the ventilated areas, the appropriate value of the outlet air temperature of each AHU , has been calculated to reach the reference signal. In this article, the aim is to optimize the energy consumption of the air conditioners. Therefore, the inlet water temperature is considered as a control variable. Due to the uncertainty of the value of the inlet and outlet water temperature ( , , , ), it is assumed that the capacity of the AHU units is the same of those used in [3], and an estimate of these values is made using the general model intended for H/Es in [33] along with information about the parameters of the water to air H/Es laid out in the ASHRAE standards [34,35]. To simplify the model, it has been assumed in Table 1 This HVAC system has four AHUs that have been divided into two pairs (AHU1, 2 & AHU3, 5) [3]. More details are provided in in Fig. 2. As per the instructions of [33], a common structure has been specified for each AHU in equations (2,3,17); this structure is depicted in Fig. 3. After calculating the inlet and outlet water temperature of the H/E for two AHU units, the main model of the H/E is estimated using linear autoregressive neural networks. The reason for using this data-driven approach for system modeling is that this method has enough flexibility to model complex systems with sufficient accuracy. In addition, this method can be implemented on real systems. It is possible to estimate this model using real control system data instead of dynamic model data. In this paper, two-layer linear timeseries dynamic neural networks have been used to estimate the AHU units' outlet water temperature , and their outlet air temperature , in the models of each AHU. These neural networks have been estimated using the MATLAB nonlinear autoregressive with external input (NARX) neural networks toolbox [36,37]. To that end, 70% of data has been used to train the model, 15% has been used for validation, and the remaining 15% of data has been used to test the neural networks. The training function is the Levemberg-Marquardt [38] algorithm, and the performance cost function is the mean square error (mse). The overall form of these neural networks is shown in Fig. 4. The dataset from [4] ( , ), simulation data from [3] ( , , ), and the estimated data described in the first part of section 2 ( , , , ) were used to train, validate, and test the neural networks.
Real system dataset description: Dataset [3,4] related to 4 air handling units in a medium-large sized building ( PRECIS research center ) in Romania has been used. In temperate continental weather with hot summers and cold winters. On-site electric chillers offer cooling, while a district heating network provides warmth. Sensors individually measure the temperature data with each AHU. AHU 1 and AHU 2 are located on the roof of the building and are in charge of ventilation on floors 4-7, which are mostly research labs. While AHU 3 and AHU 5 are responsible for the building's lower levels, including administrative, multifunction, and technical facilities. Exhaust, intake, and recirculation air temperatures are all monitored by sensors in each AHU. The data is gathered at five-minute intervals and covers the entire year of 2017.

Simulation dataset description:
In [3], simulation results of 4 AHU units have been specified for one year duraiton. These simulations have been done in the outside environment condition that has been specified in [4]. AHU units outlet air temperature (Tsa,ref) and recirculation air temperature (Tri) data have been used in the modeling and control section of this paper.
The results (Figs. 5 and 6) show that there is a complete linear relation between the output and target data and that R is a regression factor equal to 1. The accuracy of the estimated model is perfect, and the data fit the estimated model completely.
( , , ℎ , ℎ , , , , , ) are weight matrices of these neural networks. Each layer has the Purelin transfer function.   According to neural network model flexibility, the main goal of this section is to estimate a generalized data-driven model for each AHU heat exchanger with good accuracy. Due to figure 4 overall model has 2 parts. First part is that the main dynamic recurrent neural network model has been estimated to model outlet air temperature (Tsa). Figure 5 shows that the R=1 and gradient and estimation error are very small approximately is zero. It is reason most of the data that has been used for estimation of the model captured from linear system simulation in [3] and the first part of section II estimated model output completely fit on the dataset. The neural network layers and neurons have been considered as small as possible to avoid its overfitting. Second part of the model is a feed-forward neural network model of the H/E outlet water temperature. This model has been considered to complete the overall model. Also, in analyzing its results has helped to increase accuracy and close estimated model to real system application. In two parts neural networks has 2 layers and 2 neurons in each node.

A. AHU OUTLET AIR TEMPERATURE CONTROL
In the previous section, the H/E model was estimated using neural networks. Because the data used to train the neural network is collected from a closed-loop controlled system, this neural network can act as a controller to regulate the output temperature sa,i of the AHU. The disadvantage of this method is that if the values of the reference signal and input signals change or the system parameters change, the output of the system may be suboptimal. Another disadvantage is that if the neural network model is estimated online, the large number of parameters causes this model to put a significant computational burden on the controller hardware, and the system therefore requires more powerful hardware for its implementation. The proposed solution is to use an auxiliary adaptive controller to increase system stability and maintain output convergence in the presence of disturbances. MPC is one of the optimization-based control methods that is used in many systems due to its desirable features such as enhanced system stability and its ability to neutralize the effect of disturbances; another advantage is that it can be implemented despite constraints. The disadvantages of this controller are its complexity and the large volume of its calculations [39,40].
Due to the large number of parameters in the neural network model, the computational burden will be high if the controller is applied to it. In order to reduce said burden, this study uses a different MPC method called generalized predictive control (GPC). In this method, only the input-tooutput transfer function of the system is used to implement the controller. One benefit of this method is that it can be implemented on non-minimum phase systems and even unstable systems. It also responds well to disturbances. The GPC controller equations are specified below: Where the polynomial ( −1 ) is the model output dynamic and the polynomials ( −1 ) and ( −1 ) are the control input and disturbance dynamics, respectively. , , and are the degrees of these polynomials. d is the input delay. Δ( −1 ) is an integrator that has been added to the model to prevent steady-state error. The desired control signal u (t) is generated by minimizing the cost function ( c ). This cost function is optimized iteratively in every sequence of the control algorithm. The prediction output is calculated over the prediction horizon using the Diophantine equation in which ( −1 ) is white Gaussian noise. The GPC controller is applied to the transfer function model, which is strictly proper and is estimated online each time the control algorithm is run using data from the outlet air temperature T sa,i and inlet water temperature T ini,w ; it should be noted that the latter datapoint is considered as a control variable. This model is updated during the execution of the control algorithm, and the effect of disturbances T o , T ri on the system's output is considered; there is therefore no need to enter them into the control algorithm. The computational burden is thus reduced. As the model is updated, the adaptive constrained GPC controller can adequately control the system perturbation by neutralizing disturbances and converging the output to the reference signal. G e,i is the transfer function that has been estimated online during the control for each AHU (Fig. 7). The degree of the transfer function is assumed to be equal to 3. This model has been estimated using the RLS algorithm [41]. ( ) is the vector of the estimated parameters, which consist of the discrete transfer function parameters G e,i . K(t) is the Kalman filter coefficient vector, Pe(t) is the covariance matrix, and 1 ( ) is the regression matrix, which consists of measured output and control input signals. Finally,  is the forgetting factor: In this section main goal is to control the output air temperature (Tsa,i ) of each AHU. The proposed adaptive constrained generalized controller has been applied on estimated transfer function equation (16) that has been estimated online using dynamic recurrent neural network (that has been investigated in section II) control input variable (H/E inlet water Tini,w) and model output (Tsa,i). The reference value for output (Tsa,ref) and recirculation air temperature (Tri) have been considered using simulation dataset in [3]. Other variables used are from the real system dataset [4]. Outlet water temperature (Touti,w) only is used to increase the accuracy of the overall model and close the estimated model to real system application. It also has been used in section IV for energy consumption calculation.

B. AHU OUTLET AIR HUMIDITY AND FLOW CONTROL, AND ENERGY CONSUMPTION OPTIMIZATION
The ventilation system's ability to maintain the humidity of the ventilated areas within the standard range is one of the essential points that should be considered because it is a crucial criterion for creating thermal comfort. The purpose is to keep the outlet airflow , of each air conditioner constant and also to keep the relative humidity , of the outlet air within the range specified by ASHRAE [42]. The humidity and output airflow rate has been controlled using the fan and a recirculation air damper system (Figure 3). An equation for the relative humidity percentage and airflow rate of the output air of each AHU is given below as per the instructions of [33] :  (17) In this section, according to the real system dataset and (17), just is known. The values of the other variables are unknown. To demonstrate the optimal constrained controller's ability to control the system, the values of the unknown variables , have been chosen to be within the range that will ensure that the assumed value for every AHU capacity and its outlet airflow (1700 3 . ℎ , 0.583 . −1 ) track the reference with accuracy [3]. These variables are random values in specific ranges.
is also a random value, and its range has been chosen according to ASHRAE standards. The main goal of this work is to reduce the energy consumption of each AHU over the period of one year. In the constrained optimal controller implemented in this section, the cost function contemplates the total power of the H/E as well as the fan and damper system. Humidity and exhaust airflow are controlled so that, in addition to maintaining their value within the specified range, the power consumption of the system is also minimized. According to "Fan laws" in [34,43], the overall form of the fan power can be specified in the HVAC design with this equation: For the H/E, the power consumption can be expressed as: The optimal constrained controller ( Fig. 7)  This controller has been simulated in MATLAB, and the "fmincon" algorithm has been used for optimization. The results are shown in Fig. 10.

IV. DISCUSSION OF CONTROLLER SIMULATION RESULTS
In section 3.1, the adaptive constrained GPC has been applied to each AHU. The controller parameters (P, M, and the degree of Ge in the transfer function) play an essential role in the volume of the controller calculations. In this work, these parameters are selected such that the computational load and dimensions of the controller matrices ( , , Ω) are minimized. In contrast, the controller can properly manage the outlet air temperature of each AHU. These parameters, the weight matrices Q and U, and the constraint related to the changes of the control signal (∆ . ) are determined by repeating the system simulation over a period of one year and reviewing the results to obtain a favorable response are shown in Fig 8. The control signal constraint ( . ) is also determined by the results of section 2. Figure 2 shows that the outlet air temperature ( sa,i ) of each AHU is well converged to the reference signal ( sai,ref ). The temperature of the inlet and outlet water of the H/E ( . , , ) have also been determined. Figure 3 shows that the parameters of the conversion function that are estimated online converge rapidly to a constant value when the control algorithm is executed. The poles of the model are also located within the unit circle, indicating that the closed-loop system is stable (Fig 9) . In section 3.2, the constrained optimal controller is implemented on the system to control the relative humidity and airflow of each AHU; the minimization of the energy used by each air conditioner is also considered. The power consumption of the H/E is calculated using the difference between its inlet and outlet water temperatures, which is added to the power consumption of the airflow and humidity control system eq (20). The dataset used in this system is that of a ventilation system in a country with four distinct seasons that range from hot to cold, which further emphasizes the importance of optimizing the ventilation system's energy consumption. This simulation was performed over a period of one year with a sampling time of 300 seconds, which was chosen based on the real system dataset in [4]. The energy consumption of the air conditioning system was calculated and compared with the energy consumption published in [3], which was calculated using the overall energy consumption equation; the two studies were performed in similar conditions. The results are given in Table 2. The simulation results show a return of more than 54%. This study is based on a simulation. It is important to explain how to implement this control system on the real system. The implementation can be done in two ways: adaptive and nonadaptive. In the non-adaptive mode, data related to the closed-loop system of the ventilated areas are collected. In the next step, the reference signal temperature of the AHU outlet is determined. After collecting this data, the inlet and outlet water temperatures are estimated by measuring the actual parameters of the H/E. In the temperature control section, the model of the dynamic neural networks is estimated using the data collected from the system. In this case, this neural network acts as the controller. Then, the only computational load is in the section that controls the humidity and exhaust airflow. In the non-adaptive mode, if the system's operating conditions change, the model needs to be re-estimated. In the adaptive mode, the system is more resilient to real system disturbances because the transfer function model used in the temperature controller is estimated online based on the inlet water temperature and the outlet air temperature. This method has a higher computational load, but it provides better system stability.
Efforts have also been made to minimize the computational burden. One of the disadvantages of MPC is its computational load, which necessitates robust hardware. Arduino-based boards can be used to control each AHU by sending commands and collecting the data of the measured variables. For larger buildings, PLC-based hardware can be used. It is also possible to implement the proposed control algorithm on a central PC using MATLAB software and its Arduino toolbox. This study uses a Windows laptop with Intel Corei7-4702MQ CPU, 12 GB of ram, and the MATLAB and Simulink software. The total simulation time with a sampling time of 300 seconds and 102,980 total samples was about six hours, or about 0.21 seconds for each sequence in the adaptive mode.

V. CONCLUSION
Optimizing the energy consumption of ventilation systems is one of the most important challenges that should always be considered in smart buildings. In this article, in addition to keeping the temperature and humidity of the ventilation system's AHUs within the desired thermal comfort range, we also attempt to minimize each AHU's energy usage by investigating the consumption of their components. The dynamic neural network model of the water-to-air H/E is estimated using real data, data obtained from the simulation of a ventilation system with four AHUs, and the proposed dynamic model of the water-to-air H/E. The adaptive constrained generalized predictive controller has also been implemented on the H/E model to improve the system output's convergence to the reference value as well as the system's response to disturbances and possible changes in its parameters; the stability of the system is thus bolstered. In the design of this controller, an attempt has been made to minimize the computational load by simplifying the model on which it is implemented. The results show that the AHUs' energy consumption is reduced by more than 54%.