Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods...

79
Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 IJCAI J. Zico Kolter

Transcript of Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods...

Page 1: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Computational Methods forSustainable Energy

J. Zico Kolter

August 5, 2013IJCAI

J. Zico Kolter

Page 2: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Outline

• Introduction to sustainable energy and the smart grid

• Three highlighted topics:

– Power and demand forecasting

– Energy disaggregation

– Control in the smart grid

• Final thoughts

J. Zico Kolter

Page 3: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Outline

• Introduction to sustainable energy and the smart grid

• Three highlighted topics:

– Power and demand forecasting

– Energy disaggregation

– Control in the smart grid

• Final thoughts

J. Zico Kolter

Page 4: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

“Sustainable energy”

“Sustainable development is development that meetsthe needs of the present without compromising theability of future generations to meet their own needs.”

– UN Report “Our Common Future”, 1987

J. Zico Kolter

Page 5: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

U.S. energy consumption

1850 1900 1950 20000

0.5

1

1.5

2

2.5

3

3.5

Year

Ave

rage

Pow

er (

TW

)

CoalNatural GasPetroleumHydro / Nuclear / BiomassWind / Solar / Geothermal

Data: U.S. Energy Information AdministrationJ. Zico Kolter

Page 6: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

U.S. energy consumption

Hydro2.51

Biomass4.29

Geothermal0.21

Wind0.92

Solar0.11

Nuclear8.44

Coal20.82

NaturalGas

24.65

Petroleum35.97

ElectricityGeneration

39.49

Residential11.79

Commercial8.71

Industrial23.27

Trans-portation

27.45

EnergyServices

41.88

Net ElectricityImports

Estimated U.S. Energy Use in 2010: ~98.0 Quads

Source: LLNL 2011. Data is based on DOE/EIA-0384(2010), October 2011. If this information or a reproduction of it is used, credit must be given to the Lawrence Livermore National Laboratoryand the Department of Energy, under whose auspices the work was performed. Distributed electricity represents only retail electricity sales and does not include self-generation. EIA

reports flows for hydro, wind, solar and geothermal in BTU-equivalent values by assuming a typical fossil fuel plant "heat rate." (see EIA report for explanation of change to geothermal in 2010).The efficiency of electricity production is calculated as the total retail electricity delivered divided by the primary energy input into electricity generation. End use efficiency is estimated as 80% for

the residential, commercial and industrial sectors, and as 25% for the transportation sector. Totals may not equal sum of components due to independent rounding. LLNL-MI-410527

RejectedEnergy56.13

20.59

4.65

1.74

2.36

26.78

0.02

5.06

0.01

0.100.04

0.02

0.03

3.28

4.54

4.95

8.44

0.68

8.11

3.28

7.52

19.13

0.06

1.62

0.44

0.42

0.11

2.23

1.100.38

1.22

0.71

8.01

25.65

9.43

6.97

18.62

6.86

2.49

0.09

0.92

0.15

12.71

Lawrence LivermoreNational Laboratory

J. Zico Kolter

Page 7: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

U.S. petroleum production

1900 1920 1940 1960 1980 20000

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Year

US

Per

trol

eum

Pro

duct

ion

(TW

)

Data: U.S. Energy Information AdministrationJ. Zico Kolter

Page 8: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Atmospheric carbon dioxide

1000 1200 1400 1600 1800 2000260

280

300

320

340

360

380

400

Year

Atm

osph

eric

CO

2 Con

cent

ratio

n (P

PM

)

Data: NOAA and Eteridge et al., 1998J. Zico Kolter

Page 9: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Atmospheric carbon dioxide

0100200300400500600150

200

250

300

350

400

1000 Years Before Present

Atm

osph

eric

CO

2 Con

cent

ratio

n (P

PM

)

Data: Barnola et al., 2003, Siegenthaler et al., 2005J. Zico Kolter

Page 10: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

For additional discussion...

Wind:20 kWh/d

PV, 10 m2/p: 5

PV farm(200m2/p):50 kWh/d

Biomass: food,biofuel, wood,waste incin’n,landfill gas:24 kWh/d

Hydro: 1.5 kWh/d

Shallowoffshorewind:

16 kWh/d

Deepoffshorewind:

32 kWh/d

Wave: 4 kWh/d

Tide:11 kWh/d

Geothermal: 1kWh/d

Solar heating:13 kWh/d

Car:40 kWh/d

Jet flights:30 kWh/d

Light: 4kWh/d

Gadgets: 5

Food, farming,fertilizer:15 kWh/d

Stuff:48+ kWh/d

Transportingstuff: 12 kWh/d

“Defence”: 4

Heating,cooling:37 kWh/d

http://www.withouthotair.com

J. Zico Kolter

Page 11: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Why computation/AI?

You: need to supply power to the country

Data: U.S. Energy Informational Administration, 2010 U.S. Census, Institutefor Electric Efficiency, Argonne National Labs

J. Zico Kolter

Page 12: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Why computation/AI?

You: need to supply power to the country

5,500 power plants (925 GW capacity)

Data: U.S. Energy Informational Administration, 2010 U.S. Census, Institutefor Electric Efficiency, Argonne National Labs

J. Zico Kolter

Page 13: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Why computation/AI?

You: need to supply power to the country

5,500 power plants (925 GW capacity)

83m residential and 5m commerical/industrial buildings (768 GW peak demand)

Data: U.S. Energy Informational Administration, 2010 U.S. Census, Institutefor Electric Efficiency, Argonne National Labs

J. Zico Kolter

Page 14: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Why computation/AI?

You: need to supply power to the country

5,500 power plants (925 GW capacity)

83m residential and 5m commerical/industrial buildings (768 GW peak demand)

172k miles of transmission lines

Data: U.S. Energy Informational Administration, 2010 U.S. Census, Institutefor Electric Efficiency, Argonne National Labs

J. Zico Kolter

Page 15: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Why computation/AI?

You: need to supply power to the country

5,500 power plants (925 GW capacity)

83m residential and 5m commerical/industrial buildings (768 GW peak demand)

172k miles of transmission lines

49 GW of installed wind/solar capcity

Data: U.S. Energy Informational Administration, 2010 U.S. Census, Institutefor Electric Efficiency, Argonne National Labs

J. Zico Kolter

Page 16: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Why computation/AI?

102

34

567

89 10

2

34

567

89 10

2

34

567

89 10

2

34

567

89 10

2

34

567

89

You: need to supply power to the country

5,500 power plants (925 GW capacity)

83m residential and 5m commerical/industrial buildings (768 GW peak demand)

172k miles of transmission lines

30m installed smart meters

49 GW of installed wind/solar capcity

Data: U.S. Energy Informational Administration, 2010 U.S. Census, Institutefor Electric Efficiency, Argonne National Labs

J. Zico Kolter

Page 17: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Outline

• Introduction to sustainable energy and the smart grid

• Three highlighted topics:

– Power and demand forecasting

– Energy disaggregation

– Control in the smart grid

• Final thoughts

J. Zico Kolter

Page 18: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Outline

• Introduction to sustainable energy and the smart grid

• Three highlighted topics:

– Power generation and demand forecasting

– Energy disaggregation

– Control in the smart grid

• Final thoughts

J. Zico Kolter

Page 19: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Pittsburgh electricity consumption

0 5 10 15 201

1.5

2

2.5

3

Hour of Day

Hou

rly D

eman

d (G

W)

Feb 9Jul 13Oct 10

Data: PJM http://www.pjm.com J. Zico Kolter

Page 20: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Electricity forecasting

• One of the most common tasks in energy system scheduling isforecasting how much electricity a region will consume

• Lets us plan, in advance, how we are going to allocategeneration (especially important for slow-starting generators)

• Will need to re-schedule generation in real-time to make up forerrors, but gives a good baseline

J. Zico Kolter

Page 21: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

A natural supervised learning setup

• Electricity forecasting is naturally formulated as a multi-outputregression problem

yt = f(xt)

where

– yt ∈ R24 = predicted consumption over the next 24 hours,starting at time t

– xt ∈ Rk = features that can help predict consumption over thenext 24 hours

J. Zico Kolter

Page 22: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Possible features: hour of day

0 5 10 15 201

1.5

2

2.5

3

Hour of Day

Hou

rly D

eman

d (G

W)

Feb 9Jul 13Oct 10

J. Zico Kolter

Page 23: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Possible features: previous day’s power

0 5 10 15 201.5

1.6

1.7

1.8

1.9

2

2.1

Hour of Day

Hou

rly D

eman

d (G

W)

Feb 12, 2008Feb 13, 2008

J. Zico Kolter

Page 24: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Possible features: temperature

0 20 40 60 80 100

1.5

2

2.5

3

High Temperature (F)

Pea

k H

ourly

Dem

and

(GW

)

J. Zico Kolter

Page 25: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

(Multiple) linear regression

• Model predicted consumption as a linear model

yt = ΘTxt

where

– yt ∈ R24 = predicted consumption over the next 24 hours,starting at time t

– xt ∈ Rk = {hour of day, previous 24 hours of power, previous 24hours and next 24 hours of temperature (+ non-linear features)}

– Θ ∈ R24×k regression parameters

J. Zico Kolter

Page 26: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

• MATLAB code for electricity forecasting

% file format is: <utc timestamp> <load> <temperature>

data = load('pjm_load_data.txt');

% form output and feature vectors

Y = hankel(data(25:end-23,2), data(end-23:end,2));

X_power = hankel(data(1:end-47,2), data(end-47:end-24,2));

X_temp = hankel(data(1:end-47,3), data(end-47:end,3));

hour = mod(data(1:size(X_power,1),1)/3600,24);

X_hour_of_day = sparse(1:size(hour,1), hour+1, ...

ones(size(hour,1),1));

% multiple linear regression

X = [X_power X_temp X_temp.^2 X_temp.^3 X_hour_of_day];

Theta = X \ Y;

Y_pred = X*Theta;

J. Zico Kolter

Page 27: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

5 10 15 201

1.5

2

Hour of Day

Pow

er (

GW

)

ActualPredicted

5 10 15 201.4

1.6

1.8

2

Hour of Day

Pow

er (

GW

)

ActualPredicted

5 10 15 20

1.4

1.6

1.8

2

Hour of Day

Pow

er (

GW

)

ActualPredicted

5 10 15 20

1.2

1.4

1.6

1.8

2

Hour of Day

Pow

er (

GW

)

ActualPredicted

Predictions for several days

J. Zico Kolter

Page 28: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

5 10 15 200

0.05

0.1

0.15

0.2

0.25

Prediction Horizon (Hours)

Roo

t Mea

n S

quar

ed E

rror

(G

W)

All featuresHour of day onlyHour of day + previous powerHour of day + temperature

Errors omitting various features

J. Zico Kolter

Page 29: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

From demo to state-of-the-art

• With a few additions, this is a state-of-the-art, deployed system:

– PJM Manual 19: Load Forecasting and Analysis. PJM. Availableat: http://www.pjm.com/~/media/documents/manuals/m19.ashx

– Neural network, additional features forweekdays/weekends/holidays, more nuanced treatment oftemperature (heating/cooling degree days)

• A huge existing literature on the topic:Soliman, S. A. and Al-Kandari, A. M. (2010). Electrical LoadForecasting: Modeling and Model Construction. Elsevier.

J. Zico Kolter

Page 30: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Renewable generation forecasting

• Can apply the exact same methodology to forecast thegeneration of uncertain sources like wind or solar power

• Some work in the area, but a much more recent topic:

– A. Costa, et al. A review on the young history of the wind powershort-term prediction. Renewable and Sustainable EnergyReviews, 12(6):17251744, 2008.

– C. Monteiro, et al. Wind power forecasting: state-of-the-art2009. Technical report, Argonne National Laboratory (ANL),2009

– Kaggle Global Energy Forecasting Competition, 2013.http://gefcom.org

J. Zico Kolter

Page 31: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Research directions for AI

• How do we make multiple predictions across spatially-similarregions?

• How do we deal with uncertainty in the predictions?

• How can we use these predictions to actually optimally schedulegeneration (more on this later)

J. Zico Kolter

Page 32: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Large-scale probabilistic forecasting

• Some of our recent work on the topic:M. Wytock, J.Z. Kolter. Sparse Gaussian conditional randomfields: Algorithms, theory, and application to energy forecasting.ICML, 2013.

J. Zico Kolter

Page 33: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

• Algorithm: sparse conditional Gaussian random field (SGCRF)

x1 x2

· · ·

xnx3

y1

· · ·

y2 ypy3

• Mathematical formulation:

p(y|x) ∼ exp{−yTΛy − 2yTΘx

}, Λ ∈ Rp×p,Θ ∈ Rp×n

• Train using maximum likelihood estimation with `1regularization on Λ and Θ

minimizeΛ,Θ

log p(Y |X) + λ(‖Λ‖1 + ‖Θ‖1)

J. Zico Kolter

Page 34: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Performance on wind forecasting

10−2

10−1

100

0.2

0.3

0.4

0.5

λ

MS

E

SGCRFLS

• Least-squares here uses highly tuned features, got 5th place inKaggle Global Energy Forecasting Competition.

J. Zico Kolter

Page 35: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Performance on load forecasting

10−3

10−2

10−1

0.04

0.06

0.08

0.1

0.12

λ

MS

E

SGCRFPJM forecast

• “PJM” is deployed solution at utility.

J. Zico Kolter

Page 36: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Summary: energy forecasting

• Application: Predicting future demand on the electrical grid, orfuture generation of renewable sources

• Algorithm: Supervised learning techniques for forecasting;recent work involving large-scale probabilistic modeling

J. Zico Kolter

Page 37: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Outline

• Introduction to sustainable energy and the smart grid

• Three highlighted topics:

– Power generation and demand forecasting

– Energy disaggregation

– Control in the smart grid

• Final thoughts

J. Zico Kolter

Page 38: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Energy disaggregation

J. Zico Kolter

Page 39: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

J. Zico Kolter

Page 40: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

J. Zico Kolter

Page 41: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

RefrigeratorWasher/DryerLightingComputer...

5.6410.2315.209.40

J. Zico Kolter

Page 42: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

J. Zico Kolter

Page 43: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

J. Zico Kolter

Page 44: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

17:40 17:50 18:00 18:100

500

1000

1500

2000

2500

3000

3500

4000

4500

5000

Time

Pow

er (

Wat

ts)

J. Zico Kolter

Page 45: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

17:40 17:50 18:00 18:100

500

1000

1500

2000

2500

3000

3500

4000

4500

5000

J. Zico Kolter

Page 46: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

A slightly simpler problem...

• Given power traces for a single device, determine if it is a givendevice (e.g. a refrigerator) or not

• Often used as a sub-step of a full energy disaggregationalgorithms

J. Zico Kolter

Page 47: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

1000 2000 3000 4000 5000 6000 70000

50

100

150

200

250

Time (seconds)

Pow

er (

wat

ts)

Power signal for refrigerator

J. Zico Kolter

Page 48: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

1000 2000 3000 4000 5000 6000 70000

50

100

150

200

250

Time (seconds)

Pow

er (

wat

ts)

Constructing features from power signal

J. Zico Kolter

Page 49: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Refrigerator vs. other devices

120 140 160 180 200 220 240

500

1000

1500

2000

2500

Power (watts)

Dur

atio

n (s

econ

ds)

Other devicesRefrigerator

J. Zico Kolter

Page 50: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

• MATLAB code for classifying devices (using YALMIPoptimization library to solve SVM)

% file format: <power> <duration> <+1/-1 for fridge>

data = load('device_signals.txt');

X = data(:,1:2);

y = data(:,3);

m = size(X,1);

% construct kernels and outputs

X = (X - repmat(mean(X),m,1)) ./ repmat(std(X),m,1);

sig = 1.0;

C = 100;

K = exp(-sqdist(X', X')/(2*sig^2)) + 1e-2*eye(m);

% solve SVM

a = sdpvar(m,1);

solvesdp([], a’*K*a + C*sum(max(0,1-y.*(K*a))), ...

sdpsettings('solver', 'sedumi'));

Y_pred = sign(K*double(a));

J. Zico Kolter

Page 51: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

120 140 160 180 200 220 240

500

1000

1500

2000

2500

Power (watts)

Dur

atio

n (s

econ

ds)

Kernelized SVM, Gaussian kernel (σ = 1.0)

J. Zico Kolter

Page 52: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

120 140 160 180 200 220 240

500

1000

1500

2000

2500

Power (watts)

Dur

atio

n (s

econ

ds)

Kernelized SVM, Gaussian kernel (σ = 0.2)

J. Zico Kolter

Page 53: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Standard approach for energy disaggregation

17:40 17:50 18:00 18:100

500

1000

1500

2000

2500

3000

3500

4000

4500

5000

Time

Pow

er (

Wat

ts)

• State of the art (for 20+ years, e.g. Hart 1992): classify edgesin power signal, integrate to determine breakdown of energy.

• A recent survey: M. Ziefman and K. Roth. Nonintrusiveappliance load monitoring: Review and outlook. IEEETransactions on Consumer Electronics, 57(1):7684, 2011.

J. Zico Kolter

Page 54: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Research directions for AI

• Probabilistic disaggregation using source separation techniques(standard classification approach very sensitive to errors)

• Unsupervised/semi-supervised learning of appliance models

• Determining best feedback methods for giving information tousers

J. Zico Kolter

Page 55: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Disaggregation with Factorial HMMs

• Some of our recent work on the topic:J.Z. Kolter and T. Jaakkola. Approximate inference in additivefactorial HMMs. AISTATS, 2012.

17:40 17:50 18:00 18:100

500

1000

1500

2000

2500

3000

3500

4000

4500

5000

x(1)t−1 x

(1)t x

(1)t+1

yt−1 yt yt+1

x(2)t−1 x

(2)t x

(2)t+1

Factorial hidden Markov model(FHMM)

J. Zico Kolter

Page 56: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

x(1)t−1 x

(1)t x

(1)t+1

yt−1 yt yt+1

x(2)t−1 x

(2)t x

(2)t+1

• Challenge: Inference (determining the most likely discretestates given observed output) is intractable for FHMMs

• Algorithmic work: New methods for approximate inference inFHMMs, based upon convex relaxations

J. Zico Kolter

Page 57: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

• The trick: look at a probabilistic formulation in terms of thedifferences in total power

• Write inference as optimization problem

minimizeµ

T−1∑t−1

((yt+1 − yt)−

∑i

θTi µ(i)t

)2

subject to µ(i)t ∈ {0, 1}, ∀i, tµ

(i)1:T−1 “valid”, ∀i

where µ variables represent indication function of state changeand θ parameters denote mean power outputs

• Key property: if only one device changes state at any giventime, we can relax problem to linear program; solvingoptimization problem typically results in integral solutions

J. Zico Kolter

Page 58: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Performance

17:40 17:50 18:00 18:100

500

1000

1500

2000

2500

3000

3500

4000

4500

5000

17:40 17:50 18:00 18:100

500

1000

1500

2000

2500

3000

3500

4000

4500

5000

Time

Pow

er (

Wat

ts)

unassignedkitchen outletsmicrowavewasher dryer

True breakdown Our approach

17:40 17:50 18:00 18:100

500

1000

1500

2000

2500

3000

3500

4000

4500

5000

Time

Pow

er (

Wat

ts)

Unassignedkitchen outletsfurnacebath gfimicrowavekitchen outletswasher dryer

17:40 17:50 18:00 18:100

500

1000

1500

2000

2500

3000

3500

4000

4500

5000

Time

Pow

er (

Wat

ts)

unassignedbath gfimicrowavefurnacekitchen outletskitchen outletswasher dryer

Event-based Structured mean fieldJ. Zico Kolter

Page 59: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Performance

Circuit Our Method Previous approx Event-basedMicrowave 98% / 66% 97% / 4% 98% / 28%Bath GFI 83% / 71% 50% / 9% 23% / 21%

Kitchen Outlets 38% / 13% 10% / 48% 57% / 15%Furnace 92% / 71% 13% / 15% 25% / 71%

Kitchen Outlets 45% / 16% 13% / 24% 27% / 11%Washer / Dryer 99% / 73% 89% / 77% 95% / 64%

Total 87% / 60% 36% / 45% 49% / 53%

Performance on example circuits in a home over two weeksAll data available at: http://redd.csail.mit.edu

J. Zico Kolter

Page 60: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Summary: energy disaggregation

• Application: Understand breakdowns of power from smartmeters

• Algorithm: Supervised learning for classifying devices, hiddenMarkov models and approximate inference approaches for sourceseparation in factorial HMMs

• Additional work: A great deal of follow on work, using REDDdata set, or other domains (e.g. conference paper at IJCAI onwater disaggregation)

J. Zico Kolter

Page 61: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Outline

• Introduction to sustainable energy and the smart grid

• Three highlighted topics:

– Power and demand forecasting

– Energy disaggregation

– Control in the smart grid

• Final thoughts

J. Zico Kolter

Page 62: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

The challenge of electrical grid control

102

34

567

89 10

2

34

567

89 10

2

34

567

89 10

2

34

567

89 10

2

34

567

89

You: need to supply power to the country

5,500 power plants (925 GW capacity)

83m residential and 5m commerical/industrial buildings (768 GW peak demand)

172k miles of transmission lines

30m installed smart meters

49 GW of installed wind/solar capcity

Data: U.S. Energy Informational Administration, 2010 U.S. Census, Institutefor Electric Efficiency, Argonne National Labs

J. Zico Kolter

Page 63: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

• Generators has very different costs, greenhouse emissions, andramp rates

• Transmission lines have different physical properties andcapacities

• Power can’t be “routed” like packets, obeys laws of physics

• Wind and solar provide “free” power (at least at operationtime), but are non-dispatchable, intermittent, and can’tcurrently be stored economically

• Emerging ability to also control load through “demandresponse”

J. Zico Kolter

Page 64: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Everything you ever wanted to know aboutpower systems but were afraid to ask

• Voltage: electric potential energy, 1 volt = 1 joule/coulomb

• Current: flow of charge, 1 ampere = 1 coulomb/second

• Ohm’s law: i = v/R

• Power: p = vi

J. Zico Kolter

Page 65: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

• Alternating current (AC) systems: v(t) = v cos(ωt+ θ), v =voltage magnitude, ω = frequency, θ = phase/voltage angle

• Represent using complex numbers: v = vejθ, j =√−1

• Ohm’s law: i = Y v, where Y is admittance Y = 1/(R+ jX),X is reactance, X = ωL− 1

ωC , L is inductance and C iscapacitance

• Power: s = vi (· is complex conjugate), has both real andimaginary components, called real and reactive powerrespectively

J. Zico Kolter

Page 66: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

• Power network: i ∈ Cn, v ∈ Cn

• Ohm’s law + Kirchoff’s voltage law: i = Y v where

Yk` =

{ − 1Rk`+jXk`

k 6= ` (0 if k, ` not connected)∑s 6=k

1Rsk+jXsk

k = `

• Flow over line via Ohm’s law: ik` = vk−v`Rk`+jXk`

J. Zico Kolter

Page 67: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

• Power: s = diag vi = diag vY v

• Power flow: given some know powers/voltages, solve(non-linear) equation s = diag vY v

• Optimal power flow (OPF): Solve some optimization problem(e.g. minimize generation cost) subject to power flow constraint

• But non-linear equations is nasty, so we can simplify (assumevoltages equal, transmission lines have no resistance justreactance, small angle approximation) to get

p = Bθ, Bk` =

{ − 1Xk`

k 6= `∑s 6=k

1Xsk

k = `

called (in the worst naming convention ever) DC power flow

J. Zico Kolter

Page 68: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

An example of DC OPF

• An example optimal power flow optimization problem

minimizepG,θ

n∑i=1

ci(pGi )

subject to Bθ = pG − pL

pG ≤ pG ≤ pG

|Bij(θi − θj)| ≤ F ij

where pG, θ ∈ Rn are optimization variables; B ∈ Rn×n is DCapproximate admittance matrix; pL ∈ Rn is a vector of loads ateach node; pG, pG ∈ Rn are generator upper and lower bounds;and Fij is the power capacity of the transmission line betweennodes i and j

J. Zico Kolter

Page 69: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

IEEE 30 bus test system

J. Zico Kolter

Page 70: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

• MATLAB code for DC optimal power flow

% load electrical network data from file

[B, p, gen, base_mva] = load_cdf_dc('ieee30cdf.txt');

n = size(B,1);

p_load = max(-p,0);

p_gen = sdpvar(n,1);

theta = sdpvar(n,1);

% set up costs and constraints

cost1 = p_gen(gen(1)) + p_gen(gen(1))^2;

cost2 = 0.5*p_gen(gen(2)) + 2*p_gen(gen(2))^2;

const = [B*theta == p_gen - p_load;

theta(1) == 0;

p_gen(setdiff(1:n,gen)) == 0;

abs(B(1,2)*(theta(1) - theta(2))) <= 0.9];

% solve optimization problem

solvesdp(const, cost1 + cost2, ...

sdpsettings('solver', 'sedumi'));

J. Zico Kolter

Page 71: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Beyond static optimal power flow

• Introduce receding horizon model predictive control objective

minimizepG1:T ,θ1:T

T∑t=1

c(pGt )

with power flow constraints

Bθt = pGt − pLt , t = 1, . . . , T

• Since we don’t know the future loads pLt , we use our loadforecasting methods to make the best predictions

J. Zico Kolter

Page 72: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Integrating renewables

• Additional wind power term

Bθt = pGt + pWt − pLt ,pWt ≤ pWt , t = 1, . . . , T

• Wind acts like a negative load,can’t be controlled, so still mustbe forecast

J. Zico Kolter

Page 73: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Storage

• Battery power

Bθt = pGt + (pBoutt − pBin

t )− pLt

• With battery dynamics

EBt+1 = EBt + 0.9pBint − pBout

t

and constraint that EBt ≥ 0.

J. Zico Kolter

Page 74: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Evolution of power and storage

4000 4050 4100 4150 4200 4250 43000

0.5

1

1.5

2

2.5

3

3.5

Hour

Val

ue

Slow Ramping GeneratorFast Ramping GeneratorPumped Storage EnergyBattery Energy

J. Zico Kolter

Page 75: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Research directions for AI

• Load and renewables are inherently uncertain, how do we dealwith this uncertainty in optimization? −→ stochasticprogramming

• Generator costs are not really convex, many power plants havefixed startup time with zero generation −→ integer programming

• These systems are run in markets, how do we ensure thegenerators provide “accurate” costs? −→ game theory andmechanism design

• How will intelligent control strategies interact with each other?−→ multi-agent systems

J. Zico Kolter

Page 76: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Summary: energy forecasting

• Application: Methods for allocating power in large powernetworks with multiple constraints

• Algorithmic approach: Model predictive control techniques forfast online resource allocation

J. Zico Kolter

Page 77: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Outline

• Introduction to sustainable energy and the smart grid

• Three highlighted topics:

– Power and demand forecasting

– Energy disaggregation

– Control in the smart grid

• Final thoughts

J. Zico Kolter

Page 78: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Final thoughts

• Energy issues pose some of the greatest challenges currentlyfacing society

• These have traditionally been viewed as physical or policychallenges

• Increasingly, prevalance of data means that computationalmethods have the potential to transform these domains as well

J. Zico Kolter

Page 79: Computational Methods for Sustainable Energyzkolter/ijcai13/tutorial.pdf · Computational Methods for Sustainable Energy J. Zico Kolter August 5, 2013 ... MATLAB code for electricity

Some resources/venues

• Forecasting: International Journal of Forecasting, PES GlobalEnergy Forecasting Competition (likely to run again in 2013,check Kaggle.com).

• Disaggregation: REDD data set(http://redd.csail.mit.edu), International Workshop onNon-intrusive load monitoring

• Smart grid: IEEE Transactions on Smart Grid, IEEETransactions on Power Systems, IEEE Conference on Smart GridCommunications

J. Zico Kolter