scieee AI-readable full text Open interactive document viewer

Non-Linear Model Predictive Control of Cabin Temperature and Air Quality in Fully Electric Vehicles

Glos, Jan; Otava, Lukáš; Václavek, Pavel

Abstract

This article describes an application of Non-linear Model Predictive Control algorithms on energy efficient control of fully electric vehicle cabin temperature and air quality. Since fully electric vehicles can not utilize waste heat from a powertrain (or there is not enough waste heat) as ICE vehicles do, it is necessary to employ advanced control approaches (especially for cabin heating) due to the possible mileage lost by using energy from the batteries for cabin conditioning. The basic idea behind this is to avoid the heat losses caused by excessive air exchange and to ensure a satisfactory air quality in combination with a user defined temperature. The Non-linear Model Predictive control algorithms were successfully implemented into an Infineon AURIX Tricore microcontroller and tested within a Processor in the Loop simulation.

Full text

1216 IEEE TRANSACTIONS ON VEHICULAR TECHNOLOGY, VOL. 70, NO. 2, FEBRUARY 2021 Non-Linear Model Predictive Control of Cabin Temperature and Air Quality in Fully Electric Vehicles Jan Glos , Lukáš Otava , and Pavel Václavek , Senior Member, IEEE Abstract—This article describes an application of Non-linear Model Predictive Control algorithms on energy efficient control of fully electric vehicle cabin temperature and air quality. Since fully electric vehicles can not utilize waste heat from a powertrain (or there is not enough waste heat) as ICE vehicles do, it is necessary to employ advanced control approaches (especially for cabin heating) due to the possible mileage lost by using energy from the batteries for cabin conditioning. The basic idea behind this is to avoid the heat losses caused by excessive air exchange and to ensure a satisfactory air quality in combination with a user defined temperature. The Non-linear Model Predictive control algorithms were successfully implemented into an Infineon AURIX Tricore microcontroller and tested within a Processor in the Loop simulation. Index Terms—Air quality control, battery electric vehicle, extended kalman filter, fully electric vehicle, non-linear model predictive control, temperature control, vehicle cabin model. NOMENCLATURE COP Coefficient of Performance EKF Extended Kalman Filter EV Electric Vehicle FEV Fully Electric Vehicle FMU Functional Mockup Unit HVAC Heating, Ventilation, and Air Conditioning HX Heat Exchanger ICE Internal Combustion Engine ISR Interrupt Service Routine MCU Microcontroller unit MIL Model in the Loop MPC Model Predictive Control NMPC Non-linear Model Predictive Control Manuscript received February 17, 2020; revised July 30, 2020 and November 10, 2020; accepted January 17, 2021. Date of publication January 25, 2021; date of current version March 10, 2021. This work was supported in part by the project H2020 653514 OSEM-EV—“Optimised and Systematic Energy Management in Electric Vehicles,” and project LQ1601 CEITEC 2020, in part by the infrastructure of RICAIP that has received funding from the European Union’s Horizon 2020 Research and Innovation Program under Grant Agreement 857306 and from the Ministry of Education, Youth and Sports under OP RDE under Grant Agreement CZ.02.1.01/0.0/0.0/17 043/0010085. The review of this article was coordinated by Dr. E. Velenis. (Corresponding author: Jan Glos.) Jan Glos and Lukáš Otava are with the CEITEC - Central European Institute of Technology, Brno University of Technology, Brno 61200, Czech Republic (e-mail: [email protected]; lukas.otav[email protected].cz). Pavel Václavek is with the CEITEC - Central European Institute of Technology, and also with the Faculty of Electrical Engineering and Communication, Brno University of Technology, Brno 61200, Czech Republic (e-mail: pavel.vacla[email protected].cz). Digital Object Identifier 10.1109/TVT.2021.3054170 OCP Optimal Control Problem PHEV Plug-in Hybrid Electric Vehicle PIL Processor in the Loop PTC Positive Temperature Coefficient (heater) SIL Software in the Loop cSpecific heat capacity CHeat capacity fFrequency GThermal conductance HState-space representation output matrix IElectric current ˙mMass flow rate PPower consumption QHeat ˙ QHeat flow rate QWeighting matrix rState-space representation references vector TTemperature uState-space representation input vector UVoltage VVolume ˙ VVolume flow rate WWork xState-space representation state vector zState-space representation output vector ρVolumetric mass density κAir quality I. INTRODUCTION FULLY electric vehicles (FEV) require special approaches for cabin heating, as the classical solution adapted from internal combustion engine (ICE) vehicles is not satisfactory from the perspective of energy consumption. ICE vehicles utilize waste heat from the ICE for cabin heating. The ICE’s tank- to-wheel efficiency is usually 20% to 40%, and approximately 30% of total energy can be used for cabin heating [1]–[3]. If we consider a petrol ICE, the energy density is 34.2MJl−1. For city driving with an average speed of 40 kmh−1and an average fuel consumption of 8 l/100 km, there is an available thermal flow of 9 kW on average for cabin heating. On the other hand, the electric vehicle (EV) powertrain has a much higher overall efficiency (67% to 82%), with approx. 10% to 25% converted to waste heat [4]. As a result, the EV This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ GLOS et al.: NON-LINEAR MODEL PREDICTIVE CONTROL OF CABIN TEMPERATURE AND AIR QUALITY IN FULLY ELECTRIC VEHICLES 1217 generates a maximum waste heat flow rate of approx. 0.85 kW to 2 kW under the same conditions as for the ICE vehicle above. Moreover, part of this thermal flow is from a low potential source, as the batteries temperature can not be higher than approx. 30 ◦Cto40 ◦C. Thus, the coolant temperature will be even lower and the use for cabin heating is quite complicated. The waste heat recovery makes sense in combination with the use of a heat pump system, which would elevate the temperature for cabin heating. It needs to be mentioned that waste heat recovery for EVs is not state-of-the-art technology, and there is no common understanding among the manufacturers. Current EVs use positive temperature coefficient (PTC) heaters, air to water heat pumps, or their combination, as a heat source [5]. Regardless of the heat source, a cabin heating system needs to be powered from batteries and the power consumption negatively influences the mileage of the EV. An extremely unpleasant choice can occur when the user needs to decide if the EV will heat the cabin or reach its destination. This paper proposes a partial solution to this problem. The basic goal is to keep the range of the EV as long as possible, which means minimizing the energy needed for cabin heating. This target can be achieved by multiple methods, and preferably by their combination rminimizing the cabin thermal losses through walls and windows (insulation etc.) rminimizing the thermal losses through cabin ventilation rimprovement of the heat source (e.g., from a PTC heater with a coefficient of performance (COP) of 1.0, to a heat pump with a COP of 1.5 to 3) rwaste heat recovery from the electric motor, power electronics and battery rutilization of thermal energy storage (based on phasechange material) This work is focused on the second bullet point, and brings an increased range to the EV by minimizing the heat losses through ventilation, using advanced control of the cabin heating actuators. The other bullet points require complex changes to a vehicle, especially in mechanical design, obviously with influence on the electrical system, thermal management system and also the control algorithms. However, the benefits of proper ventilation and the heating control approach should be the highest (compared to other methods, where the major benefits mostly come from proper design), so the paper is focused on this method. It is obvious that with full cabin air recirculation, minimal heat requirements would be achieved. Nevertheless, this approach can not be used, as no fresh air will be supplied to the cabin and thus the air quality will be deteriorated by means of a higher carbon dioxide (CO2) concentration. High concentrations of CO2can lead to driver (and also passenger) fatigue [6]. Moreover, the cabin air humidity can increase and under some conditions windows can get fogged, leading to a limited driver view. Both these problems can negatively influence the driver comfort and attention, which could in the worst case cause an accident. Fig. 1. Heat required by a heating system for cabin heat build-up during a 30 minute drive (conditions defined in Table I). Fig. 2. Heat flow rate needed for cabin heating in a steady state (conditions defined in Table I) In this article, the C-segment passenger car (or its equivalent, like the US compact car) is considered to have a cabin compartment volume of 3000 l and length of approx. 4.5 m. As a first preview to the required thermal flows for vehicle cabin heating, we performed a set of simulations, whose results are presented in Figs. 1 and 2. We evaluate the results using three variables. First, κstands for the cabin air quality, which is dependent on HVAC fan speed and fresh air flap setting. The second and third variables are used to measure the heat supplied into the cabin (which needs to be generated from electric energy in batteries by a heat pump or PTC and thus affects the EV range). We use a heat requirement Qas a variable describing total thermal energy provided into the cabin during some period (30-minute drive including heat build-up in Fig. 1). Then we use variable heat flow rate ˙ Qto show the instantaneous steady-state heating power required to compensate the thermal losses of the cabin with keeping the cabin temperature at the defined reference temperature. The simulations were executed in Dymola, based on the model described in Section II-E, with constant controls (apart from the heat source and fresh air flap) and ambient conditions, defined in Table I. In Fig. 1, there is the heat required for cabin heat build-up during a 30 minute drive presented. All the vehicle parts were initially at the ambient temperature and then we started heating 1218 IEEE TRANSACTIONS ON VEHICULAR TECHNOLOGY, VOL. 70, NO. 2, FEBRUARY 2021 TABLE I ACTUATORS AND CONDITIONS FOR BASIC CABIN THERMAL FLOW SIMULATIONS up the cabin, and this process was repeated for different settings of the fresh air flap ϕ∈{0,10,25,50,75,100}(%).This setting was kept constant during the individual simulation runs and the results for the dependent variables of all the runs are shown in Fig. 1. It is evident that both the required heat and the resulting cabin air quality are strongly dependent on the fresh air flap setting. Then, two important conclusions can be obtained from Fig. 1: 1) The fresh air flap - needs to be kept above approx. 25% to achieve satisfactory cabin air quality (κ≈1000 ppm; considering 2 passengers and ˙mc=0.07 kgs−1; with possible short-term lower values of the fresh air ratio) 2) A heat source in the order of kW (e.g., 4 kW to 8 kW) is needed for cabin heat build-up (note: even all the waste heat from an EV powertrain is not sufficient). Then we introduce Fig. 2, which presents the steady-state heat flow rate dependency on the fresh air flap setting. It is evident that the fresh air flap can not be entirely closed (full recirculation) and that the heat flow rate is highly dependent on its value. Regarding the influence of cabin heating on vehicle range, in the worst case (under conditions defined in Table I), the heat source would consume approx. 2.3 kWh per cabin heat build-up and 3 kWh per each hour of driving, with a higher air mass flow rate the power consumption would be also higher. For a mid-size EV (such as a Mercedes B, Nissan Leaf) that means a loss of mileage by 7.6% due to cabin heat build-up and 10% per each hour of operation. This model case didn’t take into account the power consumption of the fan and coolant pump, a possible lower ambient temperature, heat losses in the engine compartment, and other influences that might make the range loss even higher. The conclusion from this analysis is that cabin heating can have a strong negative influence on EV range. At this point, we should summarize the requirements on cabin environment control: 1) Temperature - keep it at a (user) defined reference 2) Air quality - keep it at a reasonable value (approx. 600 ppm to 1000 ppm, short time up to 1500 ppm) 3) Power consumption - minimize power of the heat source, fan and coolant pump 4) Noise - keep the fan speed as low as possible The controlled system control inputs are constrained, moreover, its internal states and outputs are constrained too (e.g., supply air temperature should not exceed 60 ◦C, coolant temperature 90 ◦C, etc.). Considering the above requirements, one of the preferable control approaches is Non-linear Model Predictive Control (NMPC). The traditional control approaches introduce a high number of additional control references, switching between control scenarios (e.g., heat build-up, steady-state, etc.), and complicated state constraints compliance. Moreover, the system has four inputs, two outputs, significant cross-couplings between inputs, and outputs and power consumption optimization is required. In the end, the traditional control system would become overcomplicated, thus the NMPC approach is preferable from our perspective. Cabin thermal management algorithms using NMPC and linear-quadratic strategy were proposed in [7], where the authors assembled vehicle cabin and HVAC model (including humidity and carbon dioxide concentration), which they then used for algorithms design and verification by simulation. Model predictive control combined with the neural network was used in [8] for automotive compressor speed control and their solution brings substantial improvement of cabin temperature reference tracking and disturbance rejection. A hierarchical MPC scheme was proposed for combined cabin and battery thermal management in [9]. Their approach can cover different dynamics (relatively fast and slow) in the vehicle thermal management system. MPC combined with different forecast methods of passenger number was prepared in [10] for cabin temperature control of an electric bus. The Markov-chain based prediction gave them the lowest energy consumption of the HVAC system. Nonlinear model predictive control was used in [11] for vehicle cabin temperature control with evaporator temperature setpoint and blower speed as controlled variables. NMPC applied on Plug-in Hybrid Electric Vehicle (PHEV) thermal management (battery, charger and power electronics cooling) was successfully tested in a Software in the Loop (SIL) simulation [12] and then tested in the real environment [13]. Model predictive on-off control for cabin heating in ICE vehicles was developed and implemented in [14]. The HVAC system, including the heat pump, was successfully controlled by NMPC in [15] with NMPC running on an Intel i5 2.6 GHz quadcore processor of a laptop. The model of the automotive air-conditioning/refrigeration system with cargo was assembled in [16] and the authors showed that several different types of MPC controllers provide substantially better performance (in terms of power consumption and cargo temperature reference tracking) compared to the on/off controller. There are also several papers on cabin air quality and ventilation, such as [17], [18], but none of them links the air quality with power consumption for heating. The indoor air quality control is quite often used in building environment control, in combination with MPC, reported, for example by [19]. The authors of [20] proposed linear MPC for vehicle cabin heating, and in conclusion they call for considering cabin air recirculation in an MPC control strategy. GLOS et al.: NON-LINEAR MODEL PREDICTIVE CONTROL OF CABIN TEMPERATURE AND AIR QUALITY IN FULLY ELECTRIC VEHICLES 1219 Model predictive control is also widely used in different automotive applications, especially for fuel consumption reduction [21]–[24], path tracking [25], [26] and cruise control [27]– [29]. As far as we at best know, there is no implementation of NMPC in an automotive grade processor in series production for EV cabin heating with respect to cabin air quality. II. FEV HVAC DYNAMIC MODELS A vehicle cabin (complemented with an HVAC system) is quite complicated to be modelled from a thermal point of view. It consists of a high number of materials, including both the thermal insulants (foam, plastics etc.) and thermal conductors (metal, glass, etc.). There are also a lot of other influences on cabin thermal behaviour, such as the radiative thermal flow from the sun, passenger thermal flow, forced convection during driving, ventilation using windows, etc. Thus, the model describing all the above mentioned effects, and reflecting all the heat transfer types (like Dymola reference model in Section II-E), would be very complicated and not useful for NMPC design. Therefore, the structure of the model was simplified to represent a grey box model, where the structure is fixed and the parameters are guessed, or identified, and can be considered as lumped (e.g., the thermal flow through the cabin walls are represented by single thermal conductance Gc1, which has no representation in a real system, but is used as a cumulative variable). A. HVAC Thermal Model The simplified HVAC system in Fig. 3 can be described by the following set of equations Ch1 dTh1 dt=˙ Qh7 +˙ Qh5 −˙ Qh6,(1) Ch3 dTh3 dt=˙ Qh9 −˙ Qh8 −˙ Qh7,(2) Ch4 dTh4 dt=˙ Qh8 −˙ Qh9 +˙ Qh10,(3) where Cdenotes thermal capacity, Tstands for thermodynamic temperature, and ˙ Qis a general thermal flow rate. Heat exchanger 1 (HX1) is used as a condenser and the refrigerant is rejecting heat into the coolant with a temperature of Th4, and it is circulated by the coolant pump (P1). HX1 and the heat flow rate ˙ Qh10 could be replaced by another heat source (PTC, etc.) for a different application. The air is heated by the coolant in HX2 and then supplied to the vehicle cabin. The temperature of the cooled coolant at the HX2 outlet is denoted as Th3 and Th1 stands for a temperature of heated air. The air from the cabin (with a temperature of Tc1) can be exhausted outside or reused by operating a fresh air flap. The fresh air flap mixes the recirculated air from the cabin with the fresh air of temperature Th5 and the resulting air temperature at the flap outlet is marked as Th2. The air movement is assured by the HVAC fan (F1). We assume that the fan and pump speeds can be controlled and the heat flow rate ˙ Qh10 can be adjusted by compressor speed Fig. 3. FEV HVAC model. control (or, in general, by heat source control for a Positive Temperature Coefficient (PTC) heater, etc.). The heat flow rates from Fig. 3 can be expressed as ˙ Qh5 =˙mh1chTh2,(4) ˙ Qh6 =˙mh1chTh1,(5) ˙ Qh7 =Gh7(Th3 −Th1),(6) ˙ Qh8 =˙mh5ccoTh3,(7) ˙ Qh9 =˙mh5ccoTh4.(8) The heat flow rate between the coolant and the air in the HX2 is described by (6), what is the most simple expression of heat exchanger thermal flow rate, which is dependent on media temperatures and thermal conductance Gh7. The rest of the equations above are based on the Simplified Steady-Flow Energy Equation (SSFEE) from [30]. In the equations, ˙mh1 stands for the air mass flow rate caused by the HVAC fan, chis the air specific thermal capacity, ˙mh5 is the coolant mass flow rate caused by the coolant pump, and cco is the coolant specific thermal capacity. After substitution of (4–8) to (1–3), and minor modifications, a new set of equations can be obtained dTh1 dt=1 Ch1 [Gh7(Th3 −Th1)+ ˙mh1ch(Th2 −Th1)],(9) dTh3 dt=1 Ch3 [˙mh5cco(Th4 −Th3)−Gh7(Th3 −Th1)],(10) 1220 IEEE TRANSACTIONS ON VEHICULAR TECHNOLOGY, VOL. 70, NO. 2, FEBRUARY 2021 Fig. 4. FEV cabin thermal model. dTh4 dt=1 Ch4 [˙mh5cco(Th3 −Th4)+ ˙ Qh10],(11) Th2 =ϕTh5 +(1−ϕ)Tc1,(12) where ϕis the fresh air flap status (0 to 1) and it is used for mixing the fresh and recirculated air and computing the resulting temperature. The cabin model (represented by a block in the lower-left corner in Fig. 3) is described in detail in the following section. B. Cabin Thermal Model The cabin model overview can be found in Fig. 4. The model can be in general described by the following equations Cc1 dTc1 dt=˙ Qc1 +˙ Qc2 +˙ Qc5 +˙ Qc4 +˙ Qc3 −˙ Qc6,(13) Cc2 dTc2 dt=−˙ Qc3,(14) Cc3 dTc3 dt=−˙ Qc1 +˙ Qc7 +˙ Qc8,(15) Cc4 dTc4 dt=−˙ Qc2 +˙ Qc9,(16) where Tc1 is the cabin air temperature, Tc2 stands for a temperature of the cabin equipment (seats, dashboard, etc.), Tc3 is the temperature of the cabin walls, and Tc4 is the temperature of the windows. The thermal capacities Ccx are indexed in the same manner as the temperatures. The equations above can be then modified to the substituted form dTc1 dt=1 Cc1 [Gc1(Tc3 −Tc1)+Gc2(Tc4 −Tc1) +˙mccc(Th1 −Tc1)+ ˙ Qc4 +Gc3(Tc2 −Tc1)],(17) dTc2 dt=1 Cc2 [−Gc3(Tc2 −Tc1)],(18) dTc3 dt=1 Cc3 [−Gc1(Tc3 −Tc1)+ ˙ Qc7 +Gc8(Tc5 −Tc3)],(19) dTc4 dt=1 Cc4 [−Gc2(Tc4 −Tc1)+Gc9(Tc5 −Tc4)],(20) where ˙mc=˙mh1 and stands for the air mass flow rate through the cabin (caused by the HVAC fan), cc=chand is the air specific thermal capacity, ˙ Qc7 is the solar heat flow rate and ˙ Qc4 is the passenger heat flow rate. The cabin air inlet and outlet is described by ˙ Qc5 and ˙ Qc5, respectively, and then expressed using SSFEE (similarly as for HVAC model). The rest of the heat flow rates represent conductive, convective, and radiative thermal transfers between the cabin parts. For simplicity of the model, all the heat transfer types between two parts are aggregated into a single equation term, which is dependent on part’s temperatures and associated thermal conductance Gcx, where the index corresponds to the general heat flow rate index ( ˙ Qcx). The thermal conductances are generalized constants, which were identified and have no physical representation (can not be computed based on part materials and dimensions). C. Cabin Air Quality Model We can define the air quality in the most used form [31], i.e. as a ratio of CO2to the whole (cabin or any unit). The air quality can be expressed in percent or in ppm (commonly used for indoor air quality evaluation [31], [32]). The air quality model we developed consists of two components - human respiration and HVAC air exchange. The first component is modelled based on the fact, that during every inhale some amount of the air (of cabin air quality) is removed from the cabin and during the exhale, the same amount of the air (of deteriorated quality) is returned into the cabin. The second component describes the ventilation of the cabin similarly - HVAC air volume flow rate brings and takes away the air of different quality. Moreover, the ventilation performance is controlled by the fresh air flap. The behaviour of air quality inside a vehicle cabin can be described by Vdκ dt=npas ˙ Vres(κex −κ)+ϕ˙ VHVAC(κamb −κ),(21) where κis cabin air quality, κex the exhaled air quality, κamb the ambient air quality, ˙ Vres is respiratory volume flow rate, ˙ VHVAC the volume flow rate of the HVAC, npas is the number of passengers in the vehicle, ϕis the fresh air flap state (ϕ=1: only fresh air, ϕ=0: only recirculated air) and Vis the cabin volume. Respiratory volume flow rate can be computed as ˙ Vres =fresVres,(22) GLOS et al.: NON-LINEAR MODEL PREDICTIVE CONTROL OF CABIN TEMPERATURE AND AIR QUALITY IN FULLY ELECTRIC VEHICLES 1221 where fres =0.25 Hz is respiratory frequency and Vres = 0.0005 m3is respiratory volume [33], which leads to dκ dt=1 VnpasfresVres(κex −κ)+ϕ˙mc ρc (κamb −κ),(23) where ˙mcis the air mass flow rate defined in Section II-B and ρcstands for cabin air mass density. D. Overall Cabin and HVAC Model The resulting dynamic model of the FEV cabin and HVAC was prepared as a combination of the equations above ˙ x=f(x,u),(24) z=h(x),(25) with state (x), input (u) and output (z) vectors x=Tc1 Tc2 Tc3 Tc4 Th1 Th3 Th4 κ , u=˙mh5 ˙mc˙ Qh10 ϕ , z=zTc1 zTh1 zTh4 zκ ,(26) and f(·)stands for the right-hand sides of (9–11, 17–20, 23) and h(·)is a vector of the output functions. The output functions are linear, thus we can write z=h(x)=Hx,(27) where H=⎡ ⎢ ⎢ ⎢ ⎣ 10000000 00001000 00000010 00000001 ⎤ ⎥ ⎥ ⎥ ⎦ .(28) E. Cabin and HVAC Reference Model in Dymola A reference model of the FEV cabin and HVAC system was set up in Dymola using the ThermalSystems library, which was extended to suit the requirements (air quality modelling, additional temperature measurements). The Dymola model is significantly more complicated compared to the differential equations in previous subsections. The model was exported into a Functional Mockup Unit (FMU), which was then imported into the MATLAB Simulink environment using the FMUtoolbox [34]. The FMU represents a black box model of the cabin and HVAC system and is used as a substitution of a real FEV cabin and HVAC system for algorithms’ verification. An overview of the Dymola model is in Fig. 5, where the connectors were intentionally omitted to increase the clarity of the figure. F. Simplified Dynamic Model Verification The simplified cabin and HVAC thermal models (Sections II-A and II-B) were compared to the Dymola reference model (Section II-E). The results of the simulations are presented in Fig. 6 and Fig. 7. Fig. 5. Reference model of the cabin and HVAC in Dymola. Fig. 6. Simplified HVAC and cabin model verification against Dymola reference model during cabin heat build-up. In Fig. 6 a cabin heat build-up is shown. This simulation result is included to show the conformity of the simplified model and Dymola model on the long term horizon. The control inputs were kept constant during the whole simulation. We can see that there is a small inaccuracy of both the cabin air temperature 1222 IEEE TRANSACTIONS ON VEHICULAR TECHNOLOGY, VOL. 70, NO. 2, FEBRUARY 2021 Fig. 7. Simplified HVAC and cabin model verification against Dymola reference model for actuators’ changes. and supply air temperature at the time of 180 s, but the overall conformity of the models is satisfactory. In Fig. 7 there is a simulation showing actuators changes and the reaction of both the dynamic models. There are almost no significant deviations of the simplified model and the reference Dymola model. Thus we can conclude that the simplified model shows very good conformity to the reference Dymola model and it can be used for NMPC algorithm design. III. NMPC PROBLEM FORMULATION At each time step of the NMPC algorithm, an optimal control problem (OCP) needs to be solved [35] min JN(x0,u(·)) = N−1  k=0 l(xk,uk)−rk2 Q +lN(xN)−rN2 QN,(29) subject to x0=ˆ x0,(30) xk+1=f(xk,uk),(31) xlo k≤xk≤xup k,(32) ulo k≤uk≤uup k,(33) Fig. 8. HVAC fan and coolant pump current measurements and approximations. where l(·)and lN(·)are vectors of penalized variables, rkand rNstand for time-varying and final references, Qand QN are weighting matrices. Then xdenotes the discrete states, u the control input. Both the states and control inputs can be constrained by (32) and (33). To allow constraints on control changes and their penalization, the model was slightly modified. The controls u=[˙mh5 ˙mc˙ Qh10 ϕ]are now considered as additional states and we use a new controls vector Δu= [Δ ˙mh5 Δ˙mcΔ˙ Qh10 Δϕ]and the additional set of differential equations d dt ⎡ ⎢ ⎢ ⎢ ⎣ ˙mh5 ˙mc ˙ Qh10 ϕ ⎤ ⎥ ⎥ ⎥ ⎦ =⎡ ⎢ ⎢ ⎢ ⎣ Δ˙mh5 Δ˙mc Δ˙ Qh10 Δϕ ⎤ ⎥ ⎥ ⎥ ⎦ .(34) This approach allows us to define constraints on control input changes, which is important when considering real actuators such as the air flap, coolant pump, etc., which have a limited control input change rate. Moreover, it is possible to introduce penalization of these changes, as fast changes are not convenient (especially for mechanical actuators). The previously described change of control variables also ensures a zero steady-state error (offset free tracking), as shown, for example, in [36]. The model of the HVAC fan and coolant pump was calibrated on a test bench ( Fig. 9) with real components by measurement of their characteristics (with focus on power consumption). The resulting data are shown in Fig. 8 (labelled as “measured”). Then a formula describing the dependency of electric current on mass flow rate was found for each of these actuators, to allow their comparison (under a constant input voltage U=12 V). Both the fan and pump employ a fan load characteristic, which GLOS et al.: NON-LINEAR MODEL PREDICTIVE CONTROL OF CABIN TEMPERATURE AND AIR QUALITY IN FULLY ELECTRIC VEHICLES 1223 Fig. 9. FEV HVAC test bench (used for actuators’ electric current dependency calibration and power consumption assessment, not for experimental verification). means that motor torque is dependent on the squared angular speed, and the input power (and thus current) depends on the third power of angular speed. The volumetric flow rate and mass flow rate are approximately linearly dependent on the fan/pump motor angular speed. The HVAC fan electric current can be written as Ifan =afan(˙mfan)3,(35) where Ifan is the electric current of the HVAC fan, afan is a constant characterizing the fan and HVAC air distribution box (in our case, afan =6443). Then ˙mfan is the air mass flow rate through the fan. The coolant pump electric current can be described by Ipump =apump(˙mpump)3,(36) where Ipump is the electric current of the coolant pump, apump is a pump and pipes constant (in our case, apump =194), and ˙mpump is the coolant mass flow rate caused by the pump. The specific values of the fan and pump constants (afan and apump) were acquired by fitting the general formulae to measured electric current. The comparison of measured values and results from (35) and (36) are in Fig. 8, and the correspondence is satisfactory. From (35) and (36) it is evident that the penalization of the HVAC fan should be approximately thirty times higher compared to the coolant pump to ensure comparability of power consumption. To accomplish the basic goal of energy efficient control, the overall power consumption needs to be minimized. This can be computed as Pel =Pfan +Ppump +Pheat,(37) where Pel is overall electric power consumption, Pfan and Ppump are electric power consumptions of HVAC the fan and pump respectively, and Pheat stands for electric power consumption of the heat source utilized to provide heat flow ˙ Qh10. After minor modifications and substitutions, we can write Pel =U[afan(˙mc)3+apump(˙mh5)3]+ ˙ Qh10 COP ,(38) Fig. 10. Maximal power consumption of heating actuators, for a heat pump with COP =2 and maximal thermal power ˙ Qh10 =8000 W. Fig. 11. SIL simulation diagram. where U=12 Vis battery voltage and COP stands for coefficient of performance COP =|Q| W,(39) where Qis the heat supplied to the coolant and Wis the work required for that. If we consider purely electric heating, COP = 1, for heat pump systems, we expect COP ∈(1.5,3). The contribution of actuators to overall electric power consumption is illustrated in Fig. 10 for maximal values of actuators speed (causing maximal power consumption). In this example heat pump system is considered, if the PTC heater was a heat source, its percentage would be much higher. The resulting vectors of penalized variables are l(xk,uk)=x lu lΔu l ,(40) lN(xk)=x lu l ,(41) where penalized state vector is xl=Rxxk,(42) penalized controls vector ul=Ruuk,(43) and penalized controls change vector Δul=RΔuΔuk,(44) with Rbeing the helper scaling matrices. The weighting matrices Qand QNwere initially set up with respect to (38), and then fine-tuned considering the user 1224 IEEE TRANSACTIONS ON VEHICULAR TECHNOLOGY, VOL. 70, NO. 2, FEBRUARY 2021 comfort point of view - the fan speed penalization was increased. Thus, the weighting matrices were slightly changed to fulfill all the requirements defined in Section I. As a result, the power consumption would probably not be the optimal, but we can reach a satisfactory suboptimal trajectory of the system with accomplishment of the user requirements. The following set of state constraints was introduced 0≤Th4 ≤273.15 +90 (K),(45) 0≤Th1 ≤273.15 +60 (K),(46) which represent the maximum allowed temperatures of coolant and supplied air respectively. The control constraints 0.04 ≤˙mh5 ≤0.42 (kg s−1),(47) 0.03 ≤˙mc≤0.17 (kg s−1),(48) 0≤˙ Qh10 ≤8000 (J s−1),(49) 0≤ϕ≤1(−),(50) respect the real possibilities of the considered system. The coolant and air mass flow rates were measured on our test bench (Fig. 9), the heat flow rate is a guessed value for a heat pump system and can be adjusted based on the heating device (heat pump, PTC, etc.). The fresh air ratio range is derived from its definition. Then we also introduce constraints on the control changes −0.05 ≤Δ˙mc≤0.05 (kg s−2),(51) −0.05 ≤Δ˙mh5 ≤0.05 (kg s−2),(52) −400 ≤Δ˙ Qh10 ≤400 (J s−2),(53) −0.1≤Δϕ≤0.1(s−1),(54) which also respect the real system capabilities, such as maximum possible fan and pump acceleration, fresh flap speed, etc. We introduce the reference vector r=r xr ur Δu (55) with state references rx, controls references ruand controls change references rΔu rx=rTc1 00000rTh4 0rκ ,(56) ru=0000  ,(57) rΔu =0000  ,(58) where rTc1 is the cabin temperature reference, rκis the cabin air quality reference and, rTh4 is the coolant temperature reference. The sampling rate was chosen as Ts=0.5sto cover the fastest dynamics in the controlled system. In combination with a prediction horizon N=20,we get a prediction time of 10 s. The ACADO toolkit [37] (including MATLAB interface) was used for implementation in MATLAB/Simulink, and also for C/C++ code generation. A multiple shooting technique [38] was used for discretization of the continuous-time model. A quadratic programming solver, qpOASES [39], employing an active-set method [40], was used to solve the optimization problem. IV. EXTENDED KALMAN FILTER The Extended Kalman Filter (EKF) from [41] was used to allow current system states estimation, as they are needed for NMPC computations. The part of the state variables from (26) can be directly measured (cabin air temperature Tc1, supply air temperature Th1, heated coolant temperature Th4, and cabin air quality κ), the rest of the temperatures (four of them) needs to be estimated by EKF. A discrete-time system model xk=f(xk−1,uk−1)+wk,(59) zk=h(xk)+vk,(60) is needed for both the phases (prediction and update) of the EKF. The model described above was discretized using the Euler method in order to get a discrete-time model of the vehicle cabin and HVAC system. Then we use the following equations for the prediction phase of the EKF ˆ x− k=f(xk−1,uk,0),(61) P− k=Fk−1Pk−1F k−1+Qk−1,(62) and the second set of equations for the update phase Kk=P− kH(HP− kH+R)−1,(63) ˆ xk=ˆ x− k+Kk(zk−Hˆ x− k),(64) Pk=(I−KkH)P− k,(65) where ˆ x− kand ˆ xkare the a priori and a posteriori state estimates respectively, P− kand Pkare the a priori and a posteriori estimate error covariance matrices, Fk−1is the Jacobian of function f(·), Qk−1stands for the process noise covariance matrix, Kkis the Kalman gain, Ris the measurement error covariance matrix. As the function h(·)is linear, the last term in (64) was reduced to the product of matrix Hand the a priori state estimate ˆ x− k (compared with the standard h(ˆ x− k,0)term). The ambient temperature (Th5 =Tc5) can be considered as a measured disturbance, since this variable behaves as an input to our models (can change in time, it is not a constant, but we can not influence its value). Thus, we incorporate it as a measured state with a zero time derivative and its value is obtained by the EKF. The following equation was added to the set of the differential equations dTc5 dt=0,(66) where Tc5 is the ambient temperature. V. SIMULATIONS The simulations described within this section were realized in the MATLAB/Simulink environment. The cabin and HVAC model was exported from Dymola into the Functional Mockup Unit (FMU) exchange format and then