IMAC Team 2 - Improved Efficiency Final Report December 2006

Appendix H: Vehicle Algorithm Page 1 of 13

Appendix IMAC2 – H: Vehicle Algorithm

Control System Overview

The control algorithm was designed to maintain cabin comfort and optimize system COP. 

While providing cabin comfort energy needs are reduced by controlling compressor 

capacity to a desired evaporator air temperature (EAT), controlling the EXV to minimal

superheat, and optimizing recirculation air use (reducing load). 

Three operating regions were defined:

 First a pulldown region where the compressor is operated at full displacement to 

maximize capacity. The EXV is originally set to 8°C superheat during the 

pulldown transient to minimize sending liquid to the compressor. The make up 

air door is set to full recirculation of cabin air. 

 The second region is a frost protection region in which the compressor 

displacement is reduced to maintain an evaporator exit air temperature of 2°C to 

avoid evaporator freeze up. The expansion valve is adjusted to 2°C to provide 

optimal efficiency during steady conditions. 

 The third region is a comfort region where it is desired to control the evaporator 

air exit temperature to 2°C less than lowest the target air outlet temperature. This 

allows for maximum compressor displacement reduction while maintaining 

occupant comfort as calculated by the automatic control target air outlet 

temperature determined by the HVAC control head / microprocessor. It also 

prevents the vent outlet temperature from dipping below the target which 

eliminates the need for the vehicle computer to add reheat. Superheat is controlled 

to 2°C for maximum COP during steady conditions. In this region, the 

recirculation door is controlled to maximize recirculation while still providing 

sufficient outside air for occupant safety and comfort.
IMAC Team 2 - Improved Efficiency Final Report December 2006

Appendix H: Vehicle Algorithm Page 2 of 13

 A summary of control inputs and outputs are shown below.

Expansion Valve Control

The expansion valve consists of a stepper motor which takes 680 steps to go from a fully 

open to fully closed position. The valve is controlled using a designed driver circuit that 

controls each valve motor coil individually, software controls the four valve motor coils 

to open and close the valve at a rate of 80 steps per second. The valves mechanical stop 

is at the full closed valve position. During an ignition off event, the valve is driven 

beyond fully closed (to ensure it has hit its stop) and then returned to the normal startup 

position. The expansion valve operates in four stages shown in the plot below. The first 

is a startup stage where the valve is at a predefined start position. The second is a pull 

down and transient stage where the PID is set to maintain a superheat of 8°C. The 

transient operating stage is defined as the first 5 minutes of operation and any time where 

the superheat has varied more than 4°C from the setpoint in the last 30 seconds. The 

third is a stable region where the superheat is controlled to 2°C. The optimal superheat 

for capacity and COP is 2°C as shown in the main body of this report. This is 

accomplished in the stable region. Oscillations in superheat have been observed during 

transient periods which can cause liquid to go to the compressor if the superheat setpoint 

were too low thus the superheat is controlled to 8°C during pulldown and transient 

operation. The final stage is shutdown where the valve returns to the predefined start 

point after being re-zeroed. 
IMAC Team 2 - Improved Efficiency Final Report December 2006

Appendix H: Vehicle Algorithm Page 3 of 13

The expansion valve is controlled by a PID controller where the desired superheat is 

determined based on the diagram above and the actual superheat is feed back to 

determine the error. The controller is linearized for the effect of high to low side pressure 

drop and the very nonlinear behavior of the EXV.

Max

Open

Start Pull down transient 

region

Max

Close

Stable - efficiency 

maximization

t1 t2 t3

Time

Shutdown

Start Position
IMAC Team 2 - Improved Efficiency Final Report December 2006

Appendix H: Vehicle Algorithm Page 4 of 13

Compressor Control

The compressor is controlled using a PID controller. The displacement is controlled 

based on a desired evaporator exit air temperature which is set by at offset from the 

interior target air temperature which is determined by the vehicle chassis computer. The 

offset is set to 2 degrees below the lowest target air temperature which should result in 

temperatures approaching the targets while preventing the vehicle from adding reheat. A 

safety switch has also been added to ramp down the compressor displacement if the 

discharge pressure exceeds the prescribed limit at any given speed. The control diagram 

is shown below.
IMAC Team 2 - Improved Efficiency Final Report December 2006

Appendix H: Vehicle Algorithm Page 5 of 13
IMAC Team 2 - Improved Efficiency Final Report December 2006

Appendix H: Vehicle Algorithm Page 6 of 13

Recirculation Door Control

The recirculation door is controlled to allow the necessary outside air intake for occupant 

comfort and safety. While maintaining safety and comfort recirculation air is maximized

to obtain the highest capacity and lowest compressor power as explained in the vehicle 

discussion (reference the main body of the report, vehicle section). One cycle is shown 

below which has been programmed in, but the set-points are made to be easily changed 

based on the comfort and safety guidelines of the manufacturer. The recirculation door 

control has been designed to set full recirculation during pull-down when maximum 

capacity is required, and then to allow the required outside air following the pull down 

period.

Recirculation door position

0.0%

10.0%

20.0%

30.0%

40.0%

50.0%

60.0%

0 1000 2000 3000 4000 5000

Time after pulldown (s)

D

o

or p

o

sitio

n

 

Real Time Estimates of COP and Capacity

COP is estimated real time as is shown in the Simulink block diagram below. The 

following diagrams also show the capacity and compressor power calculations used in the 

COP calculation. 
IMAC Team 2 - Improved Efficiency Final Report December 2006

Appendix H: Vehicle Algorithm Page 7 of 13

The refrigerant mass flow and compressor power regression implementation are shown in 

the following Simulink diagram. 
IMAC Team 2 - Improved Efficiency Final Report December 2006

Appendix H: Vehicle Algorithm Page 8 of 13

The capacity is then calculated in the following block diagram where the refrigerant mass 

flow rate is multiplied by the change in enthalpy across the evaporator. The enthalpies 

are determined from the measured refrigerant properties using polynomials fit over the 

range of operating conditions.
IMAC Team 2 - Improved Efficiency Final Report December 2006

Appendix H: Vehicle Algorithm Page 9 of 13

Software Model Implementation

The software model is divided into four layers: 

1. the hardware input output (HWIO) layer, 

2. the software integration (SWIL) layer,

3. the application layer, and 

4. the operating system (OS) layer. 

The HWIO layer is the lowest level in the system. It includes a digital output block, 

analog output block, digital input block, analog input block, and a CAN bus signals block 

shown below.
IMAC Team 2 - Improved Efficiency Final Report December 2006

Appendix H: Vehicle Algorithm Page 10 of 13

The analog and digital variables are then sent to the software integration layer which 

comprises general service utilities. This layer contains blocks to condition the analog and 

digital inputs to convert the variables to engineering units. In addition this layer has an 

AC calculations block in which the mass flow and compressor power regressions are 

implemented and many other A/C system calculations are performed. The SWIL also 

converts output signals from engineering units to voltages, checks for sensor faults, and 

contains the EXV stepper motor driver. The main blocks are shown below.
IMAC Team 2 - Improved Efficiency Final Report December 2006

Appendix H: Vehicle Algorithm Page 11 of 13
IMAC Team 2 - Improved Efficiency Final Report December 2006

Appendix H: Vehicle Algorithm Page 12 of 13

The application layer is the highest level of the system. It includes estimate and 

management of COP, management of the compressor control, and initialization and 

management of the EXV control. The main blocks are shown below.
IMAC Team 2 - Improved Efficiency Final Report December 2006

Appendix H: Vehicle Algorithm Page 13 of 13

The operating system layer performs startup and shutdown tasks for all controllers at 

ignition on and ignition off.

The Simulink program containing all layers and system calculations is compiled and used 

in the DSpace Control Desk to control the A/C system. It is also flashed to the Micro 

Autobox to control the A/C system when the DSpace Control Desk is not being used.