Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Building systems enery flow: Sankey diagram
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Energy Systems
Planning
useR! 2013
Emilio L. Cano
Introduction
Motivation
DSS
Solver Manager
Architecture
Components
Examp...
Upcoming SlideShare
Loading in …5
×

An integrated Solver Manager: using R and Python for energy systems optimization

750 views

Published on

Presentation at the R User Conference 2013, Albacete, Spain

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
750
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

An integrated Solver Manager: using R and Python for energy systems optimization

  1. 1. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution An integrated Solver Manager: using R and Python for energy systems optimization Emilio L. Cano1 Antonio Alonso Ayuso1 Javier M. Moguerza1 Felipe Ortega1 1 DEIO, Universidad Rey Juan Carlos, Madrid The R user Conference 2013 Albacete July 10-12 2013 The R User Conference 2013 1/27
  2. 2. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Outline 1 Introduction Motivation DSS 2 Solver Manager Architecture Components 3 Example A simplified model Model instance Solution The R User Conference 2013 2/27
  3. 3. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Outline 1 Introduction Motivation DSS 2 Solver Manager Architecture Components 3 Example A simplified model Model instance Solution The R User Conference 2013 3/27
  4. 4. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Global changes, local challenges Global Regulations: emissions, efficiency De-regulations: market Global warming Resources scarcity Global markets Local Users’ confort Security Availability Limited budget New options The R User Conference 2013 4/27
  5. 5. Building systems enery flow: Sankey diagram
  6. 6. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Decision Support Systems The R User Conference 2013 6/27
  7. 7. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution EnRiMa DSS The R User Conference 2013 7/27
  8. 8. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Outline 1 Introduction Motivation DSS 2 Solver Manager Architecture Components 3 Example A simplified model Model instance Solution The R User Conference 2013 8/27
  9. 9. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution DSS Integration The R User Conference 2013 9/27
  10. 10. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Solver Manager The R User Conference 2013 10/27
  11. 11. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution SM Interface - overview The SM Interface allows to separate communication tasks and other interaction features from the core features of the Solver Manager The R User Conference 2013 11/27
  12. 12. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution SM Interface (Python) Model Tasks Data Interaction Logs The R User Conference 2013 12/27
  13. 13. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Solver Manager core script Instance checking Input data preparation Call to the Optimiser Result checking Output data preparation Control and log Libraries optimr: optimSMS and optimInstance S4 objects gdxrrw: GAMS Interface The R User Conference 2013 13/27
  14. 14. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Solver Manager process flow The R User Conference 2013 14/27
  15. 15. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Outline 1 Introduction Motivation DSS 2 Solver Manager Architecture Components 3 Example A simplified model Model instance Solution The R User Conference 2013 15/27
  16. 16. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Optimization model min t∈T i∈I CI t i · xt i + i∈I,j∈J COt i,j · DTt j · yt i,j s.t. : st i = st−1 i + xt i − x t−LTi i ∀ i ∈ I, t ∈ T i∈I yt i,j = Dt j ∀ j ∈ J , t ∈ T yt i,j ≤ Gt i,j · st i ∀ i ∈ I, j ∈ J , t ∈ T The R User Conference 2013 16/27
  17. 17. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Symbolic Model Specification showClass("optimSMS") ## Class "optimSMS" [package "optimr"] ## ## Slots: ## ## Name: consts sets vars pars ## Class: data.frame data.frame data.frame data.frame ## ## Name: eqs terms name sDes ## Class: data.frame data.frame character character ## ## Name: lDes ## Class: character data(mod1SMS) The R User Conference 2013 17/27
  18. 18. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution SMS Sets and Variables SMSsets(mod1SMS) ## id symbol tag sDes lDes loc inSet setType dataCom ## 1 1 i NA Technology NA sub NA set NA ## 2 2 j NA Period NA sub NA set NA ## 3 3 t NA Year NA sup NA set NA ## ordered setDom ## 1 NA NA ## 2 NA NA ## 3 NA NA SMSvars(mod1SMS)[, c(1:4, 11)] ## id symbol tag sDes ind ## 1 1 x NA Capacity to be installed 1, 3 ## 2 2 y NA Production plan 1, 2, 3 ## 3 3 s NA Available capacity 1, 3 ## 4 4 z NA Total cost NULL The R User Conference 2013 18/27
  19. 19. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution SMS parameters and expressions SMSpars(mod1SMS)[, c(1:4, 7, 12)] ## id symbol tag sDes units ind ## 1 1 LT NA Lifetime years 1 ## 2 2 D NA Demand Level kW 2, 3 ## 3 3 G NA Technology Availability kW/kW 1, 2, 3 ## 4 4 CI NA Investment Cost EUR/kW 1, 3 ## 5 5 CO NA Operational Cost EUR/kWh 1, 2, 3 ## 6 6 DT NA Duration time of period hours 2, 3 getExpr(mod1SMS, "vars", 2, "gams") ## [1] "y(i,j,t)" The R User Conference 2013 19/27
  20. 20. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution SMS equations SMSeqs(mod1SMS)[1:4, c(1, 2, 5, 6, 7)] ## id symbol lDes nature relation ## 1 1 aux1 NA aux eq ## 2 2 aux2 NA aux eq ## 3 3 eqAvail NA constraint eq ## 4 4 eqDemand NA constraint eq mod1SMS@terms[1:4, c(1, 6:10)] ## id eq side parent nature item ## 1 1 1 l NA sets 3 ## 2 2 1 r 0 sets 3 ## 3 3 1 r 0 consts 1 ## 4 1 2 l NA sets 3 getEq(mod1SMS, 5, "tex") ## [1] " mathit{y}_{i,j}^{t} leq mathit{G}_{i,j}^{t} cdo The R User Conference 2013 20/27
  21. 21. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Optimization Instance showClass("optimInstance") ## Class "optimInstance" [package "optimr"] ## ## Slots: ## ## Name: id name sDes lDes sets ## Class: integer character character character list ## ## Name: vars pars eqs sms ## Class: list list list optimSMS The R User Conference 2013 21/27
  22. 22. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Instance data names(mod1Instance@pars) ## [1] "LT" "CI" "D" "G" "DT" "CO" head(instancePars(mod1Instance, "CI"), 4) ## i t value ## 1 PV 2013 700 ## 2 CHP 2013 1182 ## 3 PV 2014 490 ## 4 CHP 2014 1123 instanceSets(mod1Instance, "i") ## [1] "RTE" "PV" "CHP" The R User Conference 2013 22/27
  23. 23. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Getting the solution setwd("~/gamsdir") wProblem(mod1Instance, "mod1.gms", "gams", "lp") library(gdxrrw) igdx("~/Programs/gams") ## The GDX library has been loaded ## GDX library load path: /home/emilio/Programs/gams gams("mod1.gms") ## [1] 0 importGams(mod1Instance) <- "outSolDeterministic1.gdx" instanceVars(mod1Instance, "x") ## i t value ## 1 RTE 2013 6.30 ## 2 PV 2015 17.50 ## 3 PV 2016 1.75 ## 4 CHP 2013 1.40 The R User Conference 2013 23/27
  24. 24. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Late motivation Joseph Kallrath (2012). Algebraic Modeling Systems, Springer. Chapter 12: A Practioner’s Wish List Towards Algebraic Modeling Systems “The automatic generation of a model’s documentation in LATEX would be very helpful for mathematicians, physicists, astronomers, and other communities publishing in LATEX.” The R User Conference 2013 24/27
  25. 25. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Summary New challenges for building managers. Decision Support Systems are needed. Solver Manager: flexible and extensible. The R User Conference 2013 25/27
  26. 26. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Summary New challenges for building managers. Decision Support Systems are needed. Solver Manager: flexible and extensible. Outlook Improve optimr package More complex instances More modeling and optimization softwares, solvers, alogorithms and benchmarking. The R User Conference 2013 25/27
  27. 27. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Acknowledgements This work has been partially funded by the project Energy Efficiency and Risk Management in Public Buildings (EnRiMa) EC’s FP7 project (number 260041) We also acknowledge the projects: OPTIMOS3 (MTM2012-36163-C06-06) Project RIESGOS-CM: code S2009/ESP-1685 HAUS: IPT-2011-1049-430000 EDUCALAB: IPT-2011-1071-430000 DEMOCRACY4ALL: IPT-2011-0869-430000 CORPORATE COMMUNITY: IPT-2011-0871-430000 CONTENT & INTELIGENCE: IPT-2012-0912-430000 and the Young Scientists Summer Program (YSSP) at the International Institute of Applied Systems Analysis (IIASA). The R User Conference 2013 26/27
  28. 28. Energy Systems Planning useR! 2013 Emilio L. Cano Introduction Motivation DSS Solver Manager Architecture Components Example A simplified model Model instance Solution Discussion Thanks ! emilio.lopez@urjc.es @emilopezcano http://www.proyectum.es The R User Conference 2013 27/27

×