keeping the lights on - r . manchester...2016/05/17 · keeping the lights on chris campbell, phd...
TRANSCRIPT
![Page 2: Keeping the Lights On - R . Manchester...2016/05/17 · Keeping the Lights On Chris Campbell, PhD Chris Campbell – Senior Consultant ccampbell@mango-solutions.com • Owns English](https://reader036.vdocuments.site/reader036/viewer/2022071213/603cb6f7f2a21e722d6d8606/html5/thumbnails/2.jpg)
Chris Campbell – Senior [email protected]
• Owns English & Welsh electricity networks• System Operator for UK grid
National Grid
![Page 3: Keeping the Lights On - R . Manchester...2016/05/17 · Keeping the Lights On Chris Campbell, PhD Chris Campbell – Senior Consultant ccampbell@mango-solutions.com • Owns English](https://reader036.vdocuments.site/reader036/viewer/2022071213/603cb6f7f2a21e722d6d8606/html5/thumbnails/3.jpg)
Chris Campbell – Senior [email protected]
National Grid
• Manage flows of electricity to homes and businesses on a real time
• Balance the network, ensuring supply and demand are matched second by second
• Not generation
![Page 4: Keeping the Lights On - R . Manchester...2016/05/17 · Keeping the Lights On Chris Campbell, PhD Chris Campbell – Senior Consultant ccampbell@mango-solutions.com • Owns English](https://reader036.vdocuments.site/reader036/viewer/2022071213/603cb6f7f2a21e722d6d8606/html5/thumbnails/4.jpg)
Chris Campbell – Senior [email protected]
Electricity Market
• Generation provided by electricity market • Policies and framework support the market
Jack Gavigan
![Page 5: Keeping the Lights On - R . Manchester...2016/05/17 · Keeping the Lights On Chris Campbell, PhD Chris Campbell – Senior Consultant ccampbell@mango-solutions.com • Owns English](https://reader036.vdocuments.site/reader036/viewer/2022071213/603cb6f7f2a21e722d6d8606/html5/thumbnails/5.jpg)
Chris Campbell – Senior [email protected]
Supply/Demand
• Unexpected issues on network
• Demand higher than forecast (residual error)
![Page 6: Keeping the Lights On - R . Manchester...2016/05/17 · Keeping the Lights On Chris Campbell, PhD Chris Campbell – Senior Consultant ccampbell@mango-solutions.com • Owns English](https://reader036.vdocuments.site/reader036/viewer/2022071213/603cb6f7f2a21e722d6d8606/html5/thumbnails/6.jpg)
Chris Campbell – Senior [email protected]
Supply/Demand
• Request margin (spare capacity above demand)
![Page 7: Keeping the Lights On - R . Manchester...2016/05/17 · Keeping the Lights On Chris Campbell, PhD Chris Campbell – Senior Consultant ccampbell@mango-solutions.com • Owns English](https://reader036.vdocuments.site/reader036/viewer/2022071213/603cb6f7f2a21e722d6d8606/html5/thumbnails/7.jpg)
Chris Campbell – Senior [email protected]
Strategic Pricing Code Review
• Policy to reimburse flexible energy suppliers• Data driven capacity requests based on supply
forecasting• R analysis prototype
![Page 8: Keeping the Lights On - R . Manchester...2016/05/17 · Keeping the Lights On Chris Campbell, PhD Chris Campbell – Senior Consultant ccampbell@mango-solutions.com • Owns English](https://reader036.vdocuments.site/reader036/viewer/2022071213/603cb6f7f2a21e722d6d8606/html5/thumbnails/8.jpg)
Chris Campbell – Senior [email protected]
Challenges
• Frequent forecasts• Multiple data sources feed into Oracle database
(demand, availability, wind)• Consumed live
![Page 12: Keeping the Lights On - R . Manchester...2016/05/17 · Keeping the Lights On Chris Campbell, PhD Chris Campbell – Senior Consultant ccampbell@mango-solutions.com • Owns English](https://reader036.vdocuments.site/reader036/viewer/2022071213/603cb6f7f2a21e722d6d8606/html5/thumbnails/12.jpg)
Chris Campbell – Senior [email protected]
Check Data - S4 Classes
• Specify structure – data required for analysis• Validate contents – apply business rules
![Page 13: Keeping the Lights On - R . Manchester...2016/05/17 · Keeping the Lights On Chris Campbell, PhD Chris Campbell – Senior Consultant ccampbell@mango-solutions.com • Owns English](https://reader036.vdocuments.site/reader036/viewer/2022071213/603cb6f7f2a21e722d6d8606/html5/thumbnails/13.jpg)
Chris Campbell – Senior [email protected]
S4 Classes
setClass(Class = "DemandData",slots = c(
Timestamp = "POSIXct",Demand = "numeric"),
prototype = prototype(Timestamp = as.POSIXct(NA),Demand = NA_real_))
![Page 14: Keeping the Lights On - R . Manchester...2016/05/17 · Keeping the Lights On Chris Campbell, PhD Chris Campbell – Senior Consultant ccampbell@mango-solutions.com • Owns English](https://reader036.vdocuments.site/reader036/viewer/2022071213/603cb6f7f2a21e722d6d8606/html5/thumbnails/14.jpg)
Chris Campbell – Senior [email protected]
demand <- new(Class = "DemandData", Timestamp = Sys.time() + 1:3 * 1800)
demand# An object of class "DemandData"# Slot "Timestamp":# [1] "2016-05-17 20:21:49 BST"# ...# Slot "Demand":# [1] NA
S4 Classes
![Page 15: Keeping the Lights On - R . Manchester...2016/05/17 · Keeping the Lights On Chris Campbell, PhD Chris Campbell – Senior Consultant ccampbell@mango-solutions.com • Owns English](https://reader036.vdocuments.site/reader036/viewer/2022071213/603cb6f7f2a21e722d6d8606/html5/thumbnails/15.jpg)
Chris Campbell – Senior [email protected]
slot(object = demand, name = "Demand") <- 1:3
demand# An object of class "DemandData"# Slot "Timestamp":# [1] "2016-05-17 20:21:49 BST"# ...# Slot "Demand":# [1] 1 2 3
S4 Classes
![Page 16: Keeping the Lights On - R . Manchester...2016/05/17 · Keeping the Lights On Chris Campbell, PhD Chris Campbell – Senior Consultant ccampbell@mango-solutions.com • Owns English](https://reader036.vdocuments.site/reader036/viewer/2022071213/603cb6f7f2a21e722d6d8606/html5/thumbnails/16.jpg)
Chris Campbell – Senior [email protected]
validDemand <- function(object) {dmd <- slot(object = object,
name = "Demand")if (any(dmd < 0)) {
stop("Demand less than zero") }
}setValidity(Class = "DemandData",
method = validDemand)
Check Data
![Page 18: Keeping the Lights On - R . Manchester...2016/05/17 · Keeping the Lights On Chris Campbell, PhD Chris Campbell – Senior Consultant ccampbell@mango-solutions.com • Owns English](https://reader036.vdocuments.site/reader036/viewer/2022071213/603cb6f7f2a21e722d6d8606/html5/thumbnails/18.jpg)
Chris Campbell – Senior [email protected]
High Integrity Reporting
• Data check fails• Write informative message to file
Chris Hirata/Kawika Singson
![Page 19: Keeping the Lights On - R . Manchester...2016/05/17 · Keeping the Lights On Chris Campbell, PhD Chris Campbell – Senior Consultant ccampbell@mango-solutions.com • Owns English](https://reader036.vdocuments.site/reader036/viewer/2022071213/603cb6f7f2a21e722d6d8606/html5/thumbnails/19.jpg)
Chris Campbell – Senior [email protected]
High Integrity Reporting
• Analysis consumed by downstream processes –capacity pricing
• Reporting allows R code to run unmonitored –data error rapidly traceable
![Page 20: Keeping the Lights On - R . Manchester...2016/05/17 · Keeping the Lights On Chris Campbell, PhD Chris Campbell – Senior Consultant ccampbell@mango-solutions.com • Owns English](https://reader036.vdocuments.site/reader036/viewer/2022071213/603cb6f7f2a21e722d6d8606/html5/thumbnails/20.jpg)
Chris Campbell – Senior [email protected]
Summary
• Analysts with domain-specific expertise generate analytic code
• S4 Class allows data definition and validation• R Code deployed into high integrity system