USING BUILDING SIMULATION AND … BUILDING SIMULATION AND OPTIMISATION TO CALCULATE CONTROL LOOKUP...

8
USING BUILDING SIMULATION AND OPTIMISATION TO CALCULATE CONTROL LOOKUP TABLES OFFLINE Brian Coffey University of California, Berkeley ABSTRACT Model Predictive Control (MPC) uses a system model and optimisation algorithm within the controller, cal- culating the best set-points at each time step given the current and predicted weather, occupancy, and other conditions. It is an established technique in other fields and has been receiving growing attention by buildings researchers, but has yet to find its way into common practice in this field. This paper presents a modi- fied approach that uses pre-calculation of optimal set- points over a grid of possible conditions and interpola- tion of the resulting lookup table for real-time control. Methodological details are considered and the range of applicability and relative performance is discussed, referencing case studies. Open-source software for this approach is also presented. It is hoped that the methods and software will provide researchers, de- signers and operators with a practical way to devise better supervisory controls for low-energy buildings. INTRODUCTION With a growing demand for more energy efficient buildings, designers are being pushed to integrate pre- viously independent systems such as HVAC and solar shading, to make use of site and program peculiari- ties like local heat sources and sinks, and to use lower power density HVAC systems such as radiant cooling and natural ventilation. Intelligent operation of these more complex and integrated systems is often crucial to their success; designing control strategies must be an integrated part of the design process. But designing good controls for such systems is challenging. Online MPC Online MPC offers a way of approaching such prob- lems. Instead of trying to define the control logic ex- plicitly, a building model and an optimisation algo- rithm are used within the control system in real-time to calculate the best setpoint values given the current and predicted conditions. At each controller time step, an optimal sequence of control values over a predic- tion horizon is calculated, only the first of which is implemented, and at the next controller time step the horizon shifts forward one step and the process is re- peated. (Note that a number of variants on this are also possible, such as implementing two or more time steps of inputs and performing the optimisation less often, or having different control and prediction hori- zon lengths.) MPC is widely used in other fields (Qin and Badgwell (2003) notes its use in more than 4,000 industrial applications). It is well suited to the control of non-linear systems with strong state constraints but relatively slow system dynamics, which is often found in chemical process control. It was a proven practi- cal technique before it was studied theoretically. Good overviews of the field are available in Morari and Lee (1999) and Mayne et al. (2000). There has also been a growing number of MPC studies for building systems over the past decade, stemming not from controls re- search but from building energy simulation research. (See for example Mahdavi (2001), Clarke et al. (2002), Henze et al. (2005), and see the review in Coffey et al. (2010). The paper by Clarke et al also compares MPC to fuzzy logic and neural network controllers, noting the various benefits of having a physics-based model in the controller, including the avoidance of a learn- ing period.) Some more recent work has come from controls researchers from other fields turning their at- tention to buildings (e.g. Ma et al. (2010) and Old- ewurtel et al. (2010)). Potential for energy savings, demand reduction and performance improvement has been shown with a wide variety of systems, includ- ing chilled water storage, radiant slab pre-cooling and integrated HVAC and facade control. And as build- ings become more complex the benefits of MPC are expected to become more pronounced. But MPC is currently far from common practice in building design and operation. It is difficult to use most building simulation tools for this because of their slow run-times and the fact that many do not allow the user to explicitly specify initial state values, and the software used by most controls researchers is unfamil- iar to most buildings researchers and practitioners. In addition, online optimisation is difficult to implement with existing building control systems, and the fact that the control logic is implicit rather than explicit makes it difficult for system designers to integrate it into their design processes. Offline optimization For some types of MPC problems, multiparametric programming can be used to solve the problem explic- itly, providing a set of control laws that fully cover the conditions space and that exactly replicate con- Proceedings of Building Simulation 2011: 12th Conference of International Building Performance Simulation Association, Sydney, 14-16 November. - 2439 -

Transcript of USING BUILDING SIMULATION AND … BUILDING SIMULATION AND OPTIMISATION TO CALCULATE CONTROL LOOKUP...

Page 1: USING BUILDING SIMULATION AND … BUILDING SIMULATION AND OPTIMISATION TO CALCULATE CONTROL LOOKUP TABLES OFFLINE Brian Coffey University of California, Berkeley ABSTRACT

USING BUILDING SIMULATION AND OPTIMISATIONTO CALCULATE CONTROL LOOKUP TABLES OFFLINE

Brian CoffeyUniversity of California, Berkeley

ABSTRACTModel Predictive Control (MPC) uses a system modeland optimisation algorithm within the controller, cal-culating the best set-points at each time step given thecurrent and predicted weather, occupancy, and otherconditions. It is an established technique in other fieldsand has been receiving growing attention by buildingsresearchers, but has yet to find its way into commonpractice in this field. This paper presents a modi-fied approach that uses pre-calculation of optimal set-points over a grid of possible conditions and interpola-tion of the resulting lookup table for real-time control.Methodological details are considered and the rangeof applicability and relative performance is discussed,referencing case studies. Open-source software forthis approach is also presented. It is hoped that themethods and software will provide researchers, de-signers and operators with a practical way to devisebetter supervisory controls for low-energy buildings.

INTRODUCTIONWith a growing demand for more energy efficientbuildings, designers are being pushed to integrate pre-viously independent systems such as HVAC and solarshading, to make use of site and program peculiari-ties like local heat sources and sinks, and to use lowerpower density HVAC systems such as radiant coolingand natural ventilation. Intelligent operation of thesemore complex and integrated systems is often crucialto their success; designing control strategies must bean integrated part of the design process. But designinggood controls for such systems is challenging.

Online MPCOnline MPC offers a way of approaching such prob-lems. Instead of trying to define the control logic ex-plicitly, a building model and an optimisation algo-rithm are used within the control system in real-timeto calculate the best setpoint values given the currentand predicted conditions. At each controller time step,an optimal sequence of control values over a predic-tion horizon is calculated, only the first of which isimplemented, and at the next controller time step thehorizon shifts forward one step and the process is re-peated. (Note that a number of variants on this arealso possible, such as implementing two or more timesteps of inputs and performing the optimisation less

often, or having different control and prediction hori-zon lengths.) MPC is widely used in other fields (Qinand Badgwell (2003) notes its use in more than 4,000industrial applications). It is well suited to the controlof non-linear systems with strong state constraints butrelatively slow system dynamics, which is often foundin chemical process control. It was a proven practi-cal technique before it was studied theoretically. Goodoverviews of the field are available in Morari and Lee(1999) and Mayne et al. (2000). There has also been agrowing number of MPC studies for building systemsover the past decade, stemming not from controls re-search but from building energy simulation research.(See for example Mahdavi (2001), Clarke et al. (2002),Henze et al. (2005), and see the review in Coffey et al.(2010). The paper by Clarke et al also compares MPCto fuzzy logic and neural network controllers, notingthe various benefits of having a physics-based modelin the controller, including the avoidance of a learn-ing period.) Some more recent work has come fromcontrols researchers from other fields turning their at-tention to buildings (e.g. Ma et al. (2010) and Old-ewurtel et al. (2010)). Potential for energy savings,demand reduction and performance improvement hasbeen shown with a wide variety of systems, includ-ing chilled water storage, radiant slab pre-cooling andintegrated HVAC and facade control. And as build-ings become more complex the benefits of MPC areexpected to become more pronounced.But MPC is currently far from common practice inbuilding design and operation. It is difficult to usemost building simulation tools for this because of theirslow run-times and the fact that many do not allow theuser to explicitly specify initial state values, and thesoftware used by most controls researchers is unfamil-iar to most buildings researchers and practitioners. Inaddition, online optimisation is difficult to implementwith existing building control systems, and the factthat the control logic is implicit rather than explicitmakes it difficult for system designers to integrate itinto their design processes.

Offline optimizationFor some types of MPC problems, multiparametricprogramming can be used to solve the problem explic-itly, providing a set of control laws that fully coverthe conditions space and that exactly replicate con-

Proceedings of Building Simulation 2011: 12th Conference of International Building Performance Simulation Association, Sydney, 14-16 November.

- 2439 -

Page 2: USING BUILDING SIMULATION AND … BUILDING SIMULATION AND OPTIMISATION TO CALCULATE CONTROL LOOKUP TABLES OFFLINE Brian Coffey University of California, Berkeley ABSTRACT

trol behaviour of online MPC (Bemporad et al., 2002).However, this can only be used with certain types ofMPC problems (e.g. linear or switched-linear mod-els with linear or switched-linear objective functions),into which most of the challenging building controlproblems do not fit. And with the possible future ex-ception of Modelica (Wetter, 2009b), this approachwould not be possible with any of the commonly usedbuilding simulation tools.But the idea of explicit MPC is very appealing forbuildings applications, because it would be easier toimplement in existing building control systems thanonline MPC, and being able to visualize optimal con-trol responses over the full conditions space could pro-vide useful feedback during system design. Findingways to approximate it using common building simu-lation tools could thus be worthwhile, even if it bringswith it some performance penalties relative to onlineMPC. Current work by May-Ostendorp and Henzeconsiders the approach of simulating online MPC oversome or all of a representative weather year and thenusing statistical techniques to derive near-optimal con-trol laws from the results. This could provide a usefulway of getting these benefits. The research presentedherein (and in more detail in (Coffey, 2011)), consid-ers the following approach: define a grid of conditions(initial states and predicted disturbances) that coversthe range of what the system will face, solve the MPCoptimisation problem at each point in the grid, andthen use the resulting grid of optimal control responsesas an interpolation lookup table in real-time control.

METHODSOffline optimisation over a grid of conditionsOpen-source software for MPC with standard buildingsimulation tools was developed in previous research(Coffey et al., 2010), using GenOpt (Wetter, 2009a)as the optimizer, which allows for the use of any text-file based building simulation tool that can be calledfrom the command line. Figure 1 shows the same basicstructure being used to calculate control lookup tables.

SimCon

GenOpt

sim tool

Organization

Optimization

Simulation

setpoints

Real Buildingor Annual Simulation

conditions

grid ofconditions

setpointsfor each

grid point

interpolationlookup

table

Offline(before annual simulation

or implementation)

Online

Figure 1: Offline optimisation over conditions grid

Given a model of the building and/or system of inter-est, the steps involved in using this process are:

• Create template input files by demarcating thecontrol variables (with %) and conditions vari-ables (with $) in the model and weather files, andlocate the objective function in the output file.

• Define bounds and precisions for the control vari-ables, and define conditions variables to be usedin the grid (this may be a smaller set than the con-ditions variables used in the model, as discussedbelow) along with bounds and spacings for thegrid. Configure GenOpt and SimCon with these.

• Use SimCon and GenOpt to solve for the optimalcontrol values at each point in the conditions grid.This is usually a computationally expensive pro-cess, but is easily parallelized, and with the use ofmany virtual machines on now easily-accessiblecloud computing platforms, the question is moreabout money than about time.

• The resulting grid of optimal control values canthen be used as an interpolation lookup tablefor control in simulated or physical implementa-tions, and the multidimensional grid can be visu-alized through scatter plots or by graphing 2- or3-dimensional slices through it, providing impor-tant feedback to the design process.

• This process can be used iteratively. It is wiseto start by solving with a very coarse grid, andpossibly with fewer conditions or control vari-ables, fixing model bugs or adjusting objectivesand bounds based on the feedback from the gridvisualizations, and then building up the precisionof the lookup table over 3 or 4 (or possibly more)iterations, keeping grid point solutions from theprevious iteration if no changes were made.

Range of applicabilityThe basis for Figure 2 below is simply that the com-putation time required for lookup table creation is theproduct of the conditions grid size and the averagecomputation time per grid point. The dollar costs arebased on $0.10 / processor-hour, which is roughly thecurrent commercial cloud computing cost for small-scale users. The shaded area is a conservative cut-offfor financial feasibility for a consulting or design firmworking on a single building, assuming some iterationin the process. The figure highlights the trade-offs be-tween model complexity, optimisation precision andgrid spacing, and shows the scale of problems thatare feasible - simulation time must be within seconds(note that this is over a simulation horizon of hours ordays, rather than a full year), and the number of con-ditions variables must be kept to less than roughly 5or 6. As such, this approach usually requires approx-imations to limit the dimensionality of the lookup ta-ble. Much of the research described herein is aimed atbetter understanding the performance costs associatedwith various approximation techniques.

Proceedings of Building Simulation 2011: 12th Conference of International Building Performance Simulation Association, Sydney, 14-16 November.

- 2440 -

Page 3: USING BUILDING SIMULATION AND … BUILDING SIMULATION AND OPTIMISATION TO CALCULATE CONTROL LOOKUP TABLES OFFLINE Brian Coffey University of California, Berkeley ABSTRACT

minutes per optimization(minutes per sim * ave number of sims per optimization)

cond

itio

ns g

rid

size

(num

ber

of v

alue

s pe

r co

nditi

on

to th

e po

wer

of t

he n

umbe

r of

con

ditio

ns)

0

2000

4000

6000

8000

10000

12000

14000

16000

18000

20000

0 5 10 15 20 25 30

5

5

10

10

20

20

6

5

4

3

32

5000 processor hours ($500)

2000 processor hours ($200)

1000 processor hours ($100)500 processor hours ($50)

100 processor hrs ($10)

200 processor hours ($200)

Figure 2: Computational requirements

Approximation techniquesConsider a control problem that requires day-aheadpredictions of ambient temperatures, such as theovernight cooling of a massive chilled floor or ceiling.If hourly predictions were used, this would require 24dimensions in the conditions grid just for the ambienttemperature, making the offline solution computation-ally infeasible. One way of decreasing the dimension-ality is to use a coarser prediction, for example usingaverage temperatures for 4-hour blocks instead of 1-hour blocks. Another approach is to take advantageof the expected shape of the curve, and use a smallnumber of parameters to define the prediction, such asthe maximum and minimum temperatures and maybethe time of their occurance. In any such variation,a normalized curve is required to produce the valuesof the temperature at each timestep of the simulation,based on the predicted values of the parameters. Nor-malized curves can be derived using typical or histor-ical data for the site or system under consideration, asdemonstrated below. Similar approaches can be usedfor other disturbance variables.Even with the approximations of input parametriza-tion, many control problems in buildings still havetoo many dimensions to be tractable as lookup ta-bles. However, the approach may still be useful insuch a case, if the structure of the problem allows itto be decomposed into a hierarchical set of problemswhere some of the subproblems are small enough tobe solved offline. This is discussed in detail and usedin case studies in (Coffey, 2011).

Open-source software to facilitate approachThe SimCon beta software described in (Coffey et al.,2010) has been extended to be used for this offlineapproach. It is written in java, and the source codeis freely available for download (site tdb). The soft-ware’s current functionality includes: the option ofrunning in either online MPC mode or in lookup ta-ble calculation mode, so the same software can stillbe used for online MPC, including cases with de-composed problems that involve a higher-level prob-lem that must be solved online and lower-level prob-

lems that can be solved offline as lookup tables; coremethods to set up a sequence of optimisation prob-lems for a user-defined conditions grid, solve themusing GenOpt, and record the results to a lookup ta-ble file; multi-variable interpolation for lookup ta-bles stored in a text file; and an extensible library ofalgorithms to convert conditions inputs to and fromparametrized forms. Peripheral components are alsoincluded in the open source code, including samplefiles for running annual simulations with the controllerin the Building Control Virtual Test Bed (BCVTB,Wetter and Haves (2008)), java methods for collect-ing weather predictions from the National DigitalForecast Database, sample java-based interfaces forhuman-in-the-loop implementations, and a visualiza-tion tool for the lookup tables and a weather conditionsparametrization tool, both currently in Excel-VBA.

ILLUSTRATIVE CASE STUDYThis simple case study illustrates the basics of the pro-cedure. Because the problem is small, no problem de-composition or conditions parametrization is required.Consider a single south-facing zone with automatedexternal shading and automated natural ventilation. Asupervisory controller must determine hourly setpointsfor the shading percentage (defined as the percentagedecrease in solar gains, not necessarily a linear func-tion of the shade angle) and natural ventilation per-centage (defined as the number of air changes per hourrelative to minimum and maximum possible values) tominimize the combined heating, cooling and lightingenergy consumption. To keep the problem simple, thezone is considered as massless, glare is not consideredin the shading control, a highly simplified approachis used for the daylighting calculation, the artificiallights are assumed to dim perfectly to maintain a pre-specified lighting level, the daylighting and solar gainsvary in unison when the shading percentage varies, andthe variable capacity for natural ventilation under dif-ferent wind and thermal conditions is ignored.The model was written in Modelica. The conditionsgrid used is as shown in Table 1, which results in2880 sets of disturbances for which optimal controlmust be determined. The Hookes-Jeeves algorithmin GenOpt was used, with 5 step size reductions, andnon-parallelized so running on just one processor. Thesequential optimisations required approximately 84.5hours (3.5 days) on a single Windows virtual machine.

Table 1: Conditions grid for shading and nat ventMIN MAX SPACING

ambient temp 0 30 2(C)

direct solar 0 1000 200(W/m2 on window)

diffuse solar 0 1000 200(W/m2 on window)

gains from people and plugs 2 18 4(W/m2 on floor)

Proceedings of Building Simulation 2011: 12th Conference of International Building Performance Simulation Association, Sydney, 14-16 November.

- 2441 -

Page 4: USING BUILDING SIMULATION AND … BUILDING SIMULATION AND OPTIMISATION TO CALCULATE CONTROL LOOKUP TABLES OFFLINE Brian Coffey University of California, Berkeley ABSTRACT

direct solar = 0 W/m2, diffuse = 200 W/m2 direct solar = 0 W/m2, diffuse = 400 W/m2 direct solar = 800 W/m2, diffuse = 400 W/m2

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

0 5 10 15 20 25 30

ambient temp (C)

natu

ral v

ent

leve

l

26101418

people and plugs (W/m2)

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

0 5 10 15 20 25 30

ambient temp (C)

natu

ral v

ent

leve

l

26101418

people and plugs (W/m2)

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

0 5 10 15 20 25 30

ambient temp (C)

natu

ral v

ent

leve

l

26101418

people and plugs (W/m2)

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

0 5 10 15 20 25 30

ambient temp (C)

shad

ing

leve

l

26101418

people and plugs (W/m2)

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

0 5 10 15 20 25 30

ambient temp (C)

shad

ing

leve

l26101418

people and plugs (W/m2)

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

0 5 10 15 20 25 30

ambient temp (C)

shad

ing

leve

l

26101418

people and plugs (W/m2)

Figure 3: Optimal shading and natural ventilation levels

Tamb = 12C Tamb = 16C Tamb = 20C

0 200 400 600 800 10000

200

400

600

800

1000

direct solar (W/m2)

dif

fuse

sola

r (W

/m2)

0.9-1.00.8-0.90.7-0.80.6-0.70.5-0.60.4-0.50.3-0.40.2-0.30.1-0.20.0-0.1

shadinglevel

0 200 400 600 800 10000

200

400

600

800

1000

direct solar (W/m2)

diff

use

sola

r (W

/m2)

0.9-1.00.8-0.90.7-0.80.6-0.70.5-0.60.4-0.50.3-0.40.2-0.30.1-0.20.0-0.1

shadinglevel

0 200 400 600 800 10000

200

400

600

800

1000

direct solar (W/m2)

dif

fuse

sola

r (W

/m2)

1.0-1.10.9-1.00.8-0.90.7-0.80.6-0.70.4-0.60.3-0.40.2-0.30.1-0.20.0-0.1

shadinglevel

Figure 4: Optimal shading levels versus direct and diffuse solar gain levels (internal gains = 2.0 W/m2)

Figures 3 and 4 show slices through the resulting con-trol lookup table. Figure 3 shows the optimal shad-ing and natural ventilation levels as a function of theambient temperature, direct and diffuse solar irradia-tion, and internal heat gains. Figure 4 highlights theresponse of the optimal shading value to different con-ditions values for direct and diffuse solar. The resultsmake intuitive sense: the natural ventilation level in-creases from 0% to 100% as ambient temperature goesfrom cold up to the zone temperature setpoint and thendrops off to 0%; the solar shading level increases withhigher solar gains, except when the ambient temper-ature and internal loads are low enough that zone re-quires heating; at low ambient temperature conditions,the solar shading only approaches zero as the solargains approach zero, but when the ambient tempera-ture is high, the shading control blocks the sun com-pletely when the direct solar is high and the diffusesolar is low (cooling these solar gains is more costlythan using the artificial lights), but with a more favor-able direct-diffuse split the shading control allows justenough daylighting in to eliminate the artificial light-ing requirement.

Annual simulationsTo test the lookup table control, an annual simulationwas run using TMY data for San Francisco. The TRN-SYS weather reader was used to calculate the directand diffuse solar gains on the window for each hourof the year, and a weekly schedule of internal loadswas created for the simulation. The annual simulationswere carried out using a copy of the Modelica modelas the ‘real’ system, connected to a controller throughthe BCVTB, assuming no model mismatch and per-fect disturbance predictions. A full annual simulationwith hourly calls to the lookup table controller requiresabout an hour of computation. For comparison withthe lookup table controller, a base case controller wasalso simulated, with control rules shown in grey in Fig-ure 6. Note that the base case controller is a heuristicsimplification of the lookup table controller by con-sidering only one condition variable, and is intendedonly as a simple comparison point and to illustrate theimportance of considering all of the interactions; con-trolling the blinds with a daylight sensor and the oper-able windows as an extension of the HVAC system’seconomizer would provide a much higher-performing

Proceedings of Building Simulation 2011: 12th Conference of International Building Performance Simulation Association, Sydney, 14-16 November.

- 2442 -

Page 5: USING BUILDING SIMULATION AND … BUILDING SIMULATION AND OPTIMISATION TO CALCULATE CONTROL LOOKUP TABLES OFFLINE Brian Coffey University of California, Berkeley ABSTRACT

baseline over which the lookup table controller wouldlikely find much less improvement (such a study maybe considered in future work). Also for comparison,three two-week periods were simulated with full on-line MPC, using the same optimisation configurationused in the lookup table creation, but with the ac-tual disturbance values for each hour of the simula-tion, connected again through BCVTB. A full-year on-line MPC simulation was not attempted because of thecomputation time requirements - each of the two weekperiods required 6-8 hours of run time, so a full yearsimulation would require roughly 150 to 200 hours (6-8 days). The three simulation periods capture summersolstice, winter solstice and a shoulder season.Figure 5 shows the week of March 1-7. The lookuptable control responses are very similar to the onlineMPC responses for all but a few hours during this pe-riod of the simulation. For this period, they are gen-erally calling for both more shading and more nat-ural ventilation than used by the base case control.This is likely because there are relatively high solargains during this period, and the base control consid-ers only ambient temperature in its decision, but theoptimisation-based lookup table also considers the so-lar gains and so can make these adjustments. The scat-ter plots in Figure 6 show this perhaps more clearly,with the spread in the lookup controller points beingcaused by its response to different solar conditions anddifferent internal loads. Also note in Figure 6 the dropin natural ventilation percentage in the lookup case be-tween 20oC and 22oC. However, we know that the op-timal control in this region, given our model config-uration, should approach 100% natural ventilation asthe ambient temperature approaches the zone temper-ature of 22oC from below, and then drop to 0% naturalventilation at exactly 22oC, as it does in the base casecontroller. The reason that it does not is because it isinterpolating linearly between the grid points at 20oCand 22oC. This is an illustration of one of the perfor-mance penalties in the lookup table approach; a finergrid would decrease this penalty, and thus a trade-offmust be made at some point between the cost of gridcreation and the gains in performance.The annual combined heating, cooling and lightingenergy consumption during occupied hours is 54.1kWh/m2 in the base case and 33.4 kWh/m2 in thelookup table control case, an annual savings of 38.2%.The three 2-week periods of simulation with the on-line MPC provides a comparison point on the otherside of the coin, showing where the lookup controlleris not performing as well an ideal controller (between20oC and 22oC, for example). Over the six test weeksthe lookup controller performed 49.6% better than thebase case, while the online MPC performed 57.0%better; with the online MPC demarcating the maxi-mum improvement over the base case, the lookup tablecontrol captured 87% of the available savings.

-10%

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

110%

1417 1441 1465 1489 1513 1537 1561 1585

hour of year

shad

ing

per

cent

basecase

online MPC

lookup

-10%

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

110%

1417 1441 1465 1489 1513 1537 1561 1585

hour of year

nat

ura

l ve

nti

lati

on

per

cen

t

0

5

10

15

20

25

30

1417 1441 1465 1489 1513 1537 1561 1585

year

o

Figure 5: Control decisions and objective function out-puts, March 1-14

-10%

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

110%

0 5 10 15 20 25 30 35 40

ambient dry bulb temp (C)

nat

ura

l ve

nti

lati

on p

erce

nt

basecase

lookup

-10%

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

110%

0 5 10 15 20 25 30 35 40

ambient dry bulb temp (C)

shad

ing

perc

ent

basecase

lookup

Figure 6: Annual simulation, hourly control decisionsversus ambient temperature

Proceedings of Building Simulation 2011: 12th Conference of International Building Performance Simulation Association, Sydney, 14-16 November.

- 2443 -

Page 6: USING BUILDING SIMULATION AND … BUILDING SIMULATION AND OPTIMISATION TO CALCULATE CONTROL LOOKUP TABLES OFFLINE Brian Coffey University of California, Berkeley ABSTRACT

PARAMETRIZATION CASE STUDYThis case study illustrates the use of EnergyPluswithin this procedure, as well as the use of condi-tions parametrization. The controller is asked to deter-mine the start time and charging length for overnightcharging of a massive chilled slab with a cooling toweronly, in order to minimize the average percentage peo-ple dissatisfied (PPD) during the following day with afloating slab and zone temperature. A 48-hour pre-diction and control horizon is used for the ambienttemperature, and the control time-step is 24 hourslong. The EnergyPlus example file RadLoTempHy-drCoolTower.idf (from the example files folder in theEnergyPlus version 6.0 standard release) is used forthis case study. The one-story building has threezones, with a total floor area of 130 m2. A hydroniclow temperature radiant system is the only source ofcooling, with the ‘chilled’ water supplied solely by acooling tower. Only very minor changes were madeto the example model file, to keep the case studysimple and replicable: the slab heating system wasturned off; the run period was changed to just fourdays; the HVAC control schedule variables were madeinto functions of the nightly charging lengths and starttimes; the hourly weather file values are overwritten asa function of the predictions; and the simulation out-puts are simplified to output just the average occupiedPPD for one zone of the building.

Conditions parametrization: disturbancesJust the daily maximum and minimum temperaturesover the 48-hr prediction horizon are used as con-ditions for the controller. But EnergyPlus requireshourly inputs for temperature and many other weathervariables, so a relationship must be derived to estimatethese hourly values over the prediction horizon giventhe maximum and minimum temperatures. Figure 7shows the daily temperature profiles for San Francisco(TMY3), with each coloured line representing one day.Figure 8 shows the daily temperature lines normalizedto [1,0] by their maximum and minimum. The dottedblack line is the hourly average of these daily normal-ized curves, and the solid black line is the [1,0] nor-malization of that dotted black line. The hourly valuesfor this solid black line are used in the model to esti-mate the hourly temperatures over the day-ahead pre-diction given the predicted maximum and minimumtemperatures. The other weather variables are normal-ized in the same way, and if their own daily maxi-mum or minimum values shows correspondence withthe maximum or minimum temperature values, thenthis relationship and the normalization is used to fill inthese hourly values for that variable. If no correspon-dence exists, then average hourly values are used.

Conditions parametrization: initial statesSimilar approaches may also be used for initial statevariables, if there are a lot of initial state values re-quired in the model (e.g. in cases with thermal stor-

0

5

10

15

20

25

30

35

1 3 5 7 9 11 13 15 17 19 21 23

hour of day

amb

ien

t d

ry b

ulb

tem

p (

C)

Figure 7: Daily ambient temperatures

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

1 3 5 7 9 11 13 15 17 19 21 23

hour of day

dai

ly n

orm

aliz

ed a

mbie

nt

dry

bulb

tem

p

Figure 8: Daily normalized ambient temps

age in many different tanks or massive building com-ponents). But the bigger concern pertaining to stateinitialization is that most building simulation tools donot provide easy access to the state variables: insteadof being able to explicitly initialize states when usingthe tool for MPC, one often has to use an ‘initializa-tion horizon’, simulating over hours or days or weeksof previous disturbances and control actions to get themodel state values to be roughly equal to the observedinitial state values. This means that instead of hav-ing a small vector of initial states as part of the condi-tions grid, there would have to be a much longer vec-tor of previous disturbances and control actions in thegrid, ballooning its dimensionality. Techniques mustbe used to avoid this problem when using such simu-lation tools. One approach is to define an initializationhorizon for the simulation where all of the values areconstant except some small number of parameters thatcan be modified to produce the desired initial states.As such, a desired initial state value can be translatedinto adjustable parameter values in the simulation tool.This approach was used in this case, for the initial slabsurface temperature and initial zone air temperature,details of which are available in (Coffey, 2011). How-ever, this work-around has proven difficult to imple-ment in case studies involving more than one or twostate variable of interest.

Proceedings of Building Simulation 2011: 12th Conference of International Building Performance Simulation Association, Sydney, 14-16 November.

- 2444 -

Page 7: USING BUILDING SIMULATION AND … BUILDING SIMULATION AND OPTIMISATION TO CALCULATE CONTROL LOOKUP TABLES OFFLINE Brian Coffey University of California, Berkeley ABSTRACT

Table 2: Conditions grid for slab cooling studyMIN MAX SPACING

floor temp at 9pm (C) 20 26 2zone - floor temp at 9pm (C) 2.0 3.5 0.5

max amb temp, day 1 (C) 16 32 4range in amb temp, day 1 (C) 4 16 4

max amb temp, day 2 (C) 16 32 8range in amb temp, day 2 (C) 4 16 6

16 20 24 28 324

8

12

16

max ambient temp, day 1 (C)

amb

. te

mp

ran

ge,

day

1 (

C)

9.0-10.08.0-9.07.0-8.06.0-7.05.0-6.04.0-5.03.0-4.02.0-3.01.0-2.00.0-1.0

charge length,first night (hrs)

16 20 24 28 324

8

12

16

max ambient temp, day 1 (C)

amb. te

mp r

ange

, day

1 (

C)

23.0-25.021.0-23.019.0-21.017.0-19.015.0-17.013.0-15.011.0-13.09.0-11.07.0-9.05.0-7.0

optimal ave PPD

Figure 9: Surface plots of optimal charging length andoptimal ave PPD, with Tfloor9pm = 22oC, Tzone9pm =24oC, TmaxDay2 = 16oC, TrangeDay2 = 4oC

Optimisation over the conditions gridThe conditions grid is shown in Table 2. The 2880optimisations (Hookes-Jeeves, 2 step size reductions)were carried out on 5 virtual machines on the AmazonElastic Compute Cloud, and required approximately275 processor-hours (11.5 processor-days). Two slicesthrough the lookup table are shown in Figure 9. Theoptimal charge length is zero when predicted ambienttemperatures and initial zone temperatures are low, tenhours when predicted ambient temperatures and initialzone temperatures are high, and it ramps in between.

Annual simulationsAnnual simulations for San Francisco (TMY3) wererun for the lookup table control and for two differentbase cases and three different online MPC configura-tions designed to tease apart performance losses due togrid spacing, disturbance parametrization, and initialstate approximation. Figure 10 shows the daily chargelengths specified by the lookup table control and thebase cases. (Analysis of the lookup table and annualsimulation results shows that the PPD is not very sensi-tive to the start time, so this was fixed at 9:30pm in thebase cases.) “Basecase1” does not use any day-ahead

Table 3: Annual simulation resultsAVE PPD,SUMMER

basecase1 11.71basecase2 11.12

lookup table control 10.84MPC1 (if grid spacing were zero) 10.33

MPC2 (no disturbance param.) 10.26MPC3 (no dist. or initial state param.) 10.24

0

2

4

6

8

10

12

0 5 10 15 20 25 30 35

next day max ambient temperature (C)ch

arge

len

gth

(h

ou

rs)

basecase 1

basecase 2

lookup

Figure 10: Charge length vs max amb temp

prediction and its charge length varies monthly. “Base-case2” was created after learning from the lookup ta-ble control outputs, and it represents a very good basecase. The three online MPC cases are defined as fol-lows: “MPC1” uses the same 6 conditions variables asthe lookup controller, thus keeping the disturbance andinitial state parametrizations, but runs online insteadof interpolating and so defines how good the lookuptable control could do if the grid spacing was zero;“MPC2” uses the actual hourly weather predictionsrather than the parametrized approximations, and thusshows the performance gains that could not be cap-tured because of the use of disturbance parametriza-tions; and “MPC3” uses a 7-day initialization horizonwith historical weather and control values, and thus al-lows for an estimate of the performance loss due to ini-tial state approximation. The results are summarizedin Table 3. Defining the performance improvement po-tential as the difference between “MPC3” and “base-case1”, the lookup table control (even with its coarsegridding in this case) was able to capture 59% of theavailable performance improvement. “Basecase2”, acontrol rule derived from looking at the lookup tableslices, was able to capture 40%. With a finer grid,the lookup table control could capture no more than94% of the savings, with the remaining 6% being lostthrough the parametrizations.

DISCUSSIONThe parametrization case study results suggest that thelosses in performance are not so high to consider theapproach as infeasible; further case studies are rec-ommended. The consideration of adaptive grid sizingshould be considered in future research.

Proceedings of Building Simulation 2011: 12th Conference of International Building Performance Simulation Association, Sydney, 14-16 November.

- 2445 -

Page 8: USING BUILDING SIMULATION AND … BUILDING SIMULATION AND OPTIMISATION TO CALCULATE CONTROL LOOKUP TABLES OFFLINE Brian Coffey University of California, Berkeley ABSTRACT

The many details left out of this paper because of spacerestrictions can be found in (Coffey, 2011), along withmore detailed case studies: a study of cogen dispatchwith monthly demand charges, overnight charging of achilled water storage tank for a campus, and integratedsolar shading and HVAC control for a large office.

CONCLUSIONA method for near-optimal supervisory control usingbuilding simulation tools and offline optimisation isoutlined herein. The approach is feasible for prob-lems that can be suitably expressed as a function ofroughly 5-6 conditions variables or fewer, or for prob-lems that can be broken down into subproblems of thissize. Conditions parametrization methods for limit-ing the problem dimensionality are described and asimulation-based case study suggests it can be usedwith just modest losses in performance.The inability to explicitly specify initial states in mostbuilding simulation tools remains a problem. Thisshould be fixed by simulation tool developers. In themeantime, for controls problems with one or two im-portant state variables the work-arounds outlined in(Coffey, 2011) may be used, for larger problems usersare recommended to use the subset of simulation toolsthat allow explicit state initialization.Open-source software to facilitate the use of buildingsimulation tools both in online MPC and in the modi-fied approach described herein is available online. Thepromise of this software and approach is that it mightfit well within existing design and operation processes,with visualization of control responses over the condi-tions space providing important feedback during thedesign process, and that the resulting controls couldbe easy to implement within existing building controlsystems. Further research, software interface develop-ment and early-adopter implementation is needed tomove in that direction.Designing good controls for low-energy building sys-tems is challenging. It is hoped that the concepts andtools described herein will help designers and opera-tors get closer to optimal performance.

ACKNOWLEDGEMENTThe research described herein was made possible byfellowships from the National Science and Engineer-ing Research Council of Canada, the American Soci-ety of Heating Refrigeration and Air conditioning En-gineers, and the University of California Berkeley, andthrough research projects at the Lawrence BerkeleyNational Laboratory. The author would like to thankPhil Haves, Gail Brager, Francesco Borrelli, MichaelWetter, Gregor Henze and Peter May-Ostendorp fortheir assistance and feedback.

REFERENCESBemporad, A., Borrelli, F., and Morari, M. 2002.

Model predictive control based on linear program-

ming - the explicit solution. IEEE Transactions onAutomatic Control, 47.

Clarke, J., Crockroft, J., Conner, S., Hand, J., Kelly,N., Moore, R., O’Brien, T., and Strachan, P. 2002.Simulation-assisted control in building energy man-agement systems. Energy and Buildings, 34(933-940).

Coffey, B. 2011. Using building simulation and opti-mization to calculate lookup tables for control. PhDThesis, University of California Berkeley (due to befiled in Autumn 2011).

Coffey, B., Haghighat, F., Morofsky, E., andKutrowski, E. 2010. A software framework formodel predictive control with GenOpt. Energy andBuildings, 42:1084–1092.

Henze, G., Kalz, D., Liu, S., and Felsmann, C. 2005.Experimental analysis of model-based predictiveoptimal control for active and passive thermal stor-age inventory. HVAC&R Research, 11(2):189–213.

Ma, Y., Borrelli, F., Hencey, B., Coffey, B., Bengea,S., Haves, P., Packard, A., and Wetter, M. 2010.Model predictive control for the operation of build-ing cooling systems. IEEE Trans. Control SystemsTechnology, PP(99):1–8.

Mahdavi, A. 2001. Simulation-based control of build-ing systems operation. Building and Environment,36:789–796.

Mayne, D., Rawlings, J., Rao, C., and Scokaert, P.2000. Constrained model predictive control: Sta-bility and optimality. Automatica, 36(6):789–814.

Morari, M. and Lee, J. 1999. Model predictive control:past, present and future. Computers and ChemicalEngineering, 23:667–682.

Oldewurtel, F., Gyalistras, D., Gwerder, M., Jones, C.,Parisio, A., Stauch, V., Lehmann, B., and Morari,M. 2010. Increasing energy efficiency in buildingclimate control using weather forecasts and modelpredictive control. Clima - RHEVA World Congress,Antalya, Turkey.

Qin, S. and Badgwell, T. 2003. A survey of industrialmodel predictive control technology. Control Engi-neering Practice.

Wetter, M. 2009a. GenOpt: Generic optimization pro-gram. http://gundog.lbl.gov/GO/.

Wetter, M. 2009b. Modelica-based modeling andsimulation to support research and development inbuilding energy and controls systems. Journal ofBuilding Performance Simulation, 2(2):143–161.

Wetter, M. and Haves, P. 2008. A modular buildingcontrols virtual test bed for the integration of het-erogeneous systems. SimBuild 2008, pages 69–76.

Proceedings of Building Simulation 2011: 12th Conference of International Building Performance Simulation Association, Sydney, 14-16 November.

- 2446 -