Reproducible Operations Research. An Application to Energy Systems Optimization



Similar documents
Quality Assurance For Mathematical Modeling Systems

A QTI editor integrated into the netuniversité web portal using IMS LD

A QTI editor integrated into the netuniversité web portal using IMS LD

City Data Pipeline. A System for Making Open Data Useful for Cities. stefan.bischof@tuwien.ac.at

irods and Metadata survey Version 0.1 Date March Abhijeet Kodgire 25th

Automatic Generation of Simple (Statistical) Exams

Master Module SNET2 Seminar & Project Summer Term 2010

A Fuzzy Logic-Based Information Security Management for Software-Defined Networks

Automated Performance Testing and Analysis. Armin Pruessner GAMS Development Corporation

Process Modelling from Insurance Event Log

Gouvernement du Québec Ministère de l Éducation, ISBN

CSC 342 Semester I: H ( G)

DSpace: An Institutional Repository from the MIT Libraries and Hewlett Packard Laboratories

A Modular Representation of a Business Process Planner

MANAGEMENT INFORMATION. Prepared By: Hardeep Singh

A MILP Scheduling Model for Multi-stage Batch Plants

Components Based Design and Development. Unit 2: Software Engineering Quick Overview

SYSM 6304: Risk and Decision Analysis Lecture 5: Methods of Risk Analysis

GENERAL PLATFORM CRITERIA. General Platform Criterion Assessment Question

Improving Interoperability in Mechatronic Product Developement. Dr. Alain Biahmou, Dr. Arnulf Fröhlich, Dr. Josip Stjepandic

An open source software approach to combine simulation and optimization of business processes

M LTO Multilingual On-Line Translation

AdaDoc. How to write a module for AdaDoc. August 28, 2002

General Platform Criterion Assessment Question

APPLICATION OF OPEN SOURCE/FREE SOFTWARE (R + GOOGLE EARTH) IN DESIGNING 2D GEODETIC CONTROL NETWORK

XML. CIS-3152, Spring 2013 Peter C. Chapin

Efficient Verification for Avionic Product Development

Technology WHITE PAPER

L A TEX in a Nutshell

Course Title: Advanced Topics in Quantitative Methods: Educational Data Science Practicum

Open EMS Suite. O&M Agent. Functional Overview Version 1.2. Nokia Siemens Networks 1 (18)

Mathematics Online Instructional Materials Correlation to the 2009 Algebra I Standards of Learning and Curriculum Framework

There are no existing solar design programs developed specifically for a non reservation

Authoring Guide for Perception Version 3

An Architecture for Web-based DSS

Embedded Software Development with MPS

GAMS Productivity - Performance - Reliability

Glance Project: a database retrieval mechanism for the ATLAS detector

Enterprise Architecture Modeling PowerDesigner 16.1

Modeling BPMN Diagrams within XTT2 Framework. A Critical Analysis**

Energy Data Management for Future Cities. Mr. Bejay Jayan 2 nd year PhD Researcher Supervisors : Dr. Haijiang Li & Prof.

The Age of Computer Aided Modeling

TESSY Automated dynamic module/unit and. CTE Classification Tree Editor. integration testing of embedded applications. for test case specifications

Javadoc like technical documentation for CAPRI

OpenControl. Utilization

VOICE INFORMATION RETRIEVAL FOR DOCUMENTS. Except where reference is made to the work of others, the work described in this thesis is.

The University of Chicago Booth School of Business Tools for Business Analysis: Excel and Matlab Winter, 2012.

Integrated Asset Management Tool for Highway Infrastructure

LP-based Mathematical Model for Optimal Microgrid Operation Considering Heat Trade with District Heat System

Architecture Design & Sequence Diagram. Week 7

Obfuscated Biology -MSc Dissertation Proposal- Pasupula Phaninder University of Edinburgh March 31, 2011

A joint control framework for supply chain planning

Applying the Chronographical Approach to the Modelling of Multistorey Building Projects

MatchPoint Technical Features Tutorial Colygon AG Version 1.0

In: Proceedings of RECPAD th Portuguese Conference on Pattern Recognition June 27th- 28th, 2002 Aveiro, Portugal

Modelling and optimization of renewable energy supply for electrified vehicle fleet

Key Benefits of Microsoft Visual Studio 2008

Mixed Integer Linear Programming in R

Candle Plant process automation based on ABB 800xA Distributed Control Systems

MDA Transformations Applied to Web Application Development 1

MetroGIS Project Proposal Template Version 1.0

How To Create A Data Transformation And Data Visualization Tool In Java (Xslt) (Programming) (Data Visualization) (Business Process) (Code) (Powerpoint) (Scripting) (Xsv) (Mapper) (

Automotive CAE Integration.

UPS System Capacity Management Configuration Utility

Page 1 of 5. (Modules, Subjects) SENG DSYS PSYS KMS ADB INS IAT

GENERAL STRUCTURE AND ORGANISATION OF THE CHEMICAL ENGINEERING DEGREE IN THE UNIVERSITY OF VALENCIA

Appendix M INFORMATION TECHNOLOGY (IT) YOUTH APPRENTICESHIP

JMulTi/JStatCom - A Data Analysis Toolkit for End-users and Developers

Installing R and the psych package

Functions. MATH 160, Precalculus. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan Functions

XML Processing and Web Services. Chapter 17

Compilers. Presentation. Lecture 0. Spring term. Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam.es

Scenario-based Requirements Engineering and User-Interface Design

Assignment 5: Visualization

Expert System and Knowledge Management for Software Developer in Software Companies

Challenges and Opportunities for formal specifications in Service Oriented Architectures

Open S-BPM: Goals and Architecture

Figure 1. Basic Petri net Elements

Agility2.0. Enterdev S.A.S. Collin Kleine

Software Development Kit

A View Integration Approach to Dynamic Composition of Web Services

"34".!! "#$%&'()!*+!(#!*,!-%!.%/01%$2&%!

GECO: Automatic Generator-Composition for (Aspect-oriented) DSLs

AC : MATHEMATICAL MODELING AND SIMULATION US- ING LABVIEW AND LABVIEW MATHSCRIPT

Introduction and Overview

Transcription:

IV Jornadas de Usuarios de R, 2012 1/35. An to Energy Systems Optimization Investigación Operativa. Aplicación a la optimización de sistemas energéticos 1 1 1 DEIO, Universidad Rey Juan Carlos, Madrid IV Jornadas de Usuarios de R, Barcelona 15 y 16 de noviembre de 2012

IV Jornadas de Usuarios de R, 2012 2/35 Outline 1 2 Integrated 3 The EnRima Project

IV Jornadas de Usuarios de R, 2012 3/35 Outline 1 2 Integrated 3 The EnRima Project

IV Jornadas de Usuarios de R, 2012 4/35 OResearch The goal of reproducible research is to tie specific instructions to data analysis and experimental data so that results can be recreated, better understood and verified

IV Jornadas de Usuarios de R, 2012 5/35 Workflow Needs Statistical Software Data Visualization Data Analysis Mathematical Representation Solver Input Generation Output Documentation

IV Jornadas de Usuarios de R, 2012 6/35 Approaches Copy-paste Inconsistencies Errors Out-of-date non-reproducible Painful changes Black box Compiled software for specific solutions

IV Jornadas de Usuarios de R, 2012 7/35 Outline 1 2 Integrated 3 The EnRima Project

IV Jornadas de Usuarios de R, 2012 8/35 R as an Integrated Environment Advantages Open Source and Literate Programming capabilities. Integrated framework for SMS, data, equations and solvers. Data Analysis (pre- and post-), graphics and reporting.

IV Jornadas de Usuarios de R, 2012 9/35 The SMS contains the mathematical representation of optimization models for all relevant energy subsystems and their interactions. This mathematical representation is composed of variables, parameters, and relations between them. Individual entities (variables and parameters) are identified through the indices representing the elements in different set.

IV Jornadas de Usuarios de R, 2012 10/35 Data-driven Modelling

IV Jornadas de Usuarios de R, 2012 11/35 Sets and Indices > head(smssets(model1sms)[,c(1,3,4,6,7,8,9)]) id tag sdes loc inset aux subset 1 1 NA Energy-creating technology sub NA NA FALSE 2 2 NA Energy-storing technology sub NA NA FALSE 3 3 NA Type of energy sub NA NA FALSE 4 4 NA Type of pollutant sub NA NA FALSE 5 5 NA Energy market sub NA NA FALSE 6 6 NA Long-term period sup NA NA FALSE > cat(getsets(model1sms, format = "tex", compact = FALSE)) \begin{description} \item[$i$] Energy-creating technology. \item[$j$] Energy-storing technology. \item[$k$] Type of energy. \item[$l$] Type of pollutant. \item[$n$] Energy market. \item[$p$] Long-term period. \item[$m$] Mid-term period. \item[$t$] Short-term period. \item[$a$] Technology age. a = 0,...,P-1 \end{description}

IV Jornadas de Usuarios de R, 2012 12/35 Decision Variables > head(smsvars(model1sms)[,c(1,2,4, 7,9)]) id symbol sdes units ind 1 1 si Generators to be installed Devices 1, 6 2 2 sd Generators to be decommissioned Devices 1, 6, 9 3 3 s Available generation capacity kw 1, 6 4 4 xi Storing devices to be installed Devices 2, 6 5 5 xd Storing devices to be decommissioned Devices 2, 6, 9 6 6 x Available storing capacity kwh 2, 6 > cat(getvars(model1sms, format = "tex")) \begin{description}...... \item[$ \mathit{s}_{i}^{p}$] Available generation capacity (kw)....... \item[$ \mathit{r}_{j,k}^{p,m,t}$] Energy stored (kwh). \item[$ \mathit{c}_{}^{}$] TotalCost (EUR). \item[$ \mathit{e}_{}^{p,m,t}$] Primary energy consumed (kwh). \end{description}

IV Jornadas de Usuarios de R, 2012 13/35 Parameters > head(smspars(model1sms)[, c(1,2,4,7, 10)]) id symbol sdes units ind 1 1 D Energy demand kwh 3, 6, 7, 8 2 2 G Generation capacity kw/device 1 3 3 GS Storage capacity kw/device 2 4 4 AG Generation aging factor kw/kwh 1, 11 5 5 AS Storage aging factor kw/kw 2, 11 6 6 AV Technology availability factor kw/kw 1, 6, 7, 8 > cat(getpars(model1sms, format = "tex")) \begin{description} \item[$ \mathit{d}_{k}^{p,m,t}$] Energy demand (kwh). \item[$ \mathit{g}_{i}^{}$] Generation capacity (kw/device). \item[$ \mathit{gs}_{j}^{}$] Storage capacity (kw/device)....... \item[$ \mathit{il}_{}^{}$] Investment limit (EUR)....... \end{description}

IV Jornadas de Usuarios de R, 2012 14/35 Equations > head(smseqs(model1sms)[,c(1,2,6,7,8)]) id symbol nature relation domain 1 1 eqavailg constraint eq 1, 6 2 2 eqavails constraint eq 2, 6 3 3 eqdecomlimg constraint lte 1, 6 4 4 eqdecomlims constraint lte 2, 6 5 5 eqenergybal constraint gte 3, 6, 7, 8 6 6 eqoutputcalc constraint eq 1, 6, 7, 8, 20 > head(model1sms@terms[,c(1,6,7,8,9,10,11)]) id eq side parent nature item setsums 1 1 1 l NA vars 3 NA 2 2 1 r NA pars 2 NA 3 3 1 r 2 pars 4 NA 4 4 1 r 3 vars 1 NA 5 5 1 r 3 vars 2 NA 6 1 2 l NA vars 6 NA > cat(geteq(model1sms, 1, format = "tex"))

IV Jornadas de Usuarios de R, 2012 15/35 Equations (cont.) \mathit{s}_{i}^{p} = \mathit{g}_{i}^{} \cdot \sum _{ \mathit{a'} \leq \mathit{p}, \mathit{a'} \geq \mathit{0} } \mathit{ag}_{i}^{\mathit{p}-\mathit{a'}} \cdot \left ( \mathit{si}_{i}^{\mathit{a'}}- \sum _{ \mathit{a''} \leq \mathit{p}, \mathit{a''} > \mathit{a'} } \mathit{sd}_{i}^{\mathit{a'},\mathit{a''}} \right) \qquad \forall \;i \in \mathcal{i},\; p \in \mathcal{p}

IV Jornadas de Usuarios de R, 2012 16/35 Complete Model

IV Jornadas de Usuarios de R, 2012 17/35 Outline 1 2 Integrated 3 The EnRima Project

IV Jornadas de Usuarios de R, 2012 18/35 Objective The overall objective of EnRiMa is to develop a decision-support system (DSS) for operators of energy-efficient buildings and spaces of public use.

IV Jornadas de Usuarios de R, 2012 19/35 Consortium

IV Jornadas de Usuarios de R, 2012 20/35 EnRiMa DSS

IV Jornadas de Usuarios de R, 2012 21/35 Decision Scope Strategic DVs Strategic Module EnRiMaDSS Strategic Constraints Upper-Level Operational DVs Upper-Level Energy-Balance Constraints Lower-Level Operational DVs Operational Module Lower-Level Energy-Balance Constraints

IV Jornadas de Usuarios de R, 2012 22/35 Instance

IV Jornadas de Usuarios de R, 2012 23/35 Instance (cont.) > instancepars(model1instance, "CI")[sort(sample(1:975, 10, FALSE )),] i p a value 251 CHP 22 19 1021.45984 313 CHP 25 12 830.54032 450 PV 16 4 18.57636 476 PV 17 14 24.96507 517 PV 20 1 17.00000 578 PV 22 21 30.70389 581 PV 23 2 17.51000 586 PV 23 7 20.29889 669 Wind 6 3 212.18000 758 Wind 15 2 206.00000 > instancesets(model1instance, c("i")) [1] "CHP" "PV" "Wind"

IV Jornadas de Usuarios de R, 2012 24/35 Problem > wproblem(example1instance, "basicexample.gms", "gams", "lp") *GAMS file created with R $if NOT set outfile $set outfile outsol Sets i Technology / RTE, PV, CHP/ j Period / winter, spring, summer, autumn/ t Year / 2013, 2014, 2015, 2016, 2017/ ;... parameter D(j,t) Demand Level / winter.2013 = 5.25 spring.2013 = 5.83333333333333... autumn.2017 = 7.75833333333333 / ; Variables x(i, t) y(i, j, t) s(i, t) z ; Positive variable x ;

IV Jornadas de Usuarios de R, 2012 25/35 Problem (cont.) Positive variable y ; Positive variable s ; ; Equations eqavail (i,t) Available technologies capacity calculation eqdemand (j,t) Production plan for demand eqcapacity (i,j,t) Technologies capacity Cost Total Cost ; eqavail(i,t).. s(i,t) =e= s(i,t-1)+x(i,t)-x(i,t-lt(i)) ; eqdemand(j,t).. Sum((i), y(i,j,t)) =e= D(j,t) ; eqcapacity(i,j,t).. y(i,j,t) =l= G(i,j,t)*s(i,t) ; Cost.. z =e= Sum((t), (Sum((i), CI(i,t)*x(i,t))+Sum((i,j), CO(i,j,t)*DT(j,t)*y(i,j,t)))) Model Deterministic1 /all/; solve Deterministic1 using lp minimizing z ; scalars modelstat, solvestat, obj; modelstat = Deterministic1.modelstat; solvestat = Deterministic1.solvestat; obj = Deterministic1.objVal; execute_unload '%outfile%', modelstat, solvestat, obj, x, y, s, z ;

IV Jornadas de Usuarios de R, 2012 26/35 Architecture

IV Jornadas de Usuarios de R, 2012 27/35 Architecture (cont.) > #... Data preparation > load("./data/examplecms.rdata") > wproblem(mod1instance, "example.gms", "gams", "lp") > # > # solve > gams("example.gms --outfile=examplesol.gdx") > # > ## import solution > oldopt <- options(stringsasfactors= FALSE) > importgams(model1instance)<- "examplesol.gdx" > options(oldopt) > # > getsolution(model1instance)

IV Jornadas de Usuarios de R, 2012 28/35 DSS Integration

IV Jornadas de Usuarios de R, 2012 29/35 Solution and report Sweave file example: % \documentclass[a4paper]{article} \usepackage{sweave} \title{example } \author{urjc} \begin{document} \maketitle \section{data analysis} <<>>= # Some code for importing the # Symbolic Model and analyzing the # input data... #Generate tex file wproblem(myimplem, filename = "myimplem.tex",

IV Jornadas de Usuarios de R, 2012 30/35 Solution and report (cont.) format = "tex", solver = "lp" ) #generate gams file wproblem(initstochimplem, filename = "myimplem.gms", format = "gams", solver = "lp" ) @ \section{} %Write the LaTeX equations \input{myimplem} \section{call to solver} <<>>= require(gdxrrw) gams("myimplem.gms --outfile=mysol.gdx") @ \section{solution Analysis} <<>>= lst <- list(name='solvestat',form='full',compress=true)

IV Jornadas de Usuarios de R, 2012 31/35 Solution and report (cont.) solverresults <- rgdx("mysol.gdx", lst) #Some analysis and charts over solverresults object @ \end{document} 0.6 Energy Prices Simulation Optimisation Result Operational Decisions RTE 20 Price (EUR/kWh) 0.4 0.2 0.6 0.4 PP SP Energy Type Electricity NG Operation Level 20 15 CHP 15 10 5 PV 10 0.2 5 2013 2014 2015 2016 2017 2013 2014 2015 2016 2017 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Time Periods Technology by Year

IV Jornadas de Usuarios de R, 2012 32/35 Summary In this presentation the method used to represent and solve the optimization models developed within the EnRiMa DSS have been described

IV Jornadas de Usuarios de R, 2012 32/35 Summary In this presentation the method used to represent and solve the optimization models developed within the EnRiMa DSS have been described Outlook Algebraic Modeling Languages for R solvers and APIs Extend representation formats: HTML, ODF,... Further formats: AMPL, XML,... user-friendly input release roptim library

IV Jornadas de Usuarios de R, 2012 33/35 Acknowledgements R-project GAMS Software EnRiMa project partners This work has been partially funded by the projects: Energy Efficiency and Risk Management in Public Buildings (EnRiMa) EC s FP7 project (number 260041) Project RIESGOS-CM: code S2009/ESP-1685 AGORANET project (IPT-430000-2010-32) HAUS: IPT-2011-1049-430000 EDUCALAB: IPT-2011-1071-430000 DEMOCRACY4ALL: IPT-2011-0869-430000 CORPORATE COMMUNITY: IPT-2011-0871-430000

IV Jornadas de Usuarios de R, 2012 34/35 References COIN-OR Foundation. Internet, 2012. URL http://www.coin-or.org/. retrieved 2012-06-12. EnRiMa. Energy efficiency and risk management in public buildings. www.enrima-project.eu, 2012. GAMS. gdxrrw: interfacing gams and R. Internet, 2012. URL http://support.gams-software.com/doku.php?id=gdxrrw: interfacing_gams_and_r. retrieved 2012-03-06. Josef Kallrath. Algebraic modeling languages: and overview. In Josef Kallrath, editor, Algebraic Modeling Systems, volume 104 of Applied Optimization, pages 3 10. Springer Berlin Heidelberg, 2012. ISBN 978-3-642-23591-7. doi: 10.1007/978-3-642-23592-4 1. URL http://dx.doi.org/10.1007/978-3-642-23592-4_1. R Development Core Team. R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna, Austria, 2012. URL http://www.r-project.org/. ISBN 3-900051-07-0. Stefan Theussl. CRAN task view: Optimization and mathematical programming, 2012. URL http://cran.r-project.org/.

IV Jornadas de Usuarios de R, 2012 35/35 Discussion Gracias! emilio.lopez@urjc.es @emilopezcano