Water Resources Planning and Management

Slides:



Advertisements
Similar presentations
PID Control Loops Guy Zebrick.
Advertisements

Shooting Video with an RCA Small Wonder EZ 205.
The Science of Predicting Outcome
BASIC SKILLS AND TOOLS USING ACCESS
Thursday, March 7 Duality 2 – The dual problem, in general – illustrating duality with 2-person 0-sum game theory Handouts: Lecture Notes.
February 7, 2002 A brief review of Linear Algebra Linear Programming Models Handouts: Lecture Notes.
Credit hours: 4 Contact hours: 50 (30 Theory, 20 Lab) Prerequisite: TB143 Introduction to Personal Computers.
On Sequential Experimental Design for Empirical Model-Building under Interval Error Sergei Zhilin, Altai State University, Barnaul, Russia.
Office 2003 Introductory Concepts and Techniques M i c r o s o f t Windows XP Project An Introduction to Microsoft Windows XP and Office 2003.
$100 $400 $300 $200 $400 $200 $100$100 $400 $200$200 $500$500 $300 $200 $500 $100 $300 $100 $300 $500 $300 $400$400 $500.
Chris Morgan, MATH G160 January 30, 2012 Lecture 9 Chapter 4.1: Combinations 1.
1 2 In a computer system, a file is a collection of information with a single name, such as addresses.doc, or filebackup.ppt, or ftwr.exe, or guidebook.xls.
Chapter 4: Basic Estimation Techniques
IENG313 Operation Research I
Outline Introduction Assumptions and notations
Arrays Dr. Jey Veerasamy July 31 st – August 23 rd 9:30 am to 12 noon 1.
Copyright © Cengage Learning. All rights reserved.
EXAMPLE 4 Solve a multi-step problem SHOPPING
1 Web-Enabled Decision Support Systems Access Introduction: Touring Access Prof. Name Position (123) University Name.
1 1 Mechanical Design and Production Dept, Faculty of Engineering, Zagazig University, Egypt. Mechanical Design and Production Dept, Faculty of Engineering,
Constraint Management
PowerPoint Basics Tutorial 4: Interactivity & Media PowerPoint can communicate with the outside world by linking to different applications, managing different.
1 Research Methods Lecture 2 The dummies’ guide to STATA Wiji Arulampalam 18/10/2006.
Copyright 2006 John Wiley & Sons, Inc. Beni Asllani University of Tennessee at Chattanooga Operations Management - 5 th Edition Chapter 13 Supplement Roberta.
Thank you and welcome Linear Programming (LP) Modeling Application in manufacturing And marketing By M. Dadfar, PhD.
1 BRState Software Demonstration. 2 After you click on the LDEQ link to download the BRState Software you will get this message.
Light User Guide BVPortal June 30th, p.m. Charles - Henri Varin KM DTP For the benefit of business and people.
Making Numbers Two-digit numbers Three-digit numbers Click on the HOME button to return to this page at any time.
$100 $100 $100 $100 $100 $200 $200 $200 $200 $200 $300 $300 $300 $300 $300 $400 $400 $400 $400 $400 $500 $500 $500 $500 $500.
Number bonds to 10,
2 x0 0 12/13/2014 Know Your Facts!. 2 x1 2 12/13/2014 Know Your Facts!
Chemical Reaction Engineering (CRE) is the field that studies the rates and mechanisms of chemical reactions and the design of the reactors in which they.
X-box Factoring. X- Box 3-9 Product Sum Factor the x-box way Example: Factor 3x 2 -13x (3)(-10)= x 2x 3x 2 x-5 3x +2.
Stock Valuation Common Stock Valuation Some Features of Common and Preferred Stocks The Stock Markets.
Tutorial 1: Sensitivity analysis of an analytical function
Hardware word gecontroleerd… 50%. Hardware word gecontroleerd… 100% Done.
Let’s Add! Click the cloud below for a secret question! Get Started!
Chapter 5 The Mathematics of Diversification
Compiler Construction
13-Optimization Assoc.Prof.Dr. Ahmet Zafer Şenalp Mechanical Engineering Department Gebze Technical.
Multiplication Facts Practice
Chapter 8: The Solver and Mathematical Programming Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University.
0 x x2 0 0 x1 0 0 x3 0 1 x7 7 2 x0 0 9 x0 0.
Lecture 12: Spreadsheets for Engineering Applications - part 2
Water Resources Planning and Management Daene C. McKinney
Applied Econometrics Second edition
1. Basics of R 2. Basic probability with R
Water Resources Planning and Management Daene C. McKinney Optimization.
Water Resources Planning and Management Daene C. McKinney Capacity – Yield Relations.
Non-Linear Simultaneous Equations
Water Resources Planning and Management Daene C. McKinney Simulating System Performance.
What is GAMS?.
A GAMS TUTORIAL. WHAT IS GAMS ? General Algebraic Modeling System Modeling linear, nonlinear and mixed integer optimization problems Useful with large,
Analytical vs. Numerical Minimization Each experimental data point, l, has an error, ε l, associated with it ‣ Difference between the experimentally measured.
Project Deployment IT [211 CAP] How to convert your project to a full application.
Then click the box for Normal probability plot. In the box labeled Standardized Residual Plots, first click the checkbox for Histogram, Multiple Linear.
1 Getting Started with C++. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Visual Studio 2008.
PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP.
Stochastic Optimization
Water Resources Planning and Management
Linear Programming Water Resources Planning and Management Daene McKinney.
1 /17 Installing and Configuring TaxWise © 2006, Universal Tax Systems, Inc. All Rights Reserved. Installing and Configuring TaxWise Objectives –In this.
Water Resources Planning and Management Daene C. McKinney System Performance Indicators.
Linear Programming and Applications
Water Resources Planning and Management Daene C. McKinney Introduction to GAMS.
Linear Regression. Regression Consider the following 10 data pairs comparing the yield of an experiment to the temperature at which the experiment was.
An Introduction to Programming with C++1 An Introduction to Control Structures Tutorial 1.
Excel Solver.
Solving Linear Systems Algebraically
Linear regression Fitting a straight line to observations.
Presentation transcript:

Water Resources Planning and Management Introduction to GAMS Water Resources Planning and Management Daene C. McKinney

Introduction GAMS = General Algebraic Modeling System GAMS Guide and Tutorials http://gams.com/docs/document.htm  Doc’s here GAMS website www.gams.com http://gams.com/download/  Download here McKinney and Savitsky Tutorials http://www.caee.utexas.edu/prof/mckinney/ce385d/Lectures/McKinney_and_Savitsky.pdf  Doc’s here

GAMS Installation Run setup.exe License file Use the Windows Explorer to browse the CD and double click setup.exe License file Choose ‘No’ when asked if you wish to copy a license file

Example Problem Write a GAMS model and solve the following nonlinear program using GAMS

Start GAMS Start GAMS by selecting: Start  All Programs  GAMS  GAMSIDE

Create New GAMS Project Choose from the GAMSIDE: File  Project  New project

Name New GAMS Project In “My Documents” Create a new directory by pressing the “folder” icon. Name the new folder “Example” Double click on “Example” folder Type “Eq1” in the “File Name” box Press Open

New Project The GAMS window should now show the new Eq1.gpr project window

Create New GAMS Code File Select: File  New You should see the new file “Untitled_1.gms”

Enter GAMS Code Define Variables Define Equations Define Model The Model The code VARIABLES Z, X1, X2, X3; EQUATIONS F ; F.. Z =E= X1+2*X3+X2*X3-X1*X1-X2*X2-X3*X3 ; MODEL HW41 /ALL/; SOLVE HW41 USING NLP MAXIMIZING Z; FILE res /HW41.txt/; PUT res; put "Solution X1 = ", put X1.L, put /; put " X2 = ", put X2.L, put /; put " X3 = ", put X3.L, put /; Define Variables Define Equations Define Model Solve Model Write Output

Enter GAMS Code The Model The code

Run the Model Select: File  Run, or Press the red arrow button

GAMS Model Results Results are in file: HW41.txt Double Click this line to open results file

Viewing Results File Note Tabs Results

Another Example Model How to determine the coefficients: Least Squares Regression Residual Model Observation

Observations t x1(t) x2(t) x3(t) y(t) 1 2 30 10 3 60 6 20 70 7 4 5 80 40 90 9 50 100 8 17

Second GAMS Code SETS t / 1, 2, 3, 4, 5, 6, 7, 8 /; PARAMETER x1(t) /1 2, 2 3, 3 3, 4 3, 5 5, 6 5, 7 6, 8 7/; PARAMETER x2(t) /1 30, 2 60, 3 70, 4 60, 5 80, 6 90, 7 100, 8 100/; PARAMETER x3(t) /1 1, 2 6, 3 7, 4 3, 5 5, 6 9, 7 8, 8 17/; PARAMETER y_hat(t) /1 10, 2 20, 3 30, 4 20, 5 40, 6 50, 7 60, 8 70/; VARIABLES a, b, c, y(t), e(t), obj; EQUATION mod(t), residual(t), objective; mod(t).. a*x1(t)*x1(t)-b/x3(t)-c/x2(t)+EXP(-y(t)*y(t)) =E= y(t); residual(t).. e(t) =E= y(t)-y_hat(t); objective.. obj=E=sum(t,power(e(t),2)); MODEL Leastsq / ALL /; SOLVE Leastsq USING NLP MINIMIZING obj; FILE res /Eq2.txt/ PUT res; PUT " t x(1,t) x(2,t) x(3,t) y(t) y_hat(t)"/; LOOP((t),PUT t.TL, x1(t), x2(t), x3(t), y.L(t), y_hat(t)/;); PUT /" a b c"/; PUT a.L, b.L, c.L;

Second GAMS Code Define Sets & Data Define Variables Define Equations Solve Model Write Output

Results

Results

Capacity – Yield Example Use linear programming in GAMS to derive a capacity-yield (K vs Y) function for a reservoir at a site having the following record of flows 5, 7, 8, 4, 3, 3, 2, 1, 3, 6, 8, 9, 3, 4, 9 units of flow. Find the values of the capacity required for yields of 2, 3, 3.5, 4, 4.5, and 5. K Y Qt K St Y Rt

Capacity – Yield Curve Qt K St Y Rt K Y

The GAMS Code

Results: Yield = 5, Capacity = 14

Results: Yield = 5, Capacity = 14

Capacity vs Yield Curve

The DOLLAR Sign S(t+1)$(ord(t) lt 15) + S('1')$(ord(t) eq 15) =e= S(t) + Q(t)- SPILL(t) - Y; you can exclude part of an equation by using logical conditions ($ operator) in the name of an equation or in the computation part of an equation. The ORD operator returns an ordinal number equal to the index position in a set.

Management of a Single Reservoir 2 common tasks of reservoir modeling: Determine coefficients of functions that describe reservoir characteristics Determine optimal mode of reservoir operation (storage volumes, elevations and releases) while satisfying downstream water demands

Reservoir Operation Compute optimal operation of reservoir given a series of inflows and downstream water demands where: St End storage period t, (L3); St-1 Beginning storage period t, (L3); Qt Inflow period t, (L3); Rt Release period t, (L3); Dt Demand, (L3); and K Capacity, (L3) Smin Dead storage, (L3)

Comparison of Average and Dry Conditions

GAMS Code SCALAR K /19500/; Capacity SCALAR S_min /5500/; Dead storage SCALAR beg_S /15000/;   SETS t / t1*t12/; $include River1B_Q_Dry.inc $include River1B_D.inc $include River1B_Evap.inc VARIABLES obj; POSITIVE VARIABLES S(t), R(t); S.UP(t)=K; S.LO(t)=S_min;  Capacity Dead storage Beginning storage These $include statements allow Us to read in lines from other files: Flows (Q) Demands (D) Evaporation (at, bt) Set bounds on: Capacity Dead storage

GAMS Code (Cont.) First Time, t = 1, t-1 undefined EQUATIONS objective, balance(t);   objective.. obj =E= SUM(t, (R(t)-D(t))*(R(t)-D(t)) ); balance(t).. (1+a(t))*S(t) =E= (1-a(t))*beg_S $(ord(t) EQ 1) + (1-a(t))*S(t-1)$(ord(t) GT 1) + Q(t) - R(t)- b(t); First Time, t = 1, t-1 undefined After First Time, t > 1, t-1 defined We’ll preprocess these

$include Files Flows (Q) Demands (D) Evaporation (at, bt) Parameter Q(t) inflow (million m3) * dry / t1 375 t2 361 t3 448 t4 518 t5 1696 t6 2246 t7 2155 t8 1552 t9 756 t10 531 t11 438 t12 343 /; Parameter D(t) demand (million m3) / t1 1699.5 t2 1388.2 t3 1477.6 t4 1109.4 t5 594.6 t6 636.6 t7 1126.1 t8 1092.0 t9 510.8 t10 868.5 t11 1049.8 t12 1475.5 /; Parameter a(t) evaporation coefficient / t1 0.000046044 t2 0.00007674 … t11 0.000103599 t12 0.000053718/;   b(t) evaporation coefficient t1 1.92 t2 3.2 t11 4.32 t12 2.24/;

Results Storage Input Release Demand t0 15000 t1 13723 426 1700 t2   t1 13723 426 1700 t2 12729 399 1388 t3 11762 523 1478 t4 11502 875 1109 t5 12894 2026 595 t6 15838 3626 637 t7 17503 2841 1126 t8 17838 1469 1092 t9 18119 821 511 t10 17839 600 869 t11 17239 458 1050 t12 16172 413 1476