dynamic modeling and model predictive control of a vapor

152
Institutionen för systemteknik Department of Electrical Engineering Examensarbete Dynamic modeling and Model Predictive Control of a vapor compression system Examensarbete utfört i Reglerteknik vid Tekniska högskolan vid Linköpings universitet av Andreas Gustavsson LiTH-ISY-EX--12/4552--SE Linköping 2012 Department of Electrical Engineering Link¨ opings universitet SE-581 83 Link¨ oping, Sweden Link¨ opings teknisk a h¨ ogskola Link¨ opings universitet 581 83 Link¨ oping

Upload: doanphuc

Post on 01-Jan-2017

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Dynamic modeling and Model Predictive Control of a vapor

Institutionen för systemteknik Department of Electrical Engineering

Examensarbete

Dynamic modeling and Model Predictive Control of a vapor compression system

Examensarbete utfört i Reglerteknik vid Tekniska högskolan vid Linköpings universitet

av

Andreas Gustavsson

LiTH-ISY-EX--12/4552--SE

Linköping 2012

Department of Electrical Engineering Linkopings universitet SE-581 83 Linkoping, Sweden

Linkopings tekniska hogskola

Linkopings universitet 581 83 Linkoping

Page 2: Dynamic modeling and Model Predictive Control of a vapor
Page 3: Dynamic modeling and Model Predictive Control of a vapor

Dynamic modeling and Model Predictive Control of a vapor compression system

Examensarbete utfört i Reglerteknik vid Tekniska högskolan vid Linköpings universitet

av

Andreas Gustavsson

LiTH-ISY-EX--12/4552--SE

Handledare: Patrik Axelsson ISY, Linköpings Universitet

Joakim Lundkvist Regin AB

Examinator: Daniel Axehill ISY, Linköpings Universitet Linköping, 28 March, 2012

Page 4: Dynamic modeling and Model Predictive Control of a vapor
Page 5: Dynamic modeling and Model Predictive Control of a vapor

Avdelning, Institution Division, Department

Division of Automatic Control Department of Electrical Engineering Linköpings universitet SE-581 83 Linköping, Sweden

Datum Date

2012-03-28

Språk Language

Svenska/Swedish

Engelska/English

. .

Rapporttyp Report category

Licentiatavhandling

Examensarbete

C-uppsats

D-uppsats

Övrig rapport .

. .

ISBN

ISRN LiTH-ISY-EX--12/4552--SE

Serietitel och serienummer ISSN Title of series, numbering — .

URL för elektronisk version

http://www.control.isy.liu.se

http://www.ep.liu.se

Titel Dynamisk modellering och modellbaserad prediktionsreglering av kylmaskin Title Dynamic modeling and Model Predictive Control of vapor compression system

Författare Andreas Gustavsson Author

Sammanfattning Abstract

The focus of this thesis was on the development of a dynamic modeling capability for a vapor compression system along with the implementation of advanced multivariable control techniques on the resulting model. Individual component models for a typical vapor compression system were developed based on most recent and acknowledged publications within the field of thermodynamics. Parameter properties such as pressure, temperature, enthalpy etc. for each component were connected to detailed thermodynamic tables by algorithms programmed in MATLAB, thus creating a fully dynamic environment. The separate component models were then interconnected and an overall model for the complete system was implemented in SIMULINK. An advanced control technique known as Model Predictive Control (MPC) along with an open-source QP solver was then applied on the system. The MPC-controller requires the complete state information to be available for feedback and since this is often either very expensive (requires a great number of sensors) or at times even impossible (difficult to measure), a full-state observer was implemented. The MPC-controller was designed to keep certain system temperatures within tight bands while still being able to respond to varying cooling set-points. The control architecture was successful in achieving the control objective, i.e. it was shown to be adaptable in order to reflect changes in environmental conditions. Cooling demands were met and the temperatures were successfully kept within given boundaries.

Nyckelord Keywords Model Predictive Control, MPC, Vapor Compression Systems, Modeling

Page 6: Dynamic modeling and Model Predictive Control of a vapor
Page 7: Dynamic modeling and Model Predictive Control of a vapor

v

Abstract

The focus in this work is on the development of a dynamic modeling capability for a vapor compression system along with the implementation of advanced multivariable control techniques based on the resulting model. Individual component models for a typical vapor compression system were developed based on most recent and acknowledged publications within the field of thermodynamics. Parameter properties such as pressure, temperature, enthalpy etc. for each component were connected to detailed thermodynamic tables by algorithms programmed in MATLAB, thus creating a fully dynamic environment. The separate component models were then interconnected and an overall model for the complete system was implemented in SIMULINK. An advanced control technique known as Model Predictive Control (MPC) along with an open-source QP solver was then applied on the system. The MPC-controller requires the complete state information to be available for feedback and since this is often either very expensive (requires a great number of sensors) or at times even impossible (difficult to measure), a full-state observer was implemented. The MPC-controller was designed to keep certain system temperatures within tight bands while still being able to respond to varying cooling set-points. The control architecture was successful in achieving the control objective, i.e. it was shown to be adaptable in order to reflect changes in environmental conditions. Cooling demands were met and the temperatures were successfully kept within given boundaries.

Sammanfattning

Fokus under denna uppsats har legat på utveckling av en dynamisk modell av en kylmaskin samt implementering av modellbaserad prediktionsregling på den resulterande modellen. Matematiska modeller för varje enhet av kylmaskinen härleds separat baserat på artiklar och rapporter publicerade inom området termodynamik. Enhetsparametrar såsom tryck, temperatur, entalpi länkas till termodynamiska tabeller via algoritmer programmerade i MATLAB för att skapa en dynamisk simuleringsmiljö. De individuella enheterna kopplas sedan samman till ett komplett system och implementeras i SIMULINK. En reglerstrategi känd som modellbaserad prediktionsreglering appliceras därefter tillsammans med en QP-lösare baserad på öppen källkod på systemet. Reglerstrategin kräver att den fullständiga tillståndsvektorn är tillgängligt för återkoppling och eftersom detta är oftast antingen väldigt dyrt (kräver många sensorer) eller till och med omöjligt (svårt att mäta) implementeras en observatör. Regulatorn designas att hålla vissa systemtemperaturer inom bestämda intervall och samtidigt kunna hantera förändrade referensvärden för kylkapaciteten. Regulatorstrukturen var framgångsrik för kontrolluppgiften, det vill säga att den effektivt kunde hantera omgivande miljöförändringar. Given kylmängd levererades samtidigt som systemtemperaturer hölls inom givna områden.

Page 8: Dynamic modeling and Model Predictive Control of a vapor

vi

Page 9: Dynamic modeling and Model Predictive Control of a vapor

vii

Acknowledgments

First of all, I would like to thank Lennart Spiik for giving me the opportunity to conduct

this thesis at Regin AB. I also would like to thank my supervisor, Joakim Lundkvist, for

all his support during my time at the office in Kållered.

Likewise I would like to thank my supervisor at LiU, Patrik Axelsson, for his advice and

guidance and particularly for all the time he has spent reading and responding to all my

emails. Furthermore, I would like to thank my examiner, Daniel Axehill, for his interest

and support throughout the thesis.

I would also like to give a special thanks to my great friend Robert Palmér for his

enthusiastic support and for always being willing to assist and help despite having a

busy schedule himself.

Finally, I would like to thank my family and my girlfriend for always believing in me and

especially for all their support during difficult times.

Linköping, March 2012

Andreas Gustavsson

Page 10: Dynamic modeling and Model Predictive Control of a vapor

viii

Page 11: Dynamic modeling and Model Predictive Control of a vapor

ix

Content

List of figures ................................................................................................................................................. xiii

List of tables .................................................................................................................................................. xvii

List of nomenclature ................................................................................................................................ xviii

Compressor ............................................................................................................................................. xviii

Electronic Expansion Valve ............................................................................................................... xviii

Evaporator and Condenser ............................................................................................................... xviii

Subscripts ..................................................................................................................................................... xx

Superscripts ................................................................................................................................................ xx

1 Introduction .............................................................................................................................................. 1

1.1 Object ..................................................................................................................................................... 2

1.2 Outline ................................................................................................................................................... 2

2 Background ............................................................................................................................................... 3

2.1 Introduction ........................................................................................................................................ 3

2.2 Vapor compression system ........................................................................................................... 3

2.2.1 Overview ..................................................................................................................................... 3

2.2.2 Operation .................................................................................................................................... 6

2.2.3 System used in this thesis .................................................................................................... 7

3 Modeling ..................................................................................................................................................... 8

3.1 Introduction ........................................................................................................................................ 8

3.2 Modeling assumptions .................................................................................................................... 8

3.3 Compressor ...................................................................................................................................... 10

3.3.1 Mass flow ................................................................................................................................. 10

3.3.2 Enthalpy change .................................................................................................................... 13

3.4 Electronic expansion valve ......................................................................................................... 14

3.4.1 Mass flow ................................................................................................................................. 15

Page 12: Dynamic modeling and Model Predictive Control of a vapor

x

3.5 Evaporator model .......................................................................................................................... 16

3.5.1 Two phase region ................................................................................................................. 17

3.5.1.1 Conservation of refrigerant mass ......................................................................... 17

3.5.1.2 Conservation of refrigerant energy ...................................................................... 20

3.5.1.3 Conservation of tube wall energy ......................................................................... 26

3.5.2 Superheat region ................................................................................................................... 27

3.5.2.1 Conservation of refrigerant mass ......................................................................... 27

3.5.2.2 Conservation of refrigerant energy ...................................................................... 29

3.5.2.3 Conservation of tube wall energy ......................................................................... 34

3.5.3 Overall mass balance of evaporator .............................................................................. 35

3.5.4 State-space representation ............................................................................................... 36

3.6 Condenser model............................................................................................................................ 38

3.6.1 Subcool region ....................................................................................................................... 38

3.6.1.1 Conservation of refrigerant mass ......................................................................... 38

3.6.1.2 Conservation of refrigerant energy ...................................................................... 40

3.6.1.3 Conservation of tube wall energy ......................................................................... 44

3.6.2 Superheat region ................................................................................................................... 46

3.6.2.1 Conservation of refrigerant mass ......................................................................... 46

3.6.2.2 Conservation of refrigerant energy ...................................................................... 48

3.6.2.3 Conservation of tube wall energy ......................................................................... 53

3.6.3 Two phase region ................................................................................................................. 54

3.6.3.1 Conservation of refrigerant mass ......................................................................... 54

3.6.3.2 Conservation of refrigerant energy ...................................................................... 57

3.6.3.3 Conservation of tube wall energy ......................................................................... 62

3.6.4 Overall mass balance of condenser ............................................................................... 63

3.6.5 State-space representation ............................................................................................... 65

Page 13: Dynamic modeling and Model Predictive Control of a vapor

xi

4 Nonlinear model ................................................................................................................................... 68

4.1 Introduction ..................................................................................................................................... 68

4.2 Component interconnection ...................................................................................................... 68

4.3 Simulation ......................................................................................................................................... 70

5 Model linearization ............................................................................................................................. 72

5.1 Introduction ..................................................................................................................................... 72

5.2 Mathematical method ................................................................................................................... 72

5.3 Computer software method ....................................................................................................... 79

5.4 Linear model analysis ................................................................................................................... 81

6 Controller Design ................................................................................................................................. 84

6.1 Introduction ..................................................................................................................................... 84

6.2 Model Predictive Control ............................................................................................................ 84

6.2.1 Overview .................................................................................................................................. 84

6.2.2 The MPC framework ............................................................................................................ 86

6.2.3 MPC formed as a quadratic programming problem ................................................ 89

6.2.4 MPC with reference tracking ............................................................................................ 90

6.2.5 MPC with integral action.................................................................................................... 91

6.2.6 Constraints .............................................................................................................................. 94

6.2.6.1 Control signals .............................................................................................................. 94

6.2.6.2 Controlled outputs ...................................................................................................... 96

6.2.7 QP-solver .................................................................................................................................. 98

6.3 Observer ............................................................................................................................................ 99

7 Result ......................................................................................................................................................103

7.1 Introduction ...................................................................................................................................103

7.2 Choice of parameters ..................................................................................................................103

7.2.1 Sampling time, ................................................................................................................103

7.2.2 Horizons, and ..........................................................................................................104

Page 14: Dynamic modeling and Model Predictive Control of a vapor

xii

7.2.3 Weighting matrices, and .....................................................................................105

7.3 Simulation .......................................................................................................................................105

7.3.1 MPC without integral action ...........................................................................................105

7.3.2 MPC with integral action..................................................................................................107

7.3.3 Controlled outputs constraints .....................................................................................108

7.3.4 Observer .................................................................................................................................110

7.3.5 qpOASES-solver ...................................................................................................................112

7.3.6 Disturbance performance ................................................................................................114

7.3.7 Three simulation scenarios ............................................................................................116

7.3.7.1 Scenario 1 .....................................................................................................................116

7.3.7.2 Scenario 2 .....................................................................................................................118

7.3.7.3 Scenario 3 .....................................................................................................................120

8 Conclusions ..........................................................................................................................................123

9 Future work .........................................................................................................................................124

Bibliography .................................................................................................................................................125

Page 15: Dynamic modeling and Model Predictive Control of a vapor

xiii

List of figures

Figure 2.1 An oil refineriy and the Smart car - different areas in which a vapor

compression system can be found. Source [22]. ................................................................................. 3

Figure 2.2 Overview of a vapor compression system. ..................................................................... 5

Figure 2.3 Pressure-enthalpy diagram of the vapor compression cycle. ................................. 5

Figure 3.1 Pressure-Volume diagram. ................................................................................................ 11

Figure 3.2 Pressure-Specific volume diagram. ................................................................................ 11

Figure 3.3 Compressor volumes............................................................................................................ 12

Figure 3.4 Electronic expansion valve. Source [22]....................................................................... 15

Figure 3.5 Evaporator regions. .............................................................................................................. 16

Figure 3.6 Condenser regions. ............................................................................................................... 38

Figure 4.1 The SIMULINK model for expansion valve mass flow. ............................................ 68

Figure 4.2 Subsystem for calc rho_cout. ............................................................................................. 69

Figure 4.3 Nonlinear SIMULINK model of the vapor compression system. ......................... 70

Figure 4.4 Evaporator pressure, varying compressor speed. .................................................... 71

Figure 4.5 Evaporator superheat, varying compressor speed .................................................. 71

Figure 4.6 Evaporator pressure, varying expansion valve opening. ....................................... 71

Figure 4.7 Evaporator superheat, varying expansion valve opening. .................................... 71

Figure 5.1 Overview of the vapor compression system. .............................................................. 77

Figure 5.2 Part of the evaporator model showing the To Workspace block. ...................... 80

Figure 5.3 Evaporator Pressure with band-limited white noise added to compressor. A

zoomed in part is given in the lower right corner. .......................................................................... 82

Figure 5.4 Evaporator Superheat with band-limited white noise added to compressor. A

zoomed in part is given in the lower right corner. .......................................................................... 82

Figure 5.5 Evaporator Pressure with band-limited white noise added to expansion

valve. A zoomed in part is given in the lower right corner. ......................................................... 83

Page 16: Dynamic modeling and Model Predictive Control of a vapor

xiv

Figure 5.6 Evaporator Superheat with band-limited white noise added to expansion

valve. A zoomed in part is given in the lower right corner. ......................................................... 83

Figure 6.1 MPC scheme. ............................................................................................................................ 85

Figure 6.2 The complete system showing the observer block with its inputs and output.

...........................................................................................................................................................................100

Figure 6.3 Observer subsystem. ..........................................................................................................100

Figure 7.1 Pressure step response with 10% increase in compressor setting. ................104

Figure 7.2 Superheat step response with 10% increase in compressor setting. .............104

Figure 7.3 Pressure step response with 10% increase in expansion valve setting.........104

Figure 7.4 Superheat step response with 10% increase in expansion valve setting. .....104

Figure 7.5 Trajectory tracking of evaporator pressure without integral action. .............106

Figure 7.6 Evaporator superheat without integral action. .......................................................106

Figure 7.7 Compressor control signal. ..............................................................................................106

Figure 7.8 Expansion valve control signal. ......................................................................................106

Figure 7.9 Trajectory tracking of evaporator pressure with integral action. ....................107

Figure 7.10 Evaporator superheat with intergral action. .........................................................108

Figure 7.11 Compressor control signal. ...........................................................................................108

Figure 7.12 Expansion valve control signal. ...................................................................................108

Figure 7.13 Evaporator pressure with and without superheat constraints. .....................109

Figure 7.14 Evaporator superheat with and without superheat constraints. ..................109

Figure 7.15 Compressor control signal with and without superheat constraints. ..........110

Figure 7.16 Expansion valve control signal with and without superheat constraints. .110

Figure 7.17 Evaporator pressure with and without observer. ...............................................111

Figure 7.18 Evaporator superheat with and without observer. .............................................111

Figure 7.19 Compressor control signal with and without observer. ....................................112

Figure 7.20 Expansion valve control signal with and without observer. ............................112

Page 17: Dynamic modeling and Model Predictive Control of a vapor

xv

Figure 7.21 Comparison between first system state and first observer state. .................112

Figure 7.22 Difference between system states and observer states. ....................................112

Figure 7.23 Exitflags from the simulation. ......................................................................................113

Figure 7.24 Number of iterations needed for QP solutions using either cold or warm

start. .................................................................................................................................................................114

Figure 7.25 Evaporator pressure with noise added to the output. .......................................115

Figure 7.26 Evaporator superheat with noise added to the output. .....................................115

Figure 7.27 Compressor control signal when noise is added to system outputs. ...........115

Figure 7.28 Expansion valve control signal when noise is added to system outputs. ...115

Figure 7.29 Value of exitflag when noise is added to the output. ..........................................116

Figure 7.30 Number of iterations needed for QP solution using either cold or warm

start. .................................................................................................................................................................116

Figure 7.31 Evaporator pressure and pressure reference for scenario 1. .........................117

Figure 7.32 Evaporator superheat and with and without superheat constraints for

scenario 1 ......................................................................................................................................................117

Figure 7.33 Compressor control signal. ...........................................................................................118

Figure 7.34 Expansion valve control signal. ...................................................................................118

Figure 7.35 Value of exitflag. ................................................................................................................118

Figure 7.36 Number of iterations. ......................................................................................................118

Figure 7.37 Evaporator pressure and pressure refrence for scenario 2. ............................119

Figure 7.38 Evaporator superheat with and without superheat constraints for scenario

2. ........................................................................................................................................................................119

Figure 7.39 Compressor control signal. ...........................................................................................120

Figure 7.40 Expansion valve control signal. ...................................................................................120

Figure 7.41 Value of exitflag. ................................................................................................................120

Figure 7.42 Number of iterations needed. Note that the number of iterations needed for

qpOASES is around 60 in the beginning. ...........................................................................................120

Page 18: Dynamic modeling and Model Predictive Control of a vapor

xvi

Figure 7.43 Evaporator pressure with pressure reference for scenario 3. ........................121

Figure 7.44 Evaporator superheat with and without superheat constraints for scenario

3. ........................................................................................................................................................................121

Figure 7.45 Compressor control signal. ...........................................................................................122

Figure 7.46 Expansion valve control signal. ...................................................................................122

Figure 7.47 Value of exitflag. ................................................................................................................122

Figure 7.48 Number of iterations. Note the that the number of iterations needed for

qpOASES is around 60 in the beginning. ...........................................................................................122

Page 19: Dynamic modeling and Model Predictive Control of a vapor

xvii

List of tables

Table 1.1 2006 Energy consumption per capita. Source [2]. ........................................................ 1

Table 3.1 Matrix elements of . ............................................................................................... 37

Table 3.2 Matrix elements of . ................................................................................................ 66

Table 4.1 Thermodynamic properties for Solvay Flour Solkane R134a. .............................. 69

Table 5.1 Steady state control settings. .............................................................................................. 80

Page 20: Dynamic modeling and Model Predictive Control of a vapor

xviii

List of nomenclature

Compressor

: Volume

: Clearance ratio

: Pressure

: Mass flow

: Density

: Compressor displacement

: Compressor speed

: Compressor control setting

: Polytrophic coefficient

: Isentropic coefficient

: Temperature

: Enthalpy

: Entropy

Electronic Expansion Valve

: Mass flow

: Mass flow rate coefficient

: Area

: Density

: Pressure

: Valve control setting

Evaporator and Condenser

: Cross-sectional area inside of tube

: Heat transfer coefficient

: Thermal capacitance

Page 21: Dynamic modeling and Model Predictive Control of a vapor

xix

: Inside diameter of tube

: Outside diameter of tube

: Void fraction

: Enthalpy

: Length

: Mass flow rate

: Pressure

: Density

: Temperature

: Velocity

: Quality

Page 22: Dynamic modeling and Model Predictive Control of a vapor

xx

Subscripts

: Evaporator

: Condenser

: Inlet

: Outlet

: Intermediate

: Vapor

: Liquid

: Total

: Wall

: Region

: Numbering for different regions of the evaporator and condenser

Superscripts

: Average value

: Estimated value

: Derivative with respect to time

Page 23: Dynamic modeling and Model Predictive Control of a vapor

1

1 Introduction

Vapor compression systems are widely used all over the world for both heating and

cooling. A common area of use is air-conditioning where the aim for the technique is to

lower the temperature and provide comfort cooling and dehumidification. It is

extensively used in offices, private residences, hotels, hospitals and automobiles but is

also an important component in domestic and industrial refrigerators such as large-

scale warehouses for chilled or frozen storage of food. There is a great interest both

from the industry and the academic world in the development of control-oriented

modeling of vapor compression systems. Only in the United States, 10.2 billion dollars

was spent for household air-condition devices in 1997 [1] and the total energy demand

in the United States has continued to grow ever since. The high-level of energy

consumption is observed in Europe, and especially Sweden, as well. An illustration from

2006 showing the energy consumption per capita is given in Table 1.1.

Table 1.1 2006 Energy consumption per capita. Source [2].

0

5000

10000

15000

20000

25000

30000

35000

kW

/cap

Page 24: Dynamic modeling and Model Predictive Control of a vapor

2

Traditionally, chlorofluorocarbons (more known as Freons) have been extensively used

as refrigerants in vapor compression systems. Their environmental impact and part in

ozone depletion is widely known, therefore an increased efficiency in the operation of

these systems will in other words be appealing not only from an economical but also

from an environmental point of view.

1.1 Object

The purpose of this thesis can be divided into two parts; modeling and controller design.

In the first part, the goal is to develop a model capable of accurately predicting the

dynamics associated with a vapor compression system. Before the controller design

begins, the model is implemented in MATHWORKS’ SIMULINK. The controller design is then

focused on a technique called Model Predictive Control (MPC) which is a model-based

control method. One of the major advantages with the method compared to for example

Linear Quadratic Control is the possibility for explicit handling of input, output and state

constraints. These features along with other properties of MPC are investigated and

analyzed for the purpose of controlling a vapor compression system.

1.2 Outline

A background to the components of a vapor compression system and how they work is

given in Chapter 2. The mathematical equations governing the different system

components are presented in Chapter 3. The separate components are interconnected to

create an overall, nonlinear model in Chapter 4 and a simplified, linearized version more

suitable for MPC is derived in Chapter 5. The controller design is explained in Chapter 6

and to finish this thesis the result, conclusion and future work is given in Chapter 7, 8

and 9 respectively.

Page 25: Dynamic modeling and Model Predictive Control of a vapor

3

2 Background

2.1 Introduction

As mentioned in the previous chapter, vapor compression system is a popular, if not the

most popular, type of refrigeration cycle when it comes to air-conditioning. It can be

found in areas ranging from large-scale industries such as oil refineries and chemical

processing plants to the extremely small city car Smart, see Figure 2.1. Refrigeration

may be defined as a process in which the temperature of an enclosed space is lowered

by removal of heat. The heat can obviously not just disappear, i.e. the heat must be

transported somewhere else. How this is achieved, along with a detail explanation of the

components of a vapor compression system and their functions are given in the sections

to come.

2.2 Vapor compression system

2.2.1 Overview

A vapor compression system is a thermodynamic machine which uses a compressible

fluid (more known as refrigerant) to transfer heat from one place to another. Often

fluorocarbons are used as refrigerants and the reason for this is because of their

favorable thermodynamics properties such as low boiling points, high heat of

Figure 2.1 An oil refinery and the Smart car - different areas in which a vapor compression system can be found. Source [22].

Page 26: Dynamic modeling and Model Predictive Control of a vapor

4

vaporization and a moderate density in liquid form in combination with a comparatively

high density in gaseous form. The refrigerant undergoes several phase changes during

an operating cycle and the different refrigerant states are subcool, liquid-vapor and

superheat. In the first state, subcool, the refrigerant is cooled below its saturation point.

Because of the surrounding pressure in the heat exchangers the refrigerant never

freezes despite temperatures below the saturation point, thus remaining in liquid-form.

The second state is a mix of liquid and vapor and it is from now on referred to as the two

phase state. In the same way as the refrigerant can be subcooled the refrigerant can also

be heated above its vaporization temperature. This is the third and last refrigerant state

and is also known as superheat. A vapor compression system can be utilized both for

heat generation and to provide cooling, however it is only the cooling application that

will be discussed in this thesis. Vapor compression systems suit almost all applications

with refrigeration capacities ranging from just a few watts up to megawatts. The

simplest vapor compression systems operates with four components; compressor,

condenser, expansion valve and evaporator. An illustration of the cycle is given in Figure

2.2 and corresponding pressure-enthalpy diagram is given in Figure 2.3. Worth noting is

that the different phases in Figure 2.3 are simplifications of the phase changes in an

actual system. Standard assumptions for modeling simplicity are made including

adiabatic compression with isentropic efficiency, isobaric conditions in the condenser

and evaporator along with isenthalpic expansion through the valve.

Page 27: Dynamic modeling and Model Predictive Control of a vapor

5

Subcool Two-phase Superheat

Condenser

Evaporator

Two-phase Superheat

Compressor Expansion valve

Heat out

Heat in

Figure 2.2 Overview of a vapor compression system.

Figure 2.3 Pressure-enthalpy diagram of the vapor compression cycle.

Evaporation

Compression

Condensation

Expansion

Pre

ssu

re

Enthalpy

1-2: Isentropic compression (entropy is constant). 2-3: Isobaric heat rejection (pressure is constant). 3-4: Isenthalpic expansion (enthalpy is constant). 4-1: Isobaric heat extraction (pressure is constant).

Page 28: Dynamic modeling and Model Predictive Control of a vapor

6

The vapor compression cycle starts with the isentropic compression where the

refrigerant enters the compressor as a superheated vapor at low pressure. The

refrigerant is compressed into a high-pressure refrigerant and as the pressure rises the

same happens to the refrigerant temperature. The fluid leaves the compressor as

superheated vapor at high pressure and enters the condenser. In the condenser the

refrigerant has a higher temperature than the secondary fluid surrounding the

condenser. Isobaric heat rejection then takes place where the refrigerant condenses into

a subcooled liquid as heat is transferred to the secondary fluid. The refrigerant exits the

condenser and enters the expansion valve, still at high pressure. As the fluid passes

through the expansion valve a phase change from liquid to two-phase takes places and

the pressure is gradually lowered. Since the pressure was decreased by the passage

through the expansion device, the refrigerant temperature has been lowered. This

results in the refrigerant having a lower temperature than the secondary fluid

surrounding the evaporator. As the refrigerant flows through the evaporator, heat is

transferred to it and it gradually begins to evaporate. In the isobaric heat extraction the

refrigerant becomes completely vaporized and as heat continues being transferred from

the secondary fluid, the refrigerant heats above its vaporization temperature and

becomes superheated. The refrigerant consequently exits the evaporator as superheated

vapor and then enters the compressor and the cycle is repeated.

2.2.2 Operation

In order to provide as much cooling as possible the two-phase portion of the evaporator

needs to be maximized. The reason for why the two-phase region has to be maximized is

because of the much higher heat transfer coefficient between the two-phase refrigerant

and the secondary fluid compared to between vaporized refrigerant and the secondary

fluid. The phenomenon is discussed in [3], and in [4] it was shown that for the steady

state operating point the heat-transfer coefficient for the two-phase refrigerant was

approximately 2.8 kW/m2K in contrast to 0.3 kW/m2K for the superheated refrigerant.

This means that virtually all the cooling capacity of the system is provided by the two-

phase region. So why is not the goal to eliminate the superheat region completely and

only have the much more heat-transfer efficient two-phase region? The answer is the

compressor. The compressor is unable to compress liquid and since the two-phase

refrigerant is a mixture of liquid and vapor it is very likely that the compressor will

Page 29: Dynamic modeling and Model Predictive Control of a vapor

7

break unless the fluid entering the compressor is completely vaporized. So, to ensure

safe and reliable operation of the compressor it is necessary to have some amount of

superheat present in the evaporator. A reasonable level of superheat where the

evaporator performance is maximized without compromising the safety of the

compressor is about 5-6 degrees Celsius [3].

2.2.3 System used in this thesis

When this project started the goal was to create a dynamic model of a vapor

compression system, apply different control techniques on the model and finally

validate the theoretical work on an actual system. This system was to be built for this

particular project but because of a number of different reasons this was unfortunately

not possible within the time-frame of this thesis. It was consequently decided that this

thesis would be completely theoretical. The model in this thesis utilized thermodynamic

tables to recalculate and update system parameters during simulation. So in order to be

sure that the model derived in this thesis and the equations it relies on during

simulation are valid approximation of an actual system, system parameters and

simulation outcomes are compared to results given in [4]. More details about the model

and the equations used when deriving it are presented in the chapter that follows.

Page 30: Dynamic modeling and Model Predictive Control of a vapor

8

3 Modeling

3.1 Introduction

In this chapter the vapor compression system and its components are described and

mathematical models for each component are derived. The system being modeled is the

system described in chapter two and the derivation follows the methods used in [5], [4],

[3] and [6]. Mathematical models, based on the knowledge of underlying physics, for

each of the four components are derived separately. When modeling the heat

exchangers an integration rule known as Leibniz’s equation is used [7]. This rule is

especially useful when removing the spatial dependence with being the spatial

coordinate. In other words, the limits of integration are determined by the length of the

region being integrated over. The general Leibniz’s rule may be written as

∫ ( )

( )

( )

[ ∫ ( )

( )

( )

] ( ( ) ) ( ( ))

( ( ) )

( ( ))

(3.1)

Once equations are obtained they are rearranged and organized into a more suitable

form for controller design.

3.2 Modeling assumptions

A vapor compression system, even in the simplest case with only two heat exchangers, a

compressor and a valve, is a highly complex system. Difficulties when trying to derive

mathematical models for the intricate dynamics associated with refrigerant phase

changes are well documented in [8] and [5]. A vapor compression system is a stiff

system [9], meaning there are system dynamics with time scales differing by orders of

magnitude. A common technique to handle diverse time scales is to replace the fast

dynamics with static (algebraic) equations. Static and dynamic analysis of time

constants in a vapor compression system has been carried out in [3] and shows that the

dynamics associated with the actuators (compressor and valve) react much faster to

Page 31: Dynamic modeling and Model Predictive Control of a vapor

9

changes compared to the two heat exchangers. So in order to simplify the modeling the

dominant (slow) dynamics of the system are assumed to be connected to the two heat

exchangers while the dynamics linked to the actuators are modeled with static

relationships. As mentioned, the refrigerant undergoes several phase changes inside the

heat exchangers (two in the condenser and one in the evaporator). An important

assumption which significantly simplifies the modeling of these transitions is the use of

lumped parameter, moving boundary between the different fluid states [10]. This

assumption implies that the boundary is time-invariant and that parameters of interest

in each region are “lumped” together. The method is especially useful in a control point-

of-view since it generates relatively low order models. Included in the lumped

parameter approach is also the concept of mean void fraction. The void fraction is

defined as the ratio of vapor volume to total volume [11]. A number of experimental

correlations for estimating the void fraction have been suggested, some of which are

discussed in [12] and [13]. But as previously declared, a mean void fraction is used in

this thesis. The concept of a mean void fraction was originally proposed in [14] and the

main idea is the assumption of a time-invariant mean void fraction. This assumption

greatly reduces the number of equations needed to model the void fraction and the

approximation has been shown to be valid during most operating conditions [14]. Other

key assumptions for modeling simplicity are:

The cross-flow heat exchanger is assumed to be a long, horizontal tube.

The flow of the refrigerant is modeled as one-dimensional flow.

Axial conduction of heat for the refrigerant is negligible.

Each region has its own mean heat transfer coefficient.

Average tube wall temperatures are used and assumed uniform throughout the

thickness of the wall.

Pressure is assumed to be the same along the heat exchanger (thereby neglecting

pressure drops due to viscous friction and momentum change in refrigerant).

Time invariant mean void fraction is assumed.

The two phase region in the heat exchangers can be divided into a liquid and a

vapor part.

Page 32: Dynamic modeling and Model Predictive Control of a vapor

10

The average wall temperature at the intermediate between the

superheat/subcool and two phase region can be assumed to be the same as the

average wall temperature in the two phase zone.

Air temperature remains constant throughout the cross-flow heat exchanger and

is calculated as the average of the inlet and outlet temperatures.

The following sections involve more assumptions than mentioned above, however, new

assumptions are pointed out when being made.

3.3 Compressor

The compressor considered in this thesis is a variable speed compressor. By varying the

speed of the compressor the mass flow rate of the refrigerant is changed. Also, the

compression of refrigerant inside the compressor is not an isenthalpic process, i.e. there

is an enthalpy difference between the inlet and outlet of the compressor. To account for

these changes, two static relationships are used to model the compressor; a mass flow

equation and an enthalpy change equation.

3.3.1 Mass flow

The volumetric efficiency is defined as [15]

( (

)

) (3.2)

where is the polytrophic coefficient and the clearance factor. The compression is

assumed to be an isentropic process, i.e. the entropy remains unchanged. This

assumption also results in that the polytrophic coefficient can be replaced by the

isentropic exponent . The value of is taken from [16], thus . and

are the compressor inlet and outlet pressure respectively. A reciprocating compressor’s

compression cycle can be explained in a four-part sequence that occurs with each

advance and retreat of the piston (two strokes per cycle). The four parts of the cycle are

intake, compression, discharge and expansion and are represented by a, b, c and d

respectively in Figure 3.1. Figure 3.2 is an illustration of the same cycle as in Figure 3.1.

but with specific volume instead of volume on the x-axis. and in (3.2) are volumes

corresponding to the states and respectively in Figure 3.2.

Page 33: Dynamic modeling and Model Predictive Control of a vapor

11

The clearance factor is defined as the ratio of clearance volume to piston displacement

volume

(3.3)

where and is the valve clearance volume and total volume respectively (see

Figure 3.3 for illustration). If for some reason, the clearance ratio is unknown or difficult

vcl

c, d

4

b a 3

Specific volume

Pre

ssu

re

c, d

out

in a b

Specific volume

Pre

ssu

re

Pin

Pout

Figure 3.2 Pressure-Specific volume diagram.

b a

c d

Stroke

Pre

ssu

re

Pin

Pout

Stroke

Volume

Figure 3.1 Pressure-Volume diagram.

Page 34: Dynamic modeling and Model Predictive Control of a vapor

12

to calculate a reasonable estimation is 15% clearance [17]. This value for the clearance

ratio will be used in this thesis.

Figure 3.3 Compressor volumes.

According to [15] volumetric efficiency can also be defined as

(3.4)

where is the piston displacement in volume per unit of time, the compressor

speed, the compressor displacement and the refrigerant density at the compressor

inlet. The compressor displacement is found in the technical documentation from the

compressor manufacturing company [18]. The compressor speed for this particular

system is calculated based on the relationship given in [4] and can be expressed as

(3.5)

where is the maximum compressor speed and is also found in [18]. and

is the compressor control signal and compressor maximum control signal

respectively.

vtot

vcl

Page 35: Dynamic modeling and Model Predictive Control of a vapor

13

Combining (3.2) (3.5) the mass flow of the compressor may be defined as

(

)

( (

)

)

(3.6)

3.3.2 Enthalpy change

The difference between the compressor inlet and outlet enthalpy is discussed in [5] and

can be expressed as

(3.7)

where is the isentropic enthalpy. Both enthalpy and entropy are functions of

pressure and temperature. This means that once two or more of either enthalpy,

entropy, temperature or pressure are known, remaining parameters can be interpolated

using thermodynamic tables. In this thesis the thermodynamic table of choice is taken

from Solvay Flour [19]. The table and its content is discussed in more detail in Chapter 4.

The isentropic enthalpy is thus estimated by the following procedure:

1. let the compressor reach steady state

2. measure , and

3. interpolate from table since enthalpy is a function of pressure

and temperature, ( )

4. interpolate from table since entropy is a function of pressure

and enthalpy, ( )

5. interpolate from table since isentropic enthalpy is a

function of pressure and entropy, ( )

Page 36: Dynamic modeling and Model Predictive Control of a vapor

14

The isentropic efficiency coefficient may be expressed as [20]

(3.8)

where is the outlet temperature assuming an isentropic process. and are

the compressor inlet and outlet temperatures respectively. may in turn be written

as

(

)

(3.9)

where is the isentropic coefficient. The value of for R134a is discussed in [21] and

shown to be scattered in the interval of 1.15 to 1.16 for the temperature region

corresponding to the steady state condition. For this thesis the value of is chosen as the

mean value of this interval, i.e. 1.155.

The enthalpy change over the compressor can thus be expressed as

(3.10)

3.4 Electronic expansion valve

The expansion device considered for this thesis is an electronic expansion valve. An

illustration of a typical electronic expansion valve is given in Figure 3.4. By altering the

opening of the valve, the refrigerant mass flow rate can be changed. The flow through

the valve is assumed to be an isenthalpic process, i.e. the refrigerant enthalpy is

unchanged from the inlet to the outlet of the valve. One static relationship is thus used to

model the electronic expansion valve; a mass flow equation.

Page 37: Dynamic modeling and Model Predictive Control of a vapor

15

Figure 3.4 Electronic expansion valve. Source [22].

3.4.1 Mass flow

In order to estimate the mass flow rate through the expansion valve the model from [23]

is used

√ ( ) (3.11)

where is the mass flow rate coefficient, the orifice area, the refrigerant

density at the expansion valve inlet and and the condenser and evaporator

pressure respectively. Note that in order to obtain in kg/s, and need to be

defined in Pa.

The value for the mass flow rate coefficient is discussed in [24] and determined to be

scattered in the interval of 0.94 ± 0.04. The refrigerant density is assumed to remain

Page 38: Dynamic modeling and Model Predictive Control of a vapor

16

𝑥𝑒

𝑇𝑒𝑤 (𝑡) 𝑇𝑒𝑤 (𝑡)

��𝑒 𝑖𝑛 𝑒 𝑖𝑛

𝑥𝑒 > 0

𝐿𝑒 (𝑡) 𝐿𝑒 (𝑡)

𝐿𝑒𝑇

��𝑒 𝑜𝑢𝑡 𝑒 𝑜𝑢𝑡

Two phase Superheat

𝑃𝑒(𝑡)

unchanged by the passage through the valve, i.e. . The orifice area is

calculated based on the relationship given in [4]

(3.12)

where is the maximum orifice area and can be found in the technical

documentation provided by the manufacturer [25]. and are the valve

control signal and valve maximum control signal respectively.

The mass flow rate through the electronic expansion device may then be defined as

(

) √ ( ) (3.13)

3.5 Evaporator model

The derivation of the evaporator model is based on a combination of the results given in

[4], [5], [6] and [26]. The structure of the evaporator is assumed to be a lumped

parameter dynamic model with two types of fluid regions; a liquid-vapor section (from

now on referred to as the two phase region) and a superheated vapor section. The

boundary between these two regions is assumed to be a moving boundary and may thus

change depending on operating conditions. An illustration of the evaporator zones is

given in Figure 3.5.

Figure 3.5 Evaporator regions.

Page 39: Dynamic modeling and Model Predictive Control of a vapor

17

Mass and energy conservation for the different regions of the heat exchanger are

derived with help of generalized Navier-Stokes equations [27]:

Refrigerant mass

balance:

( )

0 (3.14)

Refrigerant energy

balance:

( )

( )

( ) (3.15)

Wall energy

balance: ( )

( ) ( ) (3.16)

These governing partial differential equations (PDEs) are in the following sections used

to obtain lumped parameter ordinary differential equations (ODEs) to model fluid

dynamics and relevant heat exchanger properties. In order to remove spatial

dependency, each term in (3.14) to (3.16) is integrated over the length of corresponding

region. After further simplifications, rearrangements and combinations of certain

parameters the resulting ODEs are structured into a form more known as state-space

form.

3.5.1 Two phase region

3.5.1.1 Conservation of refrigerant mass

The first term in the equation for refrigerant mass balance (3.14) is integrated over the

cross-sectional area. The left hand side of the equation below is denoted by and this

is done to make the derivation more structured and easier to follow.

[ (

)]

[ ( ( ) )]

(3.17)

where and is the cross-sectional area of saturated liquid and vapor respectively.

is the ratio of the cross-sectional area of saturated liquid to total cross-sectional area

Page 40: Dynamic modeling and Model Predictive Control of a vapor

18

and can therefore be replaced with . Applying the same way of thinking on

and the

term may be rewritten as ( ).

In order to remove the spatial dependency, (3.17) is integrated over the length of the

region and Leibniz’s rule is applied. Also note that the coefficient on the left hand side

now has a new number

[ ( ( ) )]

∫ [ ( ( ) )]

[ ( ( ) )] 0

[ ( ( ) )]

∫ [ ( ( ) )]

[ ( ( ) )]

(3.18)

Before performing the integration, let us study the equation above in more detail. The

last term in (3.18) is evaluated at the intermediate between the two phase and

superheat region. The refrigerant can then be assumed to be completely vaporized at

that location in the evaporator, i.e. the mean void fraction equals one

∫ [ ( ( ) )]

[ ( ( ) )]

∫ [ ( ( ) )]

(3.19)

Integrate and rearrange

∫ [ ( ( ) )]

[ ( ( ) )]

(3.20)

Page 41: Dynamic modeling and Model Predictive Control of a vapor

19

As the integration is carried out, the concept of mean void fraction is applied. This is the

reason for being replaced by in (3.20). Now apply the product rule

( )

( ) [

] [

]

[

( )

] [ ( ) ]

[ ( ) ] [ ( ) ]

(3.21)

The average density in node one can be rewritten with help of the mean void fraction as

( ) . Term one in the equation for refrigerant mass balance (3.14)

thus simplifies to

( )

(3.22)

As with the first term, the second term in the equation for refrigerant mass balance

(3.14) is also integrated over the cross-sectional area. A new coefficient, , is used to

mark that this is a derivation of a different term in (3.14).

[ (

)]

[ ( ( ) )]

(3.23)

Page 42: Dynamic modeling and Model Predictive Control of a vapor

20

Integrate over the length of the region and use the fact that for the vaporized part

of the region

[ ( ( ) )]

( ( ) )|

[ ( ( ) )]|

( ( ) ) ( ( ) )

(3.24)

Since the last term inside the square brackets in (3.24) is the result of the integration

over 0, i.e. at the inlet of the evaporator, that part may be denoted with the in subscript

[ ( ( ) )]

(3.25)

Term two in the equation for refrigerant mass balance (3.14) thus simplifies to

(3.26)

Combine the equations from the derivation of term one (3.22) and term two (3.26)

0

( )

0

(3.27)

Equation (3.27) can be rewritten since is pressure dependent ( ( )). The

conservation of refrigerant mass in the two phase region may thus be defined as

( )

(3.28)

3.5.1.2 Conservation of refrigerant energy

The first term in the equation for refrigerant energy balance (3.15) is integrated over the

cross-sectional area

Page 43: Dynamic modeling and Model Predictive Control of a vapor

21

( )

[

]

(3.29)

Replace the cross-sectional area ratios with the mean void fraction

[ ( ) ]

[ ( ) ]

(3.30)

Integrate over the length of the region and apply Leibniz’s rule

[ ( ) ]

∫ [ ( ) ]

[ ( )

] 0

[ ( )

]

(3.31)

Since the refrigerant is assumed to be completely vaporized for the vapor region, the

mean void fraction equals one

∫ [ ( ) ]

[ ( ) ]

∫ [ ( ) ]

(3.32)

Page 44: Dynamic modeling and Model Predictive Control of a vapor

22

Perform the integration and then rearrange

∫ [ ( ) ]

[ ( ) ]

( )

[ ]

[ ]

(3.33)

Use the product rule

( ) [

]

[

]

[ ( ) ]

[

( )

]

(3.34)

Rearrange once again and term one in the equation for refrigerant mass balance (3.15)

can be written as

[ ( ) ]

[

( )

]

(3.35)

Page 45: Dynamic modeling and Model Predictive Control of a vapor

23

The second term in the equation for refrigerant mass balance (3.15) is now integrated

over the cross-sectional area

( )

[

] (3.36)

Replace the cross-sectional area ratios with the mean void fraction

[ ( ) ] (3.37)

Integrate over the length of the region and use the fact that for the vaporized part

of the region

[ ( ) ]

[ ( ) ]|

[ ( ) ]|

[ ( ( ) )]

[ ( ( ) )]

[ ( ) ]

(3.38)

The last term in (3.38) is the result of the integration over 0, i.e. at inlet of the

evaporator. That part can thus be denoted with the in subscript

[ ( ) ]

[ ] (3.39)

Quality is defined as

(3.40)

Substituting the definition of quality into (3.39) results in

[( ) ]

[( ) ] (3.41)

Page 46: Dynamic modeling and Model Predictive Control of a vapor

24

Term two in the equation for refrigerant energy balance (3.15) thus simplifies to

(3.42)

The last term in the equation for refrigerant energy balance (3.15) is now integrated

over the cross-sectional area

( )

( )

( )

( )

(3.43)

Integrate over the length of the region and term three in the equation for refrigerant

mass balance (3.15) simplifies to

∫ ( )

( ) (3.44)

As the integration is carried out, the assumptions of mean heat transfer coefficient and

uniform wall temperatures are applied. This is the reason for , and being

replaced by , and respectively. Combining the resulting equations from the

derivation based on the equation for refrigerant energy balance (3.35), (3.42) and (3.44)

yields

[ ( ) ]

[

( )

]

( )

(3.45)

Page 47: Dynamic modeling and Model Predictive Control of a vapor

25

Rearrange

( )[ ]

[

( )

]

( )

(3.46)

Substitute using the result from (3.28) and the above equation may be written as

( )[ ]

[

( )

]

[

( )

]

( )

[( )( ) ( )]

[

( )

]

( ) ( )

(3.47)

The average density in node one can be rewritten with help of the mean void fraction

using ( ) . After substitution and rearrangement (3.47) is

simplified into

[( ) ( )]

[

( )

( )

( )

]

( ) ( )

(3.48)

Page 48: Dynamic modeling and Model Predictive Control of a vapor

26

In order to further simplify the expression, the definition of enthalpy of vaporization can

be used [28]. The conservation of refrigerant energy in the two phase region may then

be written as

[( ) ]

[

( )

]

( ) ( )

(3.49)

3.5.1.3 Conservation of tube wall energy

The first term in the equation for wall energy balance (3.16) is integrated over the

length of the region and Leibniz’s rule is used

∫ ( )

( )

( )

[

| 0

|

]

( )

[

]

(3.50)

Take advantage of the product rule and term one in the equation for wall energy balance

simplifies into

( )

[

] ( )

(3.51)

The second and third term in the equation for wall energy balance (3.16) are now

integrated over the length of the region

∫ ( ( ) ( ))

( ) ( )

(3.52)

Combining the resulting equations from the derivation in this section (3.51) and (3.52)

and the conservation of wall energy in the two phase region may be written as

Page 49: Dynamic modeling and Model Predictive Control of a vapor

27

( )

( ) ( )

(3.53)

3.5.2 Superheat region

3.5.2.1 Conservation of refrigerant mass

As for the equations associated to the two phase region, the first term in the equation for

refrigerant mass balance (3.14) is integrated over the cross-sectional area

(3.54)

Since the refrigerant never undergoes any phase transitions in the superheat region,

there is no need to extend the cross-sectional area into a liquid and vapor part. Now

integrate over the length of the region and apply Leibniz’s rule

∫ |

|

(3.55)

Since the total length is unchanging, the above derivative of with respect to time is

equal to zero. Applying the product rule on (3.55) results in

(3.56)

Again, the total length of the evaporator is constant, thus

( )

0 ⇔

(3.57)

Page 50: Dynamic modeling and Model Predictive Control of a vapor

28

Combining (3.56) and the result from (3.57) yields

(3.58)

After one last rearrangement, term one in the equation for refrigerant mass balance

(3.14) may be written as

( )

(3.59)

As with the first term, the second term in the equation for refrigerant mass balance

(3.14) is integrated over the cross-sectional area

(3.60)

Integrate over the length of the region

| |

(3.61)

where the first part in (3.61) is the result of the integration over , i.e. at the outlet of

the evaporator. Term two in the equation refrigerant mass balance (3.14) is finally

rewritten as

(3.62)

Combining (3.59) and (3.62) and the conservation of refrigerant mass in the superheat

region may be expressed as

( 0)

( )

0

(3.63)

Page 51: Dynamic modeling and Model Predictive Control of a vapor

29

3.5.2.2 Conservation of refrigerant energy

The first term in the equation for refrigerant energy balance (3.15) is integrated over the

cross-sectional area

( )

( )

(3.64)

Integrate over the length of the region and apply Leibniz’s rule

( )

∫ ( ) ( )|

( )|

∫ ( ) ( )

(3.65)

Simplifying the integration in (3.65) separately

∫ ( ) ∫ ( )

[ ( )] [ ( )]

[ ( )]

( )

(3.66)

Substituting the outcome of the integration into (3.65) results in

( ) ( )

(3.67)

Use the product rule

[

] [ ]

( )

(3.68)

Page 52: Dynamic modeling and Model Predictive Control of a vapor

30

Take advantage of the fact that the length of the evaporator is unchanging

( )

0 ⇔

(3.69)

Substitute into (3.68)

[

] [ ]

( )

[

] ( )

(3.70)

Apply the product rule again

[

] ( )

(3.71)

Now let us look at the equation previously derived for the conservation of refrigerant

mass in (3.63). The equation can be rearranged as

( )

[ ]

(3.72)

Substitute the equivalent term in (3.71)

[

]

[ ]

( )

[

]

( )

(3.73)

Page 53: Dynamic modeling and Model Predictive Control of a vapor

31

The enthalpy in the superheated region can be assumed to be an average of the inlet and

outlet enthalpies

(3.74)

Using the definition of average enthalpy in (3.73) yields

[0

]

( 0 0 )

(3.75)

Term one in the equation for refrigerant energy balance (3.15) thus simplifies into

[0

] 0

0 ( )

(3.76)

Term two in the equation for refrigerant energy balance (3.15) is now integrated over

the cross-sectional area

( )

( )

(3.77)

Integrate over the length of the region and term two in (3.15) simplifies into

( )

| |

(3.78)

Page 54: Dynamic modeling and Model Predictive Control of a vapor

32

The last term in the equation for refrigerant energy balance (3.15) is now integrated

over the cross-sectional area

( )

( )

( )

( )

(3.79)

Integrate over the length of the region and term three in (3.15) simplifies into

∫ ( )

( ) (3.80)

Combining the resulting equations for term one, two and three in the equation for

refrigerant energy balance (3.76), (3.78) and (3.80) results in

[0

] 0

0 ( )

( )

[0

] 0

0 ( )

0 ( ) 0 ( )

( )

(3.81)

Page 55: Dynamic modeling and Model Predictive Control of a vapor

33

Use the definition of the conservation mass in (3.63) and substitute it for in (3.81)

[0

] 0

0 ( )

0 [

[ ]

]

( ) 0 ( )

0 ( )

[0

0 ( )

]

0

( ) ( )

(3.82)

Apply the chain rule on the time derivative of using the relation of density, enthalpy

and pressure ( ( ))

(3.83)

Substitute (3.83) into (3.82)

0 ( )

[0

0 ( )

]

0 [

( )

]

( ) ( )

(3.84)

Page 56: Dynamic modeling and Model Predictive Control of a vapor

34

The conservation of refrigerant energy in the superheat region can thus be simplified

into

0 ( )

[0

0 ( )

]

0 [ ( )

]

( ) ( )

(3.85)

3.5.2.3 Conservation of tube wall energy

The first term in the equation for wall energy balance (3.16) is integrated over the

length of the region and Leibniz’s rule is applied

∫ ( )

( )

( )

[

|

|

]

( )

[

|

|

]

( )

[

]

(3.86)

Apply the product rule and use the fact that

. Term one in (3.16) thus

simplifies into

( )

[

]

( )

[

( )

]

(3.87)

Page 57: Dynamic modeling and Model Predictive Control of a vapor

35

Now the spatial dependence for the second and third term in the equation for wall

energy balance (3.16) are removed by integrated over the length of the region

∫ ( ( ) ( ))

( ) ( )

(3.88)

Combining (3.87) and (3.88) and the conservation of wall energy in the superheat region

may be written as

( )

[

( )

]

( ) ( )

(3.89)

3.5.3 Overall mass balance of evaporator

To obtain an overall mass balance equation, the previous derived mass equations are

used. The equation for conservation of refrigerant mass in the two phase region, (3.28),

( )

(3.90)

is combined with the equation for conservation of refrigerant mass in the super heat

region, (3.63),

( )

(3.91)

which results in

( )

[

] (3.92)

The density in region two is pressure and enthalpy dependent ( ( )) and

since the enthalpy in region two is a function of pressure and outlet enthalpy

Page 58: Dynamic modeling and Model Predictive Control of a vapor

36

( ( )) the density can be written as ( ). Use this

relationship for the time derivative of and apply the chain rule

(3.93)

Now substitute this into (3.92)

( )

[ (

)

]

(3.94)

The overall mass balance of the evaporator is thus simplified into

( )

(

)

(3.95)

3.5.4 State-space representation

The governing equations for conservation of mass, refrigerant energy and wall energy

(3.49), (3.53), (3.85), (3.89) and (3.95) can be rearranged into state-space form. The five

time derivatives; and are organized according to the

( ) ( ) form. The states [ ]

and the control

inputs [ ]

are thus being used to define the evaporator model as

( ) (3.96)

where

[ 0 0 0

0 0

0 0

0 0 0 0

0 0 0 ]

(3.97)

Page 59: Dynamic modeling and Model Predictive Control of a vapor

37

and

[

( ) ( )

( ) ( )

( ) ( )

( ) ( ) ]

(3.98)

The rows of correspond to ( ), ( ), ( ), ( ) and ( ) respectively. The

elements of are given in Table 3.1.

Table 3.1 Matrix elements of ( ).

[( ) ]

[

( )

]

0 ( )

[0

0 ( )

]

0 [ ( )

]

[ ]

[

]

( )

( )

( )

Page 60: Dynamic modeling and Model Predictive Control of a vapor

38

3.6 Condenser model

As for the evaporator model, the derivation of the condenser model is based on a

combination of the results given in [4], [5], [6] and [26]. The structure of the condenser

is also assumed to be a lumped parameter dynamic model. The heat exchanger has three

types of fluid regions; a superheated vapor section, a two phase section and a subcooled

liquid section. The boundaries between these regions are, as for the evaporator,

assumed to be moving boundaries and may thus change depending on operating

conditions. An illustration of the condenser zones is given in Figure 3.6.

Equations for the conservation of mass and energy for the condenser are derived based

on the generalized Navier-Stokes equations presented in Chapter 3.5, see (3.14) (3.16).

The method for converting the governing PDEs to lumped parameter ODEs and

removing the spatial dependence also matches that of Chapter 3.5. The resulting ODEs

are finally organized into a state-space form.

3.6.1 Subcool region

3.6.1.1 Conservation of refrigerant mass

The first term in the equation for refrigerant mass balance (3.14) is integrated over the

cross-sectional area

𝑥𝑐

𝑇𝑐𝑤 (𝑡)

��𝑐 𝑜𝑢𝑡 𝑐 𝑜𝑢𝑡(𝑡)

𝑇𝑐𝑤 (𝑡)

𝑥𝑐 0

𝑇𝑐𝑤 (𝑡)

��𝑐 𝑖𝑛 𝑐 𝑖𝑛(𝑡)

𝑃𝑐(𝑡)

𝐿𝑐 (𝑡)

𝐿𝑐 (𝑡)

𝐿𝑐 (𝑡)

𝐿𝑐𝑇

Superheat

Two phase

Subcool

Figure 3.6 Condenser regions.

Page 61: Dynamic modeling and Model Predictive Control of a vapor

39

(3.99)

As in the superheat region of the evaporator, the refrigerant never undergoes any phase

transitions in the subcool region of the condenser. In other words, there is no need to

extend the cross-sectional area into a liquid and vapor part. Now integrate over the

length of the region and apply Leibniz’s rule

∫ |

( )

|

( )

( )

(3.100)

Since the length of the condenser is constant, the time derivative of the total condenser

length in (3.100) equals zero. The density of the liquid in the subcool region can also

be assumed to be the density of saturated liquid . The assumption leads to that

(3.100) can be written as

( )

(3.101)

Apply the product rule

( )

( )

(3.102)

Page 62: Dynamic modeling and Model Predictive Control of a vapor

40

Again, since the total length of the condenser is constant the last term in (3.102) is equal

to zero. Term one in the equation for refrigerant mass balance (3.14) can thus be

simplified into

(3.103)

Integrate the second term in the equation for refrigerant mass balance (3.14) over the

cross-sectional area

(3.104)

Integrate over the length of the region

| |

(3.105)

Term two in (3.14) can then be rewritten as

(3.106)

Combining the resulting equations from the derivation based on the equation for

refrigerant mass balance (3.103) and (3.106) and the conservation of refrigerant mass

in the subcool region may be expressed as

0

0

(3.107)

3.6.1.2 Conservation of refrigerant energy

The first term in the equation for refrigerant energy balance (3.15) is integrated over the

cross-sectional area

Page 63: Dynamic modeling and Model Predictive Control of a vapor

41

( )

( )

(3.108)

Remove the spatial dependency by integrating over the length of the region and

applying Leibniz’s rule

( )

∫ ( )

( )|

( )

( )|

∫ ( ) ( )

( )

( ) ( )

( )

(3.109)

As previously mentioned, the density in the subcool region is assumed to be equal to the

saturated density

( )

( )

( )

(3.110)

Apply the product rule

( ) ( )

(3.111)

Use the fact that the length of the condenser is constant. The time derivative of region

three may then be written as

( )

0 ⇔

( )

(3.112)

Page 64: Dynamic modeling and Model Predictive Control of a vapor

42

Substitute into (3.111)

( ( )

)

( )

( )

(3.113)

Rearrange and term one in the equation for refrigerant energy balance (3.15) can be

expressed as

( ) ( )

(3.114)

The second term in (3.15) is now integrated over the cross-sectional area

( )

( )

(3.115)

Integrate over the length of the region

( ) ( )| ( )|

(3.116)

Term two in (3.15) may then be rewritten as

(3.117)

Term three in (3.15) is now integrated over the cross-sectional area

( )

( )

( )

( )

(3.118)

Page 65: Dynamic modeling and Model Predictive Control of a vapor

43

Integrate over the length of the region and term three simplifies into

∫ ( )

( )

(3.119)

Combination of resulting equations (3.114), (3.117) and (3.119) yields

( ) ( )

( )

(3.120)

Use the equation for conservation of mass in the subcool region, ( 0 )

0 ⇔

(3.121)

and substitute into (3.120)

( ) ( )

(

) ( )

[ ] ( )

( ) ( )

(3.122)

The enthalpy in region three can be defined as the average between inlet and outlet

enthalpy

(3.123)

Page 66: Dynamic modeling and Model Predictive Control of a vapor

44

Substitute the definition of average enthalpy in region three into (3.122)

[ (

)]

( )

(

)

(

)

( ) ( )

(3.124)

Rearrange and apply the product rule results in

0 [ ] ( )

[0 ( )

0

]

0

( ) ( )

(3.125)

After further simplification, the conservation of refrigerant energy in the subcool region

may be defined as

0 [ ]

0 [ ]

[0 ( )

0

]

0

( ) ( )

(3.126)

3.6.1.3 Conservation of tube wall energy

The first term in the equation for wall energy balance (3.16) is integrated over the

length of the region and Leibniz’s rule is applied

Page 67: Dynamic modeling and Model Predictive Control of a vapor

45

∫ ( )

( )

( )

[

|

( )

|

]

( )

[

|

|

( )

]

( )

[

( )

]

(3.127)

Apply the product rule and term one in (3.16) may be written as

( )

[

( )

] (3.128)

As with the first term, the second and third term in (3.16) are also integrated over the

length of the region

∫ ( ( ) ( ))

( ( ) ( ))

(3.129)

Combining (3.128) and (3.129) results in

( )

[

( )

]

( ( ) ( ))

(3.130)

Again, the total length of the condenser is constant

( )

(3.131)

Page 68: Dynamic modeling and Model Predictive Control of a vapor

46

Substitute into (3.130)

( )

[

(

( )

)

( )

]

( ( ) ( ))

(3.132)

Rearrange and the conservation of wall energy in the subcool region may finally be

written as

( )

[

(

)

(

)

]

( ) ( )

(3.133)

3.6.2 Superheat region

3.6.2.1 Conservation of refrigerant mass

The first term in the equation for refrigerant mass balance (3.14) is integrated over the

cross-sectional area

(3.134)

Integrate over the length of the region, apply Leibniz’s rule and expand the equation

with the term (

)

(

)∫

(

)∫ |

0

|

(

)∫

(3.135)

The average density in region one may be defined as

Page 69: Dynamic modeling and Model Predictive Control of a vapor

47

(

)∫

(3.136)

Using this definition, applying the product rule and (3.135) can be rewritten as

(3.137)

The first term in (3.14) thus simplifies into

( )

(3.138)

The second term in (3.14) is also integrated over the cross-sectional area

(3.139)

As with the first term, integrate the second term over the length of the region

|

|

(3.140)

Term two in (3.14) can then finally be written as

(3.141)

Combining the equations derived based on the equation for refrigerant mass balance

(3.138) and (3.141) and the conservation of refrigerant mass in the superheat region

may be expressed as

0

( )

0

(3.142)

Page 70: Dynamic modeling and Model Predictive Control of a vapor

48

3.6.2.2 Conservation of refrigerant energy

The first term in the equation for refrigerant energy balance (3.15) is integrated over the

cross-sectional area

( )

( )

(3.143)

The spatial dependence needs to be removed. Therefore integrate over the length of the

region and apply Leibniz’s rule

∫ ( ) ( )|

0

( )|

∫ ( ) ( )

( ) ( )

(3.144)

Applying the product rule and (3.144) can be written as

( )

( )

[

] [ ]

(3.145)

Rearrange the equation for conservation of refrigerant mass, (3.142),

( )

0

( )

(3.146)

Page 71: Dynamic modeling and Model Predictive Control of a vapor

49

Substitute this for the equivalent term in (3.145)

[

] [ ]

( )

(3.147)

Term one in the equation for refrigerant energy balance (3.15) can thus be simplified

into

[

]

(3.148)

Integrate the second term in (3.15) over the cross-sectional area

( )

( )

(3.149)

Integrate over the length of the region

( ) ( )|

( )|

(3.150)

Term two in (3.15) may then be written as

(3.151)

The third and last term in (3.15) is now integrated over the cross-sectional area

( )

( )

( )

(T T )

(3.152)

Page 72: Dynamic modeling and Model Predictive Control of a vapor

50

Integrate of the length of the region and the equation is finally expressed as

∫ (T T ) (T T )

(3.153)

Combining the resulting equations from the derivation based on the equation for

refrigerant energy balance (3.148), (3.151) and (3.153) results in

[

]

(T T )

(3.154)

The enthalpy in region one may be written as the average between the inlet and outlet

enthalpies

(3.155)

Substitution of the average enthalpy into (3.154) results in

[

]

(

)

(

) (

)

(T T )

[

] 0 ( )

( ) 0 ( )( )

(3.156)

Rearrange the equation for conservation of refrigerant mass, (3.142),

( )

(3.157)

Page 73: Dynamic modeling and Model Predictive Control of a vapor

51

Substitute in (3.156) with the expression in (3.157)

[

] 0 ( )

( ) 0 ( )

(

( )

)

[

] 0 ( )

0 ( )

( ) ( )

(3.158)

As noted earlier, the density in the superheat region one is a function of pressure and

enthalpy ( ( )). Using this and the assumption that the time derivative of

the enthalpy at the boundary between the superheat and two phase region may be

written as

(3.159)

results in that the time derivative of pressure may be expanded as

(3.160)

Page 74: Dynamic modeling and Model Predictive Control of a vapor

52

Substitute (3.159) and (3.160) into (3.158)

[

] 0 ( )

0 ( ) (

)

( ) ( )

[

0 ( ) (

)]

0 ( )

( ) ( )

(3.161)

Since the enthalpy in vaporized form is only a function of pressure ( ( )) the

time derivative of enthalpy in vaporized form may be expanded as

(3.162)

Substituting the result in (3.162) into (3.161) and the conservation of refrigerant energy

in the superheat region can be written as

[

0 ( ) (

) ]

0 ( )

( ) ( )

(3.163)

Page 75: Dynamic modeling and Model Predictive Control of a vapor

53

3.6.2.3 Conservation of tube wall energy

The first term in the equation for wall energy balance (3.16) is integrated over the

length of the region and Leibniz’s rule is applied

∫ ( )

( )

( )

[

| 0

|

]

( )

[

|

]

( )

[

]

(3.164)

To further simplify the equation above, apply the product rule. Term one in (3.16) can

then be written as

( )

[

]

( )

[

( )

]

(3.165)

As with the first term, the second and third term in the equation for wall energy balance

(3.16) are integrated over the length of the region

∫ ( ( ) ( ))

( ( ) ( ))

(3.166)

The conservation of wall energy in the superheat region can be defined by combining

(3.165) and (3.166)

Page 76: Dynamic modeling and Model Predictive Control of a vapor

54

( )

[

( )

]

( ) ( )

(3.167)

3.6.3 Two phase region

3.6.3.1 Conservation of refrigerant mass

The first term in the equation for refrigerant mass balance (3.14) is integrated over the

cross-sectional area

[ (

)]

[ ( ( ) )]

(3.168)

where and is the cross-sectional area of saturated liquid and vapor respectively.

is the ratio of the cross-sectional area of saturated liquid to total cross-sectional area

and can therefore be replaced with . Applying the same way of thinking on

and the

term may be rewritten as ( ).

Now integrate over the length of the region and apply Leibniz’s rule to remove spatial

dependence

[ ( ( ) )]

∫ [ ( ( ) )]

[ ( ( ) )]|

[ ( ( ) )]|

( )

(3.169)

Page 77: Dynamic modeling and Model Predictive Control of a vapor

55

The second term in (3.169) is evaluated at the intermediate between the two phase and

superheat region. The refrigerant can be assumed to be completely vaporized at that

location in the evaporator, i.e. the mean void fraction equals one. The third term in

(3.169) is evaluated at the intermediate between the two phase and subcool region. The

refrigerant can then be assumed to be purely liquid at that location in the evaporator, i.e.

the mean void fraction equals zero.

∫ [ ( ( ) )]

[ ( ( ) )]|

[ ( ( 0) 0)]|

( )

(3.170)

Perform the integration and rearrange

∫ [ ( ( ) )]

( )

[ ( ( ) )]

( )

( )

( )

(3.171)

Apply the product rule and rearrange

[

( )

]

[ ( ) ]

( )

(3.172)

The average density in region two can be rewritten with help of the mean void fraction

as ( ) . Using this, term one in (3.16) simplifies into

Page 78: Dynamic modeling and Model Predictive Control of a vapor

56

[ ]

( )

(3.173)

The second term in the equation for refrigerant mass balance (3.14) is now integrated

over the cross-sectional area

[ (

)]

[ ( ( ) )]

(3.174)

Integrate over the length of the region and then use the fact that and 0 for

the vapor and liquid part of the condenser respectively

[ ( ( ) )]

[ ( ( ) )]|

[ ( ( ) )]|

[ ( ( 0) 0)] [ ( ( ) )]

(3.175)

Term two in (3.14) may then be written as

(3.176)

Combining (3.173) and (3.176) and the conservation of refrigerant mass in the two

phase region may be defined as

0

[ ]

( )

0

(3.177)

Page 79: Dynamic modeling and Model Predictive Control of a vapor

57

3.6.3.2 Conservation of refrigerant energy

The first term in in the equation for refrigerant energy balance (3.15) is integrated over

the cross-sectional area

( )

[

]

(3.178)

Replace the cross-sectional area ratios with the mean void fraction

[ ( ) ]

[ ( ) ]

(3.179)

Integrate over the length of the region and apply Leibniz’s rule

[ ( ) ]

∫ [ ( ) ]

[ ( ) ]|

[ ( ) ]|

( )

(3.180)

Page 80: Dynamic modeling and Model Predictive Control of a vapor

58

Use the fact that and 0 for the vapor and liquid part of the condenser

respectively

∫ [ ( ) ]

[ ( ) ]|

[ ( 0) 0 ]|

( )

∫ [ ( ) ]

[ ]

[ ]

( )

(3.181)

Perform the integration and rearrange

( )

[ ]

[ ]

[ ]

[ ]

( )

( )

(3.182)

Apply the product rule and term one in (3.15) is finally simplified into

[ ]

[ ]

[( )

]

(3.183)

As with the first term, the second term in (3.15) is integrated over the cross-sectional

area

( )

[

] (3.184)

Page 81: Dynamic modeling and Model Predictive Control of a vapor

59

The cross-sectional area ratios can be replaced with the mean void fraction

[ ( ) ] (3.185)

Integrate over the length of the region and use the fact that and 0 for the

vapor and liquid part of the condenser respectively

[ ( ) ]

[ ( ( ) )]|

[ ( ( ) )]|

[ ( ( 0) 0)]

[ ( ( ) )]

(3.186)

Term two in (3.15) may then be written as

(3.187)

The last term in the equation for refrigerant energy balance (3.15) is now integrated

over the cross-sectional area

( )

( )

( )

( )

(3.188)

Integrate of the length of the region and term three in (3.15) is simplified into

∫ ( )

( )

(3.189)

Page 82: Dynamic modeling and Model Predictive Control of a vapor

60

Combining (3.183), (3.187) and (3.189)

[ ]

[ ]

[( )

]

( )

(3.190)

To simplify even more, use the equation for conservation of refrigerant mass in the two

phase region, (3.177), and rearrange it

[ ]

( )

0

[ ]

( )

(3.191)

Also, take advantage of the expression for conservation of refrigerant mass in the

subcool region, (3.107),

0

(3.192)

Page 83: Dynamic modeling and Model Predictive Control of a vapor

61

Substitute (3.191) and (3.192) into (3.190)

[ ]

[ ]

[( )

]

(

)

(

[ ]

( )

(

)) ( )

[ ( ) ( ) ]

[ ( ) ]

[( )

]

( )

( )

( )

(3.193)

Applying the product rule and using the definition of enthalpy of vaporization

( ) the equation above can be rewritten as

[ ( )

]

( )

( )

(3.194)

Page 84: Dynamic modeling and Model Predictive Control of a vapor

62

Further rearrangement and the conservation of refrigerant energy in the two phase

region may be defined as

[ ( ( )

) ( )

]

( )

(3.195)

3.6.3.3 Conservation of tube wall energy

The first term in the equation for wall energy balance (3.16) is integrated over the

length of the region and Leibniz’s rule is applied

∫ ( )

( )

( )

[

|

|

( )

]

( )

[

( )

]

(3.196)

Use the product rule

( )

[

( )

] (3.197)

Term one in (3.16) thus simplifies into

( )

(3.198)

Now the second and third term in the equation for wall energy balance (3.16) are

integrated over the length of the region

Page 85: Dynamic modeling and Model Predictive Control of a vapor

63

∫ ( ( ) ( ))

( ( ) ( ))

(3.199)

Combining the resulting derivations (3.198) and (3.199) and the conservation of wall

energy in the two phase region may be written as

( )

( ) ( )

(3.200)

3.6.4 Overall mass balance of condenser

To express the overall mass balance of the condenser, substitute the equation for

conservation of refrigerant mass in the superheat region, (3.142),

( )

0

( )

(3.201)

and the equation for conservation of refrigerant mass in the subcool region, (3.107),

0

(3.202)

into the equation for conservation of refrigerant mass in the two phase region, (3.177),

[ ]

( )

0 (3.203)

Page 86: Dynamic modeling and Model Predictive Control of a vapor

64

Equation (3.203) can then be expressed as

[ ]

( )

(

)

(

( )

) 0

[ ]

( )

(3.204)

Remember that the density in region one is pressure and enthalpy dependent

( ) (3.205)

and that the time derivative of the enthalpy in region one can be assumed to be equal to

the time derivative of vaporized enthalpy

(3.206)

Combining (3.205) and (3.206) and using the chain rule, the time derivative of pressure

in region one can be written as

(3.207)

Substituting this into (3.204)

[ ]

( )

(

)

(3.208)

Page 87: Dynamic modeling and Model Predictive Control of a vapor

65

After further rearrangements, the overall mass balance in the condenser may be defined

as

[

(

)]

( )

( )

(3.209)

3.6.5 State-space representation

The governing equations for conservation of mass, refrigerant energy and wall energy

(3.126), (3.133), (3.163), (3.167), (3.195), (3.200) and (3.209) can be rearranged into

state-space form. The seven time derivatives; and are

organized according to the ( ) ( ) form. The states

[ ]

and the control inputs [ ]

are thus being used to define the condenser model as

( ) (3.210)

where

[ 0 0 0 0 0

0 0 0 0

0 0 0

0 0 0 0

0 0 0 0 0

0 0 0 0 0 0

0 0 0 0 ]

(3.211)

and

[

( ) ( )

( )

( ) ( )

( ) ( )

( ) ( )

( ) ( ) ]

(3.212)

Page 88: Dynamic modeling and Model Predictive Control of a vapor

66

The rows of corresponds to ( ), ( ), ( ), ( 0 ), ( ), ( 00) and

( ) respectively. The elements of are given in Table 3.2.

Table 3.2 Matrix elements of ( ).

0 ( )

[

0 ( ) (

) ]

( [ ( )

] ( )

)

0 ( )

0 ( )

[0 ( )

0

]

0

( )

( )

[

(

)]

( )

( )

( )

Page 89: Dynamic modeling and Model Predictive Control of a vapor

67

( )

( )

( )

( )

( )

( )

Page 90: Dynamic modeling and Model Predictive Control of a vapor

68

4 Nonlinear model

4.1 Introduction

Four models, one for each component of the vapor compression system, were derived in

Chapter 3. In order to develop an overall model for the complete system, these separate

models need to be connected to each other. One way of doing this interconnection is

with the help of computer software.

4.2 Component interconnection

There are a number of computer programs available on the market, both paid and open

source, capable of performing component interconnection. However, two popular

programs used in both industrial and academic institutions are MATHWORKS MATLAB and

MATHWORKS SIMULINK. SIMULINK is integrated with MATLAB and offers advanced design and

simulation options in a user friendly, graphical environment. The program also features

a library with predefined blocks. An example of such is the library subgroup called Math

Operations which contains blocks representing different mathematical operations. This

subgroup, along with other blocks in the library, is used to form the equations derived in

Chapter 3. A part of this process is given in Figure 4.1 where the mass flow equation of

the expansion valve (3.11) is built by connecting various blocks from the library

browser.

Figure 4.1 The SIMULINK model for expansion valve mass flow.

Page 91: Dynamic modeling and Model Predictive Control of a vapor

69

Since the number of blocks quickly grows as more equations are created, it is useful to

organize sets of blocks into subsystems. This has been done for the block called

in Figure 4.1 and when opened, the blocks in Figure 4.2 are revealed:

Figure 4.2 Subsystem for calc rho_cout.

The two blocks called and are part of a look-up-table operation

for the calculation of the refrigerant density at the condenser outlet ( ). Refrigerant

manufacturing companies such as Solvay Flour and DuPont provide detailed product

sheets available for download [19], [29]. An example is given in Table 4.1 where

thermodynamic properties for Solvay Flour Solkane R134a have been calculated.

Table 4.1 Thermodynamic properties for Solvay Flour Solkane R134a.

Page 92: Dynamic modeling and Model Predictive Control of a vapor

70

Properties are given for both refrigerant liquid and vapor form and these tables are used

in the SIMULINK model for the look-up table operations. For example is the density

in Figure 4.2 interpolated from the liquid table based on the value of the enthalpy .

The same practice is used for remaining, non-constant, parameters of the vapor

compression system. Once all equations are created and all components are connected

to each other the nonlinear model of the vapor compression system is ready for

simulation. An illustration of the final model is given in Figure 4.3 where the model

inputs are the compressor and expansion valve settings and the model outputs are the

evaporator pressure and superheat.

Figure 4.3 Nonlinear SIMULINK model of the vapor compression system.

4.3 Simulation

Different operation conditions can now easily be simulated using the nonlinear SIMULINK

model from previous section. To illustrate the nonlinearity of the vapor compression

system the model is simulated with a constant expansion valve opening in combination

with varying compressor speeds. When 10, 20 and 30 seconds have passed the

compressor speed is increased by raising the compressor setting by 1, 2 and 4 volts

respectively. If the system was linear, a doubling of the compressor setting from 1 to 2

would result in an equivalent doubling of system outputs. As can be seen in Figure 4.5

Page 93: Dynamic modeling and Model Predictive Control of a vapor

71

and Figure 4.4 there are stationary errors present between the system and a

hypothetical linear system, i.e. the system outputs are not directly proportional to the

system inputs.

The same procedure

The same test is repeated, but this time the compressor speed is held constant while the

expansion valve opening is varied. When 15, 35 and 55 seconds have passed the

expansion valve setting is increased by 0.01, 0.02 and 0.04 respectively. As can be seen

in Figure 4.7 and Figure 4.6, the stationary errors are present this time as well, once

more showing the nonlinearities associated with the vapor compression system.

Figure 4.5 Evaporator superheat, varying compressor speed

Figure 4.4 Evaporator pressure, varying compressor speed.

Figure 4.7 Evaporator superheat, varying expansion valve opening.

Figure 4.6 Evaporator pressure, varying expansion valve opening.

Page 94: Dynamic modeling and Model Predictive Control of a vapor

72

5 Model linearization

5.1 Introduction

Traditional controllers, such as Proportional-Integral-Derivative (PID) controllers, have

been widely used for vapor compression systems [30] and [31]. Usually the approach is

a single-input single-output (SISO) methodology where for example the expansion valve

is used to control the superheat [32]. Although progress has been made within the area

there still exist some severe limitations with the SISO-methodology. The reason for this

is mostly because of the cross-coupled dynamics associated to vapor compression

systems [33]. Take the SISO-method mentioned above as an example. Since the

expansion valve is located at the entry of the evaporator and superheat is evaluated at

the end of the evaporator, there is significant dynamic behavior between the actuator

and the controlled variable which the SISO-technique is unable to account for.

Decoupled attempts have been made where the compressor and expansion valve are

designed to control separate system outputs. Despite efforts like these, unacceptable

system behavior has been reported [34]. In order to address the problems with cross-

coupling, much research has lately been focus on multi-input multi-output (MIMO)

techniques. In common for advanced model-based control methods such as Linear

Quadratic control or Model Predictive Control is the requirement of a reasonably exact

model of the system being controlled. From a control perspective the goal is thus to

develop a model as accurate as possible but at the same time as simple as possible. A

linearized version of a nonlinear model has shown to be a good compromise between

accuracy and simplicity [3]. In this chapter two methods for linearization are explained;

one strictly mathematical and one aided by computer software. The method of choice for

the linearized model used for the controller design in Chapter 6 is the computer

software method. The reason for the mathematical method being mentioned in this

thesis is to highlight that this is a valid method for generating a linear model as well.

5.2 Mathematical method

With proper knowledge of linear algebra and a feeling of the physical characteristics

associated with a vapor compression system the coupling of system components can be

Page 95: Dynamic modeling and Model Predictive Control of a vapor

73

done through algebraic interconnection. As mentioned in the previous chapter, a vapor

compression system is a nonlinear system, i.e. system outputs are not directly

proportionally to system inputs. By linearizing the system about an operation point, a

simpler model can be obtained which then is able to predict deviations from this

operating point. A linearized model is a valid approximation of a nonlinear system as

long as these deviations remain reasonably small. This is in most cases an acceptable

way of modeling a vapor compression system since the controller is usually designed to

keep variables of interest, for example a room temperature, within certain boundaries

despite varying environmental conditions. Moreover, these environmental conditions

are not very likely to significantly change in a short period of time. As a result, the

controller has plenty of time to adjust to shifting operating conditions thereby keeping

the perturbations from the operating point to a minimum. Since the deviations remain

small the approximated linear model will be valid. A method for algebraic

interconnection is outlined in [4] where the author obtains an overall model of the vapor

compression system by component linearization followed by linkage of linearized

models. This method of choice can be applied on the system described in Chapter 2. The

complete linearization with corresponding equations will not be presented. Instead,

focus is given on the method and relevant steps when linearizing a model. The

procedure in [4] resembles that of standard linearization techniques where partial

derivatives with respect to system states and inputs are derived. Taylor series

expansions of both the static and dynamic equations are carried out where second and

higher order terms are neglected. Once obtained, the partial derivatives of the two heat

exchangers can be represented in a linear state-space form as

|

|

or (5.1)

where and are state and input perturbations around the linearization point

respectively. | and |

are the time invariant Taylor series expansion with

respect to heat exchanger states and inputs respectively.

Page 96: Dynamic modeling and Model Predictive Control of a vapor

74

The state deviation and the input deviation are defined as

or

(5.2)

where and are the state vector and input vector respectively and and are the

state vector and input vector for the linearization point respectively. Also, in order to

simplify the linearization it is assumed that the function ( ) with respect to and

are approximately equal to zero, i.e. ( ) 0.

The static equations representing the compressor and expansion valve are functions of

the heat exchanger parameters and component settings as

( ) (5.3)

( ) (5.4)

( ) (5.5)

Partial derivatives of (5.3) (5.5) can be expressed as

(5.6)

(5.7)

(5.8)

where are the Taylor series expansions with respect to the function

parameters in (5.3) (5.5) respectively. The partial derivatives of the static equations

can be used to connect the two heat exchangers, resulting in a single, governing system

model. To illustrate how this can be done, a part of the linearization process is given

below:

The nonlinear equation for conservation of refrigerant energy in the two phase region of

the evaporator (first row in (3.98)) is

( ) ( ) (5.9)

Page 97: Dynamic modeling and Model Predictive Control of a vapor

75

The evaporator states are

[ ] (5.10)

and the evaporator inputs are

[ ] (5.11)

The partial derivatives of (5.9) with respect to the first evaporator state are

( ) (5.12)

The derivatives with respect to the second state are

[

] (5.13)

None of the parameters in (5.9) are functions of the evaporator outlet enthalpy, ,

therefore the derivatives with respect to the third states are

0 (5.14)

The procedure is repeated for the remaining states and inputs. The linearized version of

(5.9) can then be expressed as

(5.15)

where and are the Taylor series expansions with respect to evaporator states

and inputs respectively. When the remaining nonlinear evaporator equations have been

linearized they are ordered into matrix form. First, recall that the nonlinear evaporator

is written as

[

]

(5.16)

Page 98: Dynamic modeling and Model Predictive Control of a vapor

76

Also, since the evaporator is linearized in a steady-state operating point the evaporator

states are assumed to be close to constant, i.e. 0. Lastly, remembering the previous

statement that ( ) 0 and the linearized version of the evaporator can be

expressed as

( ) ( )

(5.17)

where

[ 0 0

0

0 0 0 0 00 0 0

0 0 ]

(5.18)

and

[ 0

0 0

0

0 0 00 0 0 ]

(5.19)

The linearized version of the condenser is derived in an analogous manner. When all the

evaporator and condenser equations have finally been linearized they need to be

connected to each other. A simplified illustration of how the equations associated to

different system components are linked to each other is given below in Figure 5.1.

Page 99: Dynamic modeling and Model Predictive Control of a vapor

77

Figure 5.1 Overview of the vapor compression system.

As can be seen, the first evaporator input is assumed to be equal to the expansion

valve mass flow . By using (5.8), the linearized version of can be written as

(5.20)

Also, the evaporator input is assumed to be equal to the fourth condenser state

. The linearized version may be written as

(5.21)

Substituting (5.20) and (5.21) into (5.15) give

��𝑒𝑒𝑣(𝑃𝑒 𝑃𝑐 𝑢𝑒𝑒𝑣)

Expansion valve

𝑥𝑒 [𝐿𝑒 𝑃𝑒 𝑒 𝑜𝑢𝑡 𝑇𝑒𝑤 𝑇𝑒𝑤 ]𝑇

𝑢𝑒 [��𝑒 𝑖𝑛 ��𝑒 𝑜𝑢𝑡 𝑒 𝑖𝑛]𝑇

Evaporator

𝑥𝑐 [𝐿𝑐 𝐿𝑐 𝑃𝑐 𝑐 𝑜𝑢𝑡 𝑇𝑐𝑤 𝑇𝑐𝑤 𝑇𝑐𝑤 ]𝑇

𝑢𝑐 [��𝑐 𝑖𝑛 ��𝑐 𝑜𝑢𝑡 𝑐 𝑖𝑛]𝑇

Condenser

��𝑐𝑜𝑚𝑝(𝑃𝑒 𝑃𝑐 𝑢𝑐𝑜𝑚𝑝)

Compressor

𝑐𝑜𝑚𝑝(𝑃𝑒 𝑃𝑐 𝑒 𝑜𝑢𝑡) 𝑐𝑜𝑚𝑝 𝑖𝑛 𝑒 𝑜𝑢𝑡

𝑒 𝑜𝑢𝑡

𝑐𝑜𝑚𝑝 𝑖𝑛

��𝑒 𝑜𝑢𝑡

��𝑐𝑜𝑚𝑝

𝑐𝑜𝑚𝑝 𝑜𝑢𝑡 𝑐 𝑖𝑛

��𝑐 𝑖𝑛

��𝑐𝑜𝑚𝑝

𝑐 𝑖𝑛

𝑐𝑜𝑚𝑝 𝑜𝑢𝑡

𝑐 𝑜𝑢𝑡

𝑒 𝑖𝑛

��𝑐 𝑜𝑢𝑡

��𝑒𝑒𝑣

��𝑒 𝑖𝑛

��𝑒𝑒𝑣

𝑒 𝑖𝑛

𝑐 𝑜𝑢𝑡

Page 100: Dynamic modeling and Model Predictive Control of a vapor

78

( )

( )

(5.22)

The mass flow equation for the expansion valve and the outlet enthalpy of the condenser

are now linked to the equation for refrigerant energy in the two phase region of the

evaporator. The refrigerant energy in the two phase region of the evaporator is in other

words affected both by altered conditions inside the evaporator and inside the

condenser. The procedure is repeated for the remaining evaporator equations and the

resulting equations are rearranged into matrix form. The linear model of the evaporator

can then be expressed in terms of the evaporator and condenser states and the system

inputs according to

(5.23)

where the matrices and contain the evaporator and condenser parameters

affecting the evaporator respectively. includes the system input parameters affecting

the evaporator.

Applying the same technique on the condenser and the linear model of the condenser

can then be expressed in terms of the condenser and evaporator states and the system

inputs as

Page 101: Dynamic modeling and Model Predictive Control of a vapor

79

(5.24)

where and consist of the condenser and evaporator parameters affecting the

condenser respectively. comprises the system input parameters affecting the

condenser.

The overall linear system model can then be expressed as

[

] [

] (5.25)

where

[

] (5.26)

and

[

] (5.27)

5.3 Computer software method

As an alternative to the mathematical method, the linearization can be carried out using

computer software. Today there are a number of computer programs available on the

market, both paid and open source, capable of linearizing dynamic models. The linear

model used for the controller design in the next chapter is generated using the same

software as in Chapter 4, i.e. MATHWORKS MATLAB and MATHWORKS SIMULINK. By using the

MATLAB command linmod it is possible to find a linear approximation of the system

around an operating point. The steady state operating point used in this thesis is given

in Table 5.1 and is the same as in [4].

Page 102: Dynamic modeling and Model Predictive Control of a vapor

80

Table 5.1 Steady state control settings.

Compressor 31 Hz

Expansion Valve 1.7 V

The linmod command comes with a number of arguments, some optional and some non-

optional, and is structured in the following way:

argout = linmod('sys', x, u, para, xpert, upert, 'v5');

The argument sys is a non-optional argument and this is the name of the SIMULINK model

from which the linear model is obtained. The remaining arguments are optional. The

arguments x and u represent state and input vectors respectively, and if used they set

the operating point at which the linear model is extracted. For the interested reader,

more information about remaining arguments is found in [35]. In order to obtain the

state vector corresponding to the control settings given in Table 5.1, these settings are

used in the nonlinear model created in Chapter 4. With help of the block called

, see Figure 5.2, parameters of interest from the simulation of the SIMULINK

model can be exported and later analyzed.

Figure 5.2 Part of the evaporator model showing the To Workspace block.

Page 103: Dynamic modeling and Model Predictive Control of a vapor

81

The system is simulated long enough for initial transients to settle and the state vector is

extracted. The SIMULINK block named Out is used to declare outputs of the linear model.

As previously seen in Figure 4.3, the outputs of the system are chosen as the evaporator

pressure, , and the evaporator superheat . The state and input vector are now, along

with the nonlinear model, used to generate a linear model. The resulting model can then

be represented in state-space form:

(5.28)

where and are 12x12, 12x2, 2x12 and 2x2 matrices respectively.

5.4 Linear model analysis

Before beginning with the controller design, the linear model must be verified to be an

accurate representation of the nonlinear model. A stability analysis performed with the

MATLAB command eig gives the linear model’s eigenvalues

[

0 00000 0 0 0 0 0 0

0 0 0 0 0

0 ]

(5.29)

The different time-scales discussed in Chapter 3 clearly shows in (5.29) where the

eigenvalues differ by several orders of magnitude. As can also be seen, all eigenvalues lie

in the left half-plane meaning that the linear model is stable. The behavior of the linear

model around the operating point is then compared with the nonlinear model. Band-

limited white noise is added to the compressor and expansion valve where the noise

power is restricted to 1 and 0.01 respectively. The results are shown in Figure 5.3

to Figure 5.6 and from the plots it is clear that the linear model is a good approximation.

Some steady-state errors are present but overall, the linear model is capable of

Page 104: Dynamic modeling and Model Predictive Control of a vapor

82

accurately capturing the behavior of the nonlinear model. This means that it could be

used for controller design in the following chapter.

Figure 5.3 Evaporator Pressure with band-limited white noise added to compressor. A

zoomed in part is given in the lower right corner.

Figure 5.4 Evaporator Superheat with band-limited white noise added to compressor. A zoomed in part is given in the lower right corner.

Page 105: Dynamic modeling and Model Predictive Control of a vapor

83

Figure 5.5 Evaporator Pressure with band-limited white noise added to expansion valve. A zoomed in part is given in the lower right corner.

Figure 5.6 Evaporator Superheat with band-limited white noise added to expansion valve. A zoomed in part is given in the lower right corner.

Page 106: Dynamic modeling and Model Predictive Control of a vapor

84

6 Controller Design

6.1 Introduction

Before the impact of PID-controllers, control of vapor compression systems was mainly

achieved with simple electromechanical devices in an on/off strategy [36]. But with the

introduction of variable speed compressors and expansion devices new control

methods, such as the PID-controller, could be put into practice. The almost exponential

increase in computer power in recent years has further moved the boundaries of what

can be done in terms of control approaches. Model Predictive Control (MPC) is an

advanced control method that up to now has mostly been used in the processing

industry. Today, MPC technology can be found in a wide variety of applications [37] and

this is something that would have been impossible without the development of new,

more effective optimizations algorithms along with the advancements in computer

capacity. As mentioned in Chapter 5, MPC requires a dynamic model of the system being

controlled. The controller then uses this model in order to predict future system

responses. One of the major advantages with MPC compared to, for example LQ-control,

is the possibility for explicit handling of input, output and state constraints. This and

more features of the MPC controller are explained in further detail in the following

sections to come.

6.2 Model Predictive Control

6.2.1 Overview

The MPC algorithm takes advantage of the fact that a dynamic model of the system is

available. This model is used to predict changes in dependent variables caused by

changes in independent variables. Non-controllable independent variables are as a

result seen as disturbances by the controller. MPC uses current system information such

as states, inputs et cetera together with specified constraints and/or process variable

targets to calculate future changes in independent variables. These calculations are

optimized with respect to maintain tracking references of dependent variables and in

the same time ensuring that no constraints are violated. When using the MPC-technique,

Page 107: Dynamic modeling and Model Predictive Control of a vapor

85

the control problem needs to be structured into an optimization problem [38]. This

optimization problem is then solved online at each control interval and the first input in

the optimal sequence is sent into the system. At next control interval the entire

procedure is repeated and a new, optimal input sequence is calculated. An illustration of

a typical MPC scheme is given in Figure 6.1.

Figure 6.1 MPC scheme.

As can be seen, the timeline is broken up into distinct sampling intervals, i.e. discrete

time. At the current time , the future output is predicted based on past data. In this case

there is a reference trajectory present, meaning that the goal for the controller is to

minimize the difference between the output of the system and the desired set point. The

future output is predicted steps ahead in time and as can be seen the predicted

output eventually matches the reference. The control horizon is the number of

control inputs that are calculated in the prediction computation and this parameter is

always smaller than the prediction horizon. When the control signal is applied, system

states are resampled and the computations are repeated starting from the new current

state. Therefore, the prediction horizon is constantly shifted forward and this is the

reason for MPC also being known as receding horizon control.

Page 108: Dynamic modeling and Model Predictive Control of a vapor

86

6.2.2 The MPC framework

The control law being minimized every interval can be written as (assuming a tracking

reference equal to zero)

∑‖ ( )‖

∑‖ ( )‖

sub ect to

(6.1)

where and are weighting matrices for the system states and inputs respectively.

System constrains are represented by and and are organized in matrix form. The

expression above can now be interpreted as a “cost” function. By altering the values of

and different costs can be assigned to the two terms. The goal for the controller is

then to minimize the total cost in (6.1). If, for example is large compared to , the

controller decodes this as important to keep system states close to origin while not as

important to use small control signals . This is since the cost for state deviations is

much more expensive ( is large) than control signal deviations ( is small).

Before continuing with the optimization problem, the linear model from Chapter 5 is

analyzed in more detail. The linearized model of the system is expressed in continuous-

time state-space form

( ) ( ) ( )

( ) ( ) ( ) (6.2)

This means that the model needs to be converted into discrete time in order to be

implemented in the MPC-controller. This is done with the MATLAB command c2d. To run

the command following arguments need to be defined:

sysd = c2d(sys,Ts,method);

where sys is the continuous-time model being converted and Ts is the resulting

discrete-time model’s sampling time. The discretization method can specified with the

last argument method. The discretization method used in this thesis is the Zero-order

hold method and this technique assumes that the control inputs are piecewise constant

over the sampling horizon Ts.

Page 109: Dynamic modeling and Model Predictive Control of a vapor

87

Once converted, the linear model can be written as

( ) ( ) ( )

( ) ( ) (6.3)

where the time symbol has been replaced with to mark the use of discrete time. The

direct term from the input ( ) to the output ( ), represented by the -matrix in (6.2)

is left out in the time-discrete version. The reason for this is the principle of receding

horizon control, where current information of the plant is necessary for prediction and

control. As a consequence of this it is therefore assumed that the input cannot affect the

output at the same time, i.e. 0

The relationship between the discrete -matrix and the continuous -matrix is given by

(6.4)

and in an analogously manner between and as

(6.5)

Now, take a closer look at the first row in (6.3). What it actually says is that the state

vector at sampling time one, i.e. ( ) can be calculated using ( ) ( ). To

solve for the next state vector, i.e. ( ), the first row in (6.3) can thus be used

recursively as

( ) ( ) ( )

( ) ( ) ( )

( ) ( ) ( )

( ) ( ) ∑ ( )

(6.6)

where is the number of future control signals. In order to simplify the notation in

(6.6), it is structured into vector and matrix form with the prediction horizon as upper

limit

( ) (6.7)

Page 110: Dynamic modeling and Model Predictive Control of a vapor

88

where

(

( )

( )

( )

) (

( )

( )

( )

)

(

0 0 0

)

(

)

(6.8)

Worth noting is that by the above arrangement it is assumed that ( ) 0 > .

Let us return to the optimization problem in (6.1). This is the minimization problem

being solved at each control interval. The equation can be converted into a more

favorable form using the method outlined in (6.6) ( ). By introducing new

characters and representing block-diagonal matrices of and repeated

and time respectively as

(

0 00 00 0

) (

0 00 00 0

) (6.9)

Equation (6.1) can now be written in term of and as

∑‖ ( )‖

∑‖ ( )‖

( ( ) ) ( ( ) )

(6.10)

Page 111: Dynamic modeling and Model Predictive Control of a vapor

89

6.2.3 MPC formed as a quadratic programming problem

The motivation for the expression in (6.1) being transformed into (6.10) is the

possibility of formulating it as a quadratic programming (QP) problem. The problem can

then be solved using for example the Optimization Toolbox for MATLAB with its QP-solver

quadprog. Aside from commercial solvers such as quadprog, the number of free and open-

source software has increased in recent years and today the market offers a wide variety

of solvers written in a number of different programming languages [39]. This wide range

of available solvers is probably one explanation for the increased popularity of MPC. In

common for most solvers is the requirement of the function being structured as a

general QP-problem

sub ect to

(6.11)

As a result, (6.10) is written in the general QP-form with as the variable to be

minimized. The first term in (6.10) is expanded

( ( ) ) ( ( ) )

( ) ( ) ( ) (6.12)

All terms that do not include the variable can be ignored. The reason for this is since

the goal is to optimize with respect to , i.e. all terms that do not include will not alter

the outcome of the optimization. Equation (6.12) thus simplifies into

( ) (6.13)

Substituting into (6.10) and the optimization problem can be written as

( )

sub ect to (6.14)

Page 112: Dynamic modeling and Model Predictive Control of a vapor

90

Divide by two and rearrange give

( ) ( ( ))

sub ect to

(6.15)

The above equation now has the form of a general QP-problem and can thus be solved

using for example quadprog in MATLAB.

6.2.4 MPC with reference tracking

In most cases, the controller is not designed to minimize system states deviations from

origin, but rather minimize certain system output deviations from a given reference. The

outputs to be controlled are from now on denoted by and are included in (6.3) as

( ) ( ) ( )

( ) ( )

( ) ( )

(6.16)

where is a matrix with number of column and rows equal to number of system states

and controlled outputs respectively.

In order to achieve reference tracking the formulation in (6.1) needs to be modified.

First, instead of penalizing the state vector , the output tracking error is

penalized. Then the relationship given in (6.16) is used and the resulting equation is

finally converted into vector form

∑‖ ( ) ( )‖

∑‖ ( )‖

∑‖ ( ) ( )‖

∑‖ ( )‖

( ) ( )

( ( ) ) ( ( ) )

( ( ) ) ( ( ) )

(6.17)

Page 113: Dynamic modeling and Model Predictive Control of a vapor

91

where

( ( )

( )

) (6.18)

and

(

0 00 00 0

) (6.19)

is a block diagonal matrix repeated times. As seen in (6.18), the reference signal is

assumed constant for all future samples. This is a reasonable assumption, since in most

cases future reference signals are not known.

The vector form of (6.17) can now be rearranged into the form of a general QP-problem

as

(

) ( ( ( ) ))

sub ect to

(6.20)

6.2.5 MPC with integral action

The computation performed by the MPC-controller primarily relies on the dynamic

model provided for the controller. This model is in most cases a simplified version of the

actual system, e.g. a linearized model. As a consequence there will most likely be a model

mismatch between the simplified model and the true system. MPC does not guarantee

integral action per se, i.e. offsets and constant disturbances may not be rejected in

steady state. In order to account for these errors, integral action needs to be

implemented. Before doing so, let us return to the expression in (6.17):

∑‖ ( ) ( )‖

∑‖ ( )‖

(6.21)

When studied more closely, a problem arises. The trajectory tracking is handled by the

first part in (6.21) and by altering the weighting matrix , deviations from the desired

Page 114: Dynamic modeling and Model Predictive Control of a vapor

92

reference is penalized. The second part in (6.21) penalizes the magnitude on the control

signal. This means that if the weighting matrix is large in comparison to the

controller seeks to minimize the control signal as much as possible, i.e. to use a control

signal equal to zero. This will be contrarious if the reference signal is constant but the

stationary control signal at that operating point is not zero. The solution to this problem

is to penalize changes (increments) in the control signal rather than the magnitude.

Changes in the control signal is defined as

( ) ( ) ( ) (6.22)

To deal with model errors issues, a technique outlined in [40] is used. The main idea is

to take advantage of previous definition in (6.22) and to augment the state-space model

in (6.16) with the output tracking error. To be able to do so, new variables need to be

defined

( ) ( ) ( ) (6.23)

and

( ) ( ( )

( )) ( ) ( ) ( ) ( ) (6.24)

along with

( 0

) (

) (0 ) (6.25)

A new state-space model is thus obtained as

( ) ( ) ( )

( ) ( ) (6.26)

As the output tracking error now is included in the model, the optimization problem in

(6.21) needs to be redefined as well. The reference vector is no longer needed since

trajectory tracking is now handled by the model per se ( is minimized). Also, since the

augmented model’s input is , this is the variable to optimize with respect to. A new

control law may therefore be defined as

Page 115: Dynamic modeling and Model Predictive Control of a vapor

93

∑‖ ( )‖

∑‖ ( )‖

∑‖ ( )‖

∑‖ ( )‖

( ) ( )

( ( ) ) ( ( ) )

( ( ) ) ( ( ) )

(6.27)

where

(

0 00 00 0

)

(6.28)

and

(

( ) ( )

( ) ( )

( ) ( )

) (6.29)

and are matrices organized in the same way as in ( ) but with and replaced

by and respectively. Also, in the above arrangement it is assumed that ( )

0 > .

Equation (6.27) can then be rearranged into a form of a general QP-problem using the

same procedure as in previous sections. The result is given as

(

) ( ( ))

sub ect to

(6.30)

Page 116: Dynamic modeling and Model Predictive Control of a vapor

94

6.2.6 Constraints

Vapor compression systems have many characteristic constraints such as minimum

evaporator pressure, maximum compressor speed, valves unable to open more than

100% et cetera [36]. Most advanced control methods lack the ability to account for such

limitations, often leading to reduced efficiency [41]. As mentioned in the introduction,

MPC allows for explicit handling of constraints such as these. This means that if a set of

control inputs contravene one or more constraints that set of inputs is rejected as a

possible choice for the controller. All constraints that can be written as linear

combinations of the variable to be optimized with respect to, i.e. or , can be

implemented in the controller as

(6.31)

and

(6.32)

respectively. Several types of constraints can thus be arranged as

(

) (

) (6.33)

where and represent one type of constraint and and another type.

Constraints in are written in an analogous manner.

6.2.6.1 Control signals

Physical limitations of system actuators need to be implemented in the controller.

Naturally, the compressor has upper and lower speed boundaries while the expansion

valve in a similar manner has a maximum and minimum opening range. Constraints such

as these can be written as

( ) (6.34)

In order to express the constraints in general QP-form, a first step is to rearrange (6.34)

as

Page 117: Dynamic modeling and Model Predictive Control of a vapor

95

( )

( ) (6.35)

The constraints are then written in the form of (6.31) as

(

0 00 00 0 0 00 00 0 )

(

)

(6.36)

where (6.36) is expressed over the complete control horizon. The constraints are now in

general QP-form and are ready to be implemented in the controller.

The derivation of the general QP-form for constraints expressed in differs from that

of Let us begin with the less-than inequality in (6.34)

( ) (6.37)

Remember from (6.22) that the control signal can be written as

( ) ( ) ( ) (6.38)

For 0, (6.37) can be expressed as

( ) ( ) (6.39)

Moving ahead one sample in (6.38)

( ) ( ) ( )

( ) ( ) ( ) ( )

(6.40)

and the inequality for that sample time can be expressed as

( ) ( ) ( ) (6.41)

For the complete control horizon the sequence can be defined as

Page 118: Dynamic modeling and Model Predictive Control of a vapor

96

(

0 0 0

) ( ( )

( )

) (

) (6.42)

The vector containing ( ) is moved to the right hand side of (6.42)

(

0 0 0

) ( ( )

( )

) (6.43)

Equation (6.43) now has the same form as (6.32).

The larger-than inequality ( ) is derived in an analogous manner and

the resulting equation is written as

(

0 0 0

) ( ( )

( )

) (6.44)

The compressor and expansion valve constraints can now be implemented using the

procedure outlined above. The constraints used for the compressor and expansion valve

are 0 0 and 0 0 respectively.

6.2.6.2 Controlled outputs

To take fully advantage of the constraint-handling capabilities of MPC, boundaries for

the controlled system outputs can be implemented. In this thesis the controlled outputs

are evaporator pressure and superheat. The evaporator pressure is a feedback signal

used to meet system cooling demands. If the evaporator pressure is lowered while the

superheat at the outlet of the evaporator is kept constant, the walls of the evaporator

becomes colder, thereby creating a greater driving potential for heat transfer to the

secondary fluid. Since measuring the actual cooling capacity of a vapor compression

system often requires a number of different sensors, this is a standard approach used in

literature in order to estimate current cooling requirements. No constraints are applied

to this output since the cooling demands must not be compromised. The most important

requirement when controlling the other system output, evaporator superheat, is to

make sure that superheat is never completely lost. This is because of the compressor’s

Page 119: Dynamic modeling and Model Predictive Control of a vapor

97

inability to compress liquid. So, in order to protect the compressor a minimum level of

superheat is necessary. Too much superheat is on the other hand neither wanted. The

reason for this is since a high degree of superheat implies that the majority of heat

transfer takes place when the refrigerant is in gaseous state, rather than the much more

efficient two-phase heat transfer [36]. The controller is therefore designed to maintain a

required minimum safety-level of superheat while at the same time preventing it to

grow too large in order to preserve operation efficiency. Such constraints can be

expressed as

(6.45)

As in the previous section, these inequalities are rearranged into

(6.46)

The vector form of the controlled system outputs is

( ( ) )

(6.47)

The less-than inequality in (6.45) can thus be written as linear combination of

( ( ) ) (

)

(

) ( )

(6.48)

Page 120: Dynamic modeling and Model Predictive Control of a vapor

98

The same procedure is repeated for the larger-than inequality resulting in

( ( ) ) (

)

(

) ( )

(6.49)

Linear combinations of for controlled output constraints are derived in an analogous

manner except for the differences when using rather than outlined in previous

sections. The lower and upper superheat boundaries used in this thesis are 6 and 12

degrees Celsius respectively.

6.2.7 QP-solver

As mentioned, an essential part of the MPC-controller is its QP-solver. Since the

optimization problem is solved online, it is important that the solver is both fast and

accurate. After observations made in [42], where it was found that the optimal active set

often does not change much from one quadratic problem to the next, an open-source

solver called qpOASES was created. Several new theoretical features, some in order to

make the algorithm more robust, were implemented making it particularly suited for

MPC. More information about the solver and theoretical implementations can be found

in [43], [44] and [45]. QP-problems solved with qpOASES needs to be structured in the

following form

( )

s t ( ) ( )

( ) ( )

(6.50)

where and represents boundaries and, along with the gradient vector ,

depend affinely on the parameter .

Page 121: Dynamic modeling and Model Predictive Control of a vapor

99

qpOASES also features a detailed user guide with step-by-step instructions for

implementation in different third-party software [46]. The solver can be utilized directly

in MATLAB using a C++ compiler. The solver is then executed by calling the command

qpOASES as

[x,fval,exitflag,iter,lambda] =

qpOASES(H,g,A,lb,ub,lbA,ubA,x0,options);

where x and fval is the optimal primal solution vector and the optimal function value

respectively. exitflag provides information about the outcome of the optimization (QP

solved, QP is infeasible and could therefore not be solved et cetera). iter is the number

of active set iterations performed and lambda is the optimal dual solution. If an initial

starting guess is available it can be specified by the argument x0.

The qpOASES-solver was selected as the primary QP-solver to be used in this thesis.

Useful features such as the easiness of tracking interesting optimization properties (for

example the number of iterations needed for warm versus cold starts) along with the

obvious advantages of using an open-source solver were important attributes leading to

this decision.

6.3 Observer

The MPC-controller discussed in the previous sections requires the complete state

vector to be available in order to calculate an optimal control input to the vapor

compression system. This is the principal shortcoming of all state-feedback techniques

since all states need to be fed back and therefore measured. I many cases, full physical

knowledge of all system states often turns out to be either very expensive (requires a

great number of different sensor) or even difficult/impossible to achieve (as

measurements of the lengths of the moving boundaries between different fluid states

inside the evaporator and condenser). If the only accessible parameters are the system

inputs and a limited set of output, the solution is a state observer. The idea of a state

observer can be explained by the illustrations in Figure 6.2 and Figure 6.3. As can be

seen in Figure 6.2 the inputs to the observer are the system inputs u calculated by the

controller and two system outputs; evaporator pressure and superheat.

Page 122: Dynamic modeling and Model Predictive Control of a vapor

100

Figure 6.2 The complete system showing the observer block with its inputs and output.

The output from the observer is an estimated state vector . The estimated state vector

is calculated by first creating a model of the system to be controlled and then comparing

the difference between the model output and the actual system output. In order to

account for inaccuracies between the true system and the model used for the observer

an additional term is added to the observer; an estimation error . This term is seen in

Figure 6.3. If the estimated output equals the true output the error will be equal to

zero, i.e. that the estimated state vector is close to the true one. If not, the observer

recalculates the estimated state vector in order to minimize the error.

Figure 6.3 Observer subsystem.

Page 123: Dynamic modeling and Model Predictive Control of a vapor

101

The observer is therefore defined as

( ) (6.51)

where and are the estimated state and estimated output respectively. The matrix

is known as the Kalman gain matrix and is a weighting matrix that maps the differences

between the measured output and the estimated output. The gain matrix is a part of the

Kalman filter which is a set of mathematical equation designed to calculate an optimized

estimation of the system’s state. The Kalman filter requires a model of the system

(6.52)

where the process noise and measurement noise are added to the model given in

(6.2). The statistical properties of the process and measurement noise are given by

( ) ( ) 0 ( ) ( ) ( ) (6.53)

The algorithm then computes a state estimate that minimizes the steady-state error

covariance

l

([ ][ ] ) (6.54)

resulting in an optimal solution

( )

[ ] [

] [

0]

(6.55)

The gain matrix is calculated by solving an algebraic equation

( ) (6.56)

given that is the positive semidefinite solution to

( ) ( )

0 (6.57)

Page 124: Dynamic modeling and Model Predictive Control of a vapor

102

More information about the variables used in (6.56) ( ) and a detailed explanation

of how to algebraically solve the Riccati equation is given in [47]. For this thesis the gain

matrix is calculated using the MATLAB command kalman:

[kest,L,P] = kalman(sys,Q,R,N);

where kest is a state-space model of the Kalman estimator given the plant model sys

and the noise covariance data Q,R and N. L is the Kalman gain matrix and P the steady-

state error covariance matrix that solves the associated Riccati equation. Performance

and robustness of this observer is analyzed in the following chapter.

Page 125: Dynamic modeling and Model Predictive Control of a vapor

103

7 Result

7.1 Introduction

The MPC-controller from the previous chapter is implemented in the nonlinear SIMULINK-

model created in Chapter 4. As explained in Chapter 6, in order to fully take advantage of

the MPC-technology a detailed model of the system being controlled is required. The

model of choice is the linearized model derived in Chapter 5.3 using the linmod-

command in MATLAB. The QP software used for the optimization problem is the

qpOASES-solver presented in Chapter 6.2.7. In the following sections to come, controller

properties such as performance, robustness et cetera are analyzed in more detail. Last in

this chapter three scenarios are presented in an attempt to illustrate real world

situations where the vapor compression system and the controller could be

implemented. Worth noting is that the time scales in the plots in this particular section

may not necessarily reflect the time scales in an actual system. The reason for this is that

the model used for the simulation is based on the system given in [4] and since this is a

much smaller system than for example one controlling a large classroom or a house, the

time scales in the simulations will not agree with the time scales for the real systems.

7.2 Choice of parameters

When designing the MPC-controller, a number of parameters need to be defined. Some

of the most important parameters and how they are chosen are discussed in this section.

7.2.1 Sampling time,

Since the model used for MPC is a time-discrete model the controller’s sample time is a

parameter of great importance. It is vital to choose a sample time large enough to ensure

that no key system transitions are missed. On the other hand, making the sample time

smaller often results in a rapidly increasing computational workload. A common rule of

thumb when determining the sample time is to use a sample time with an order of

magnitude 10 times less than the dominant time constant [48]. The time constant

represents the time it takes the system’s step response to reach 63% of its final

(asymptotic) value. Two step response tests are thus performed where the compressor

Page 126: Dynamic modeling and Model Predictive Control of a vapor

104

and expansion valve settings are increased by 10% respectively. The step begins when

10 seconds has passed and as can be seen in Figure 7.1 to Figure 7.4, the step response

reaches 63% of its final value in approximately 2 to 5 seconds (the red dotted lines).

This implies that the sample time should be chosen somewhere in the interval of 0.2 to

0.5 seconds. To be on the safe side the sample time used for the controller is chosen to

be 0.1 seconds.

7.2.2 Horizons, and

As described in [47], it is important that the prediction horizon is chosen long enough

to cover the time it takes for the system to stabilize after a step response. Based on the

observations in the previous section and on the fact that a sample time of 0.1 seconds is

used, the prediction horizon is chosen to be 100 steps long. The control horizon along

with the number of controlled variables determines the complexity of the optimization

problem being solved at each control interval. Therefore it is often favorable to use as

Figure 7.1 Pressure step response with 10% increase in compressor setting.

Figure 7.2 Superheat step response with 10% increase in compressor setting.

Figure 7.3 Pressure step response with 10% increase in expansion valve setting.

Figure 7.4 Superheat step response with 10% increase in expansion valve

setting.

Page 127: Dynamic modeling and Model Predictive Control of a vapor

105

small control horizon as possible in order to minimize the amount of computation

needed for the controller. The dynamics of a vapor compression system are however

comparatively slow opposed to for example the dynamics in an aircraft. It was therefore

possible to use a control horizon as long as the prediction horizon.

7.2.3 Weighting matrices, and

The weighting matrices are diagonal matrices arranged as

( 00 00 0

) (0 0 00 0

) (7.1)

where penalizes deviations from the reference while penalizes the control signals.

Since the main objective of the vapor compression system is to meet the required

cooling demand despite changing environmental conditions the first controlled variable,

evaporator pressure, has a relatively large weighting element, ( ) 00. The

second controlled variable, evaporator superheat, does not have any weighting element

at all connected to it, ( ) 0. The reason for this is that the superheat is free to take

any value as long as it stays within the boundaries stated in Chapter 6.2.6.2, i.e. above a

specified minimum for safety and below a specified maximum for efficiency. This frees

the controller to pursue the primary goal of the evaporator, which is cooling of the

secondary fluid associated to it.

7.3 Simulation

7.3.1 MPC without integral action

To begin with, the system is simulated without integral action in the MPC-controller, i.e.

with the formulation given in Chapter 6.2.4. The result is seen in Figure 7.5 to Figure 7.8

and although the controller is capable of capturing most of the changes, the controlled

output does not reach the desired reference signal and an almost constant steady state

error is present the whole time. This is a motivation for why integral action is needed.

Page 128: Dynamic modeling and Model Predictive Control of a vapor

106

Figure 7.5 Trajectory tracking of evaporator pressure without integral action.

Figure 7.6 Evaporator superheat without integral action.

Figure 7.7 Compressor control signal. Figure 7.8 Expansion valve control signal.

Page 129: Dynamic modeling and Model Predictive Control of a vapor

107

7.3.2 MPC with integral action

The reason for why a steady state error was present in the previous section could have

multiple answers. One could be due to model mismatch but a more a more probable

explanation is that the steady state error is an optimal balance between a minimal QP

solution and the usage of a minimal control signal. For example, assume that the control

signal used to keep a certain system running at steady state is not exactly zero. This

means that, depending on the weighting matrices, there will always be either a steady

state error (in order to minimize the control signal, the system states will not be equal to

those in steady state) or a control signal not equal to zero (a certain amount of control

signal is needed to reach steady state). A workaround for this problem is to introduce

integral action in the controller. The procedure is explained in Chapter 6.2.5 and the

result is given in Figure 7.9 to Figure 7.12. As can be seen, the steady state error is gone

and the controlled output follows perfectly the given reference signal. The rise time and

settle time are satisfactory and the weighting matrices for the control signals in Figure

7.11 and Figure 7.12 seem to be in the right interval as the control signals vary within

reasonable magnitudes.

Figure 7.9 Trajectory tracking of evaporator pressure with integral action.

Page 130: Dynamic modeling and Model Predictive Control of a vapor

108

Figure 7.10 Evaporator superheat with integral action.

7.3.3 Controlled outputs constraints

The step sizes used in previous sections never really tested the constraints for the

second controlled output, evaporator superheat. To illustrate the constraint-handling

capabilities of MPC, a different step size combination was used and the result can be

seen in Figure 7.13 to Figure 7.16. It is obvious that when large step sizes are used

without any constraints the magnitude of the superheat will alter much more than

compared to when the constraints are implemented in the controller. Despite being

pushed harder, the controller never lets the superheat break the specified boundaries

while in the same time maintaining very effective trajectory tracking. This can be seen in

Figure 7.11 Compressor control signal.

Figure 7.12 Expansion valve control signal.

Page 131: Dynamic modeling and Model Predictive Control of a vapor

109

Figure 7.13 as the step-responses are almost identical when using the constraints

compared to not using them. There is a small peak in the pressure plot at seconds

when using the superheat constraints. This is most likely the result of the controller

adjusting the control signals in order to prevent the superheat to break the constraints.

This adjustment can be seen in Figure 7.15 and Figure 7.16 where the different control

signal approaches needed to account for the superheat constraints are very obvious.

Figure 7.13 Evaporator pressure with and without superheat constraints.

Figure 7.14 Evaporator superheat with and without superheat constraints.

Page 132: Dynamic modeling and Model Predictive Control of a vapor

110

7.3.4 Observer

As mentioned in Chapter 6.3, full physical knowledge of all system states are often hard

to achieve. This becomes problematic when using techniques such as MPC since it

requires the whole state vector being available for feedback. The simulations performed

so far in this chapter have assumed that it is, but since it is very unlikely that the

complete vector is even possible to measure in a real system, a state observer is

implemented. The system outputs being measure are the evaporator pressure and the

evaporator superheat. The performance of the controller when using a state observer

can be seen in Figure 7.17 to Figure 7.22 where it is compared to the results when the

full state vector is known. Both the trajectory tracking in Figure 7.17 and the superheat

in Figure 7.18 are almost identical when using the observer compared to full state

feedback. A comparison between the first system state and the first observer state is

given in Figure 7.21, and Figure 7.22 is an illustration showing the difference between

the actual state vector and the estimated state vector, i.e. . This means that if the

estimated states are close to the real states the expression will be close to zero. It

can be seen that most lines in Figure 7.22 are centered on zero, meaning that the

estimated states are valid approximations of the real states. Nevertheless, one estimated

state deviates more than the other estimated states. It is the condenser enthalpy and

why this estimation deviates more than the other is hard to say. A lot of dynamics both

in the evaporator and in the condenser are linked to this state and this might be an

Figure 7.15 Compressor control signal with and without superheat constraints.

Figure 7.16 Expansion valve control signal with and without superheat

constraints.

Page 133: Dynamic modeling and Model Predictive Control of a vapor

111

explanation for why the observer was unable to perfectly estimate the state. However,

since the value of the condenser enthalpy at steady state is approximately 250 kJ/kg,

this is an acceptable error.

Figure 7.17 Evaporator pressure with and without observer.

Figure 7.18 Evaporator superheat with and without observer.

Page 134: Dynamic modeling and Model Predictive Control of a vapor

112

7.3.5 qpOASES-solver

As mentioned in Chapter 6.2.7, the QP-solver used in this thesis includes some

interesting features such as the number of iterations needed for warm versus cold starts

and indications of whether each optimization problem could be solved or not. The plots

from the simulation carried out in the previous section are extended with these two

particular features. Figure 7.23 gives information about whether each optimization

problem could be solved or not. As long as the line is centered on zero, each optimization

Figure 7.19 Compressor control signal with and without observer.

Figure 7.20 Expansion valve control signal with and without observer.

Figure 7.21 Comparison between first system state and first observer state.

Figure 7.22 Difference between system states and observer states.

Page 135: Dynamic modeling and Model Predictive Control of a vapor

113

was solved without any problem during the simulation. The different fault messages

currently available are:

0: QP solved.

1: QP could not be solved with given number of iterations.

-1: QP could not be solved due to an internal error.

-2: QP is infeasible and thus could not be solved.

-3: QP is unbounded and thus could not be solved.

This means that if any faults were reported this would show in Figure 7.23 as a line from

zero to any of the above given values.

Figure 7.23 Exitflags from the simulation.

A comparison between the number of iterations needed to solve each QP when using

cold versus warm start is shown in Figure 7.24. When using cold start the solver takes

all QP-data and if specified, the maximum number of working set recalculations along

with an initial primal solution, for solving the first QP. This procedure is then repeated

for the next optimization problem. When using the warm start option, the solver takes

advantage of the previous QP solution (the procedure for the first solution is in other

words identical regardless when using cold or warm start). The previous QP solution is,

along with the maximum number of working set recalculations, used to calculate the

new QP solution. As seen in Figure 7.24 this is a very efficient method for solving QPs.

Page 136: Dynamic modeling and Model Predictive Control of a vapor

114

Note that the number of iterations needed for the first solution is identical for both cold

and warm start.

Figure 7.24 Number of iterations needed for QP solutions using either cold or warm start.

7.3.6 Disturbance performance

In the previous sections certain system outputs have been fed to the observer which

then in turn estimates the complete state vector. In the real world, these outputs

obviously need to be measured in order to be available for the observer. Regardless of

what type of measurement device being used, there will always be some degree of

measurement noise present. In order to examine how well the controller performs in a

noise environment, band-limited white noise is added to the system outputs. The noise

power is approximately 1% of the magnitude of the outputs. The result is seen in Figure

7.25 to Figure 7.30 and despite the relatively large noise the controller in combination

with the observer can still adapt to the varying set points.

Page 137: Dynamic modeling and Model Predictive Control of a vapor

115

Figure 7.25 Evaporator pressure with noise added to the output.

Figure 7.26 Evaporator superheat with noise added to the output.

Figure 7.27 Compressor control signal when noise is added to system outputs.

Figure 7.28 Expansion valve control signal when noise is added to system

outputs.

Page 138: Dynamic modeling and Model Predictive Control of a vapor

116

7.3.7 Three simulation scenarios

To conclude this chapter, three different scenarios are simulated in an attempt to

illustrate real world situations. The aim is to demonstrate how changes in

environmental conditions affect the vapor compression system and especially the MPC-

controller.

7.3.7.1 Scenario 1

The purpose of this scenario is to demonstrate a vapor compression system and a MPC-

controller connected to a thermostat located in a conference room. The objective for the

controller is to maintain a predefined room temperature. The simulation illustrates a

scenario where the room initially is empty and then quickly fills with people, i.e. the

cooling capacity suddenly increases. The result is seen in Figure 7.31 to Figure 7.36 and

it can be observed that the controller effectively adapts to the new set point, thereby

maintaining a comfortable climate for the people in the conference room. Note that the

number of iterations needed for qpOASES is around 60 in the beginning. A comparison is

also made between using and not using superheat constraints. In Figure 7.32 it is clear

that the superheat varies to a greater extent without the constraints and is even

dangerously close to zero degrees Celsius. If the superheat is completely lost there is a

great risk of breaking the compressor. When the constraints are implemented the

superheat breaks the lower boundary for a short period of time but the controller then

quickly brings it back. It is hard to tell why the superheat momentarily breaks the

Figure 7.29 Value of exitflag when noise is added to the output.

Figure 7.30 Number of iterations needed for QP solution using either cold or warm start.

Page 139: Dynamic modeling and Model Predictive Control of a vapor

117

constraints. An explanation could be due to model mismatch since the MPC-controller

uses a linearized model to control a nonlinear system. However, the superheat is only

briefly outside the boundaries and is almost instantly brought back within the

constraints. So, by keeping the superheat within the specified boundaries the heat

transfer of the evaporator remains high thereby making the system more efficient.

Figure 7.31 Evaporator pressure and pressure reference for scenario 1.

Figure 7.32 Evaporator superheat and with and without superheat constraints for scenario 1

Page 140: Dynamic modeling and Model Predictive Control of a vapor

118

7.3.7.2 Scenario 2

In the second scenario, the aim is to illustrate a vapor compression system and a MPC-

controller connected to an outdoor thermostat. This thermostat measures the

temperature and this information is used to regulate the indoor temperature. To

simulate the temperature variations between day and night a sinus-block is used. The

result can be seen in Figure 7.37 to Figure 7.42, and the controller once again does a nice

job and accurately follows the shifting cooling set points. In Figure 7.38 it is seen that

without superheat boundaries the superheat starts to drift after about 70 seconds and

continue to increase throughout the whole simulation. This means that most of the heat

transfer in the evaporator is carried out by a gaseous refrigerant rather than the much

Figure 7.33 Compressor control signal.

Figure 7.34 Expansion valve control signal.

Figure 7.35 Value of exitflag.

Figure 7.36 Number of iterations.

Page 141: Dynamic modeling and Model Predictive Control of a vapor

119

more efficient two-phase refrigerant. Recalling from Chapter 2 that the heat transfer

between a two-phase refrigerant and water is approximately 2.8 kW/m2K compared to

0.35 kW/m2K for a purely gaseous refrigerant and one quickly realizes that this is a

highly inefficient way of running a vapor compressor system. But with the constraints

implemented the superheat is nicely stationed between the boundaries and the machine

is as a result running much more efficient.

Figure 7.37 Evaporator pressure and pressure reference for scenario 2.

Figure 7.38 Evaporator superheat with and without superheat constraints for scenario 2.

Page 142: Dynamic modeling and Model Predictive Control of a vapor

120

7.3.7.3 Scenario 3

The third and last scenario aims to demonstrate a vapor compression system with a

MPC-controller connected to a thermostat in a school classroom. The controller’s goal is

to maintain a constant room temperature but since the students have breaks the cooling

set points changes as the room frequently switches between being empty and full of

students. This scenario is displayed in Figure 7.43 to Figure 7.48 and despite the

relatively fast set point changes the controller steers the pressure close to the given

reference values. In Figure 7.44 it is once again seen that without the constraints the

superheat drifts away making the vapor compression system running much less

Figure 7.39 Compressor control signal.

Figure 7.40 Expansion valve control signal.

Figure 7.41 Value of exitflag.

Figure 7.42 Number of iterations needed. Note that the number of

iterations needed for qpOASES is around 60 in the beginning.

Page 143: Dynamic modeling and Model Predictive Control of a vapor

121

efficient. This illustrates once more the important constraint handling capabilities of

MPC.

Figure 7.43 Evaporator pressure with pressure reference for scenario 3.

Figure 7.44 Evaporator superheat with and without superheat constraints for scenario 3.

Page 144: Dynamic modeling and Model Predictive Control of a vapor

122

Figure 7.45 Compressor control signal.

Figure 7.46 Expansion valve control signal.

Figure 7.47 Value of exitflag.

Figure 7.48 Number of iterations. Note that the number of iterations needed for qpOASES is around 60 in the beginning.

Page 145: Dynamic modeling and Model Predictive Control of a vapor

123

8 Conclusions

This thesis presents a control architecture for a vapor compression system connected to

an MPC-controller. The goal of the controller is to regulate the evaporator pressure in

order to meet current cooling demands and at the same time keep the evaporator

superheat within specified constraints. The MPC-controller uses a linearized model of

the vapor compression system for the calculation of the optimal control sequence. The

MPC-controller requires the complete state vector being available for feedback and since

it is very unlikely that all system states can or will be measured, a state observer was

used to provide the full state vector. The control architecture was successful in achieving

the control objective, i.e. it was shown to be adaptable in order to reflect changes in

environmental conditions. Cooling demands were met and the superheat was

successfully kept within given boundaries. On top of that the control algorithm can be

tuned by placing different weights on set point error and on superheat constraints. This

flexibility means that the control objective can be customized for different situations

depending on the user’s need.

Page 146: Dynamic modeling and Model Predictive Control of a vapor

124

9 Future work

The MPC-methodology has shown to be promising for the objective of controlling a

vapor compression system. The results from this thesis clearly need verification on a

real system but from a theoretical point of view there are a number of interesting

features worth more attention. The model used in this thesis could obviously be

improved. Several assumptions were made when deriving it and in order to obtain a

more accurate model some of these assumptions could be replaced by more detailed

descriptions. There are also many potential openings for the MPC-technique in defining

new optimization problems for the QP-solver. Since the compressor is the largest

energy-consumer, an optimization problem where the compressor speed is minimized

while still being able to follow a given pressure set point would be an interesting

concept to investigate. Also, the superheat constraints could tighten into a much smaller

interval to ensure a satisfactory heat transfer. An algorithm like that would definitely

have some energy-saving potentials but it must first be verified that this design does not

jeopardize system performance. On top of this there is the possibility of tuning the

weighting matrices. Additional costs could be placed on cooling, superheat handling,

energy consumption et cetera. The alternatives are countless and this is what makes the

MPC-technology such an interesting field for future research.

Page 147: Dynamic modeling and Model Predictive Control of a vapor

125

Bibliography

1 Energy Information Administration: A Look at Residential Energy Consumption in 1997.

2002-03-01. http://www.eia.doe.gov/emeu/recs/contents.html.

2 Final Electricity Consumption: Eurostat (historical data). 2012-03-05.

http://ec.europa.eu/eurostat/.

3 Rasmussen, B. Control-oriented modeling of transcriptical vapor compression systems.

University of Illinois, Utah, USA, 2000.

4 Frink, B. Modeling and construction of a computer controlled air condition system.

Department of Mechanical and Nuclear Engineering College of Engineering, Kansas

University, Kansas, 2005.

5 He, X. Dynamic modeling and multivariable control of vapor compression cycles in air

conditioning systems. Massachusetts Institute of Technology. Dept. of Mechanical

Engineering, Massachusett, 1996.

6 Shah, R., Alleyne, A. G., Bullard, C. W., Rasmussen, B. P. and Hrnjak, P. S. Dynamic

modeling and control of single and multiple-evaporator subscritical vapor compression

systems. University of Illinois, Utah, USA, 1999.

7 Woods, F. S. Advanced Calculus: A Course Arranged with Special Reference to the Needs of

Students of Applied Mathematics. Ginn, Boston, 1926.

8 Bendapudi, S. and Braun, J. E. A Review of Literature on Dynamic Models of Vapor

Compression Equipment. May 2002.

9 Brandon, G. and Asada, H. Modeling, Realization, and Simulation of Thermo-Fluid

Systems Using Singularly Perturbed Sliding Manifolds. J. Dyn. Sys., Meas., Control , 122, 4

(Dec 2000), 699-708.

10 He, X., Sheng, L. and Asada, H. Modeling of vapor compression cycles for advanced

Page 148: Dynamic modeling and Model Predictive Control of a vapor

126

controls in HVAC systems. American Control Conference, 5 (Jun 1995), 3664-3668.

11 Hewitt, G.F., Shires, G.L. and Polezhaev, Y.V. International Encyclopedia of Heat and Mass

Transfer. CRC Press, 1997.

12 Rice, C. K. Effect of Void Fraction Correlation and Heat Flux Assumption on Refrigerant

Charge Inventory Predictions. ASHRAE Transactions, 93, 1, 341-367.

13 Wilson, M. J., Newell, T. A. and Chato, J. C. Experimental Investigation of Void Fraction

During Horizontal Flow in Larger Diameter Refrigeration Applications. Uinversity of

Illinois, Illinois, USA, 1998.

14 Wedekind, G. L., Bhatt, B. L., and Beck, B. T. A System Mean Void Fraction Model for

Predicting Various Transient Phenomena Associated with Two-Phase Evaporating and

Condensing Flows. Int. J. Multiphase Flow, 4 (1978), 97-114.

15 McQuiston, F and Parker, J. Heating, Ventilating and Air Conditioning. Wiley, 2005.

16 Ueno, K. and Bye, R.E. Compressor Efficiency Definitions. University of Colorado,

Colorado, 2003.

17 Bloch, H. and J., Hoefner. Reciprocating Compressors - Operation & Maintenance.

Butterworth-Heinemann, Houston, TX., 1996.

18 Blissfield. Application Manual - Belt Driven Compressors. Blissfield Manuafacuring

Company, Blissfield, USA, 2011-10-18.

19 Solvay Flour. Solkane® 134a Thermodynamics. 2011-10-12.

http://www.refripro.eu/fic_bdd/fluides_pdf_fichier/11630952540_SOLKANE_134a.pdf.

20 Thomas, P. Simulation of Industrial Processes for Control Engineers. Butterworth-

Heinemann, 1999.

21 Stegou-Sagia, A. and Katsanos, D. On isentropicchanges of alternative refrigerants (R-

123, R-134a, R-500, R-503). Energy, 21, 12 (December 1996), 1071-1077.

Page 149: Dynamic modeling and Model Predictive Control of a vapor

127

22 Stock.XCHNG. 2012. http://www.sxc.hu/.

23 Shanwei, M. et. al. Experimental research on refrigerant mass flow coefficient of

electronic expansion valve. Applied Thermal Engineering, 25, 14-15 (October 2005),

2351-2366.

24 Abuaf, N., Jones, O. C., Jr., and Wu, B. J. C. Critical flashing flows in nozzles with subcooled

inlet conditions. ASME, Transactions, Journal of Heat Transfer, 105 (May 1983), 379-383.

25 Sporlan. Sporlan Electric Expansion Valves. Parker Hannifin Corporation, Sporlan

Division, Washington, USA, 2011-10-19.

26 Elliott, M.S. and Rasmussen, B.P. A model-based predictive supervisory controller for

multi-evaporator HVAC systems. American Control Conference, 2009. ACC '09. (June

2009), 3669-3674.

27 White, F. M. Fluid Mechanics. McGraw-Hill, New Jersey, 1994.

28 Yunus, C., Tuner, R. Fundamentals of thermal-fluid science. McGraw-Hill, 2005.

29 DuPont. Suva® 134a refrigerant. 2012-01-30.

http://www2.dupont.com/Refrigerants/en_US/products/Suva/Suva134a.html.

30 Finn, D.P. and Doyle, C.J. Control and optimization issues associated with algorithm-

controlled refrigerant throttling devices. algorithm-controlled refrigerant throttling

devices, 106 (Jul 2000), 524-533.

31 Outtagarts, A., Haberschill, P. and Lallemand, M. The transient response of an

evaporator fed through an electronic expansion valve. International Journal of Energy

Research, 21 (1997), 793-807.

32 Gruhle, W. and Isermann, R. Modeling and control of a refrigerant evaporator. ASME

Journal of Dynamic Systems Measurement & Control, 107 (Dec 1985), 235-240.

33 He, X., Liu, S. and Asada, H. Modeling of vapor compression cycles for multivariable

Page 150: Dynamic modeling and Model Predictive Control of a vapor

128

feedback control of HVAC systems. Journal of Dynamic Systems Measurement and

Control, 119 (Jun 1997), 183-191.

34 Parnitzki, D. Digital control of heat pumps with minimized power consumption.

International Journal of Energy Research, 13 (1989), 167-179.

35 MathWorks. R2011b Product Documentation → Simulink→ linmod. 2012-02-03.

http://www.mathworks.se/help/toolbox/simulink/slref/linmod.html.

36 Elliott, M.S. Decentralized model predictive control of a multiple evaporator HVAC. Texas

A&M University, Texas, 2008.

37 Qin, J. and Badgwell, T. A survey of industrial model predictive control technology.

Control Engineering Practice, 11 (2003), 733-764.

38 Enqvist, M. et al. Industriell Reglerteknik - Kurskompendium. Linköpings universitet,

Linköping, 2010.

39 Foundation, C.O. Computational infrastructure for operations research. 2008.

http://www.coin.org/.

40 Wang, L. Model Predictive Control System Design and Implementation Using MATLAB®.

Springer, London, 2009.

41 Camacho, E. and Bordons, C. Model Predictive Control. Springer, London, UK.

42 Computing, Applied Mathematics and Parallel. Best, M.J. Physica-Verlag, Heidelberg,

1996.

43 Ferreau, H.J., Bock, H. G. and Diehl, M. An online active set strategy to overcome the

limitations of explicit MPC. International Journal of Robust and Nonlinear Control, 18, 8

(2008), 816-830.

44 Ferreau, H.J. An Online Active Set Strategy for Fast Solution of Parametric Quadratic

Programs with Applications to Predictive Engine Control. University of Heidelberg, 2006.

Page 151: Dynamic modeling and Model Predictive Control of a vapor

129

45 Potschka, A., Kirches, C., Bock, H.G. and Schlöder, J.P. Reliable solution of convex

quadratic programs with parametric active set methods. Interdisciplinary Center for

Scientic Computing, Heidelberg University, 2010.

46 Ferreau, H.J., et al. qpOASES User's Manual. Optimization in Engineering Center (OPTEC)

and Department of Electrical Engineering, K. U. Leuven, 2011.

47 Ljung, L. and Glad, T. Reglerteori - flervariabla och olinjära metoder. Linköping, 2003.

48 Svrcek, W., Mahoney, D. and Young, B. A Real-Time Approach to Process Control. Wiley,

2006.

49 Love, J. Process automation handbook : a guide to theory and practice. Springer-Verlag,

2007.

50 Castel. Product Handbook 2009. Castel s.r.l., Milano, Italy, 2011-10-19.

51 Høgh, G. and Nielsen, R. Model Based Nonlinear Control of Refrigeration Systems. Aalborg

Universitet, Aalborg, 2008.

52 Kattan, N., Thome, J.R., and Favrat, D. “Flow boiling in horizontal tubes: Part 3 –

Development of a new heat transfer model based on flow pattern. ASME Journal of Heat

Transfer, 120, 1 (1998), 156-165.

53 Kattan, N., Thome, J.R., and Favrat, D. Flow boiling in horizontal tubes: Part 1 –

Development of diabatic two-phase flow pattern map. ASME Journal of Heat Transfer,

120, 1 (1998), 140-147.

54 Kattan, N., Thome, J.R., and Favrat, D. Flow boiling in horizontal tubes: Part 2 –New heat

transfer data for five refrigerants. ASME Journal of Heat Transfer, 120, 1 (1998), 48-155.

55 The Air Conditioning, Heating, Regrigeration News. 2012-01-26.

http://www.achrnews.com/NEWS/2004/31/Files/Images/108755.jpg.

56 Shah, R., Rasmussen, B. and Alleyne, A. Application of a multivariable adaptive control

Page 152: Dynamic modeling and Model Predictive Control of a vapor

130

strategy to automotive air conditioning systems. International Journal of Adaptive

Control and Signal Processing, 18, 2 (March 2004), 199-221.

57 Keir, M.C. and Alleyne, A.G. Dynamic Modeling, Control, and Fault Detection in Vapor

Compression Systems. University of Illinois, Illinois, USA, 2006.

58 Yearbook Statistical Energy Review 2010. 2012-03-04.

http://yearbook.enerdata.net/2009/energy-consumption.html.