Automating Entering Data in WEAP and Scenario Analysis Erfan Goharian Hydroinformatics Fall 2013.

Slides:



Advertisements
Similar presentations
Ecolego 6.2 Changes since 6.1 Erik Johansson Facilia AB.
Advertisements

KM Ticket Automation Process Flow Diagram. Local Components FC (Flow Computer) –Local proprietary computer that reads the meter. FDS (Field Data Server)
Chapter 8 Improving the User Interface
SC ICT Certification Level 1 07 Spreadsheets By Ross Parker.
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
SOFTWARE PRESENTATION ODMS (OPEN SOURCE DOCUMENT MANAGEMENT SYSTEM)
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
Session 6 Server-side programming - ASP. An ASP page is an HTML page interspersed with server-side code. The.ASP extension instead of.HTM denotes server-side.
Integrating Access with the Web and with Other Programs.
Guide To UNIX Using Linux Third Edition
1 Foundations of Software Design Lecture 27: Java Database Programming Marti Hearst Fall 2002.
MCDST : Supporting Users and Troubleshooting a Microsoft Windows XP Operating System Chapter 5: User Environment and Multiple Languages.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
8/6/2015Auto Attendants 1 Smarter Communications.
Figure 1. Hit analysis in 2002 of database-driven web applications Hits by Category in 2002 N = 73,873 Results Reporting 27% GME 26% Research 20% Bed Availability.
SQL Server Management Studio Introduction
Michael Tucker DBA / Webmaster Forsyth County Public Library.
Python Programming Fundamentals
Classroom User Training June 29, 2005 Presented by:
1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Access 2010 by Robert Grauer, Keith Mast, and Mary Anne.
ICC Features Features Supporting unlimited projects per ICC –Advanced technical support Friendly registration utility 5 password-levels exceptional workspace.
Introduction to SPSS Edward A. Greenberg, PhD
Python Programming, 2/e1 Python Programming: An Introduction to Computer Science Chapter 2.
Creating a Web Site to Gather Data and Conduct Research.
SPSS Presented by Chabalala Chabalala Lebohang Kompi Balone Ndaba.
Introduction to Computational Linguistics Programming I.
PHP meets MySQL.
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
Audio Dial In: or CRM to RM Visual CRM to MS-CRM 2007 Visual User Group Nov 21 st 2007.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
Overview of WEAP. Water Evaluation and Planning System WEAP A generic, object-oriented, programmable, integrated water resources management modelling.
1 Working with MS SQL Server Textbook Chapter 14.
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
CIS 338: Using Queries in Access as a RecordSource Dr. Ralph D. Westfall May, 2011.
Chapter 17 Creating a Database.
Mel & Hot Keys Review. What’s MEL?  Maya Embedded Language  Most of Maya's interface is built using MEL commands and scripts.
Introduction to CS520/CS596_026 Lecture Two Gordon Tian Fall 2015.
Advanced samples Printing two types of labels from two different custom forms We have two different labels that contain the same data. One is suitable.
Genesys Shell development Input-side development progress.
You Need an Interpreter!. Closing the GAP Thus far, we’ve been struggling to speak to computers in “their” language, maybe its time we spoke to them in.
Fall 2003Sylnovie Merchant, Ph.D. ACCESS Tutorial Note: The purpose of this tutorial is to provide an introduction to some of the functions of ACCESS in.
WgScheduler Generic Task Scheduling Application. What Does It Do  Automates any task that may be scripted using VBScript  Triggers task execution (or.
Imagine Creating Software Without a Single Line of Code!
Understanding Visual Basic Fundamentals CHAPTER 13 Understanding Visual Basic Fundamentals.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 8 1 Microsoft Office Access 2003 Tutorial 8 – Integrating Access with the.
Lecture 11 Introduction to R and Accessing USGS Data from Web Services Jeffery S. Horsburgh Hydroinformatics Fall 2013 This work was funded by National.
Modeling with WEAP University of Utah Hydroinformatics - Fall 2015.
 2001 Prentice Hall, Inc. All rights reserved. Outline 1 JavaScript.
Desktop Database and Climate Analysis Steven Burian and Erfan Goharian Hydroinformatics Fall 2013.
Web Database Programming Using PHP
Steven Burian and Erfan Goharian Hydroinformatics Fall 2013
CSC 222: Object-Oriented Programming
Introduction to GIS PythonScript CGIS-NURIntroduction to ArcGIS II.
Automating Entering Data in WEAP and Scenario Analysis
Lecture 19 Automating Preparing and Entering Model Data in WEAP
Web Database Programming Using PHP
Software for remote reading MBus Communicator v1.9
Basic operations in Matlab
Impact of Climate Change on Water Resources
Programming In Any Language With “Hello, World!” Examples
Customization
Web Systems Development (CSC-215)
Microsoft Office Access 2003
T. Jumana Abu Shmais – AOU - Riyadh
Microsoft Office Access 2003
Web DB Programming: PHP
8 6 MySQL Special Topics A Guide to MySQL.
Bash Scripting CS 580U - Fall 2018.
Automation and IDispatch
Presentation transcript:

Automating Entering Data in WEAP and Scenario Analysis Erfan Goharian Hydroinformatics Fall 2013

Learning Objectives Automate data entry to a water resources model Use the WEAP application programming interface (API) to enter climate data Analyze different scenarios in WEAP

Steps to automate the transformation 1.Read precipitation values for a desired location 2.Convert Water Year to Calendar Year (if it’s needed) 3.Covert units (if it’s needed) 4.Write to CSV file 5.Repeat #1-4 for next desired location 6.Repeat #1-5 for climate change scenario

WEAP Scenario Explorer First, a “Current Accounts” year is chosen to serve as the base year of the model A “Reference” scenario is established from the Current Accounts to simulate likely evolution of the system without intervention. Finally, “what-if” scenarios can be created to alter the “Reference Scenario” and evaluate the effects of changes in policies and/or technologies.

Automate Data Entry Using the Application Programming Interface WEAP Model The User User Interface Prompts plots, etc. Mouse clicks keyboard etc. Scripts, Other Programs, Models, Remote Computers Methods Classes Properties Functions etc. API

Scripting in WEAP 1.Internally: create more powerful expressions and functions e.g., create a script to calculate reservoir water quality, and Call the script from a WEAP expression 2.Externally: to automate WEAP via its Application Programming Interface (API) to perform a sequence of actions e.g., create and run 100 WEAP scenarios by varying the value of several parameters (sensitivity analysis)

Accessing the WEAP API Script Editor: edit, interactively debug and run scripts main menu: Advanced, Scripting, Run. Script: VBScript and JScript come with Windows other scripting languages must be installed (like Perl, Python, Ruby and PHP) COM Automation Server Run WEAP from other software like Excel Install reference library and go!

List the names of the demand sites in the current WEAP Area WEAP. is an object with numerous properties including all the branches of the data tree We loop through all the elements of Demand Sites Enter “WEAP.” to see the available properties/methods FOR EACH Br IN WEAP.Branch("\Demand Sites").Children PRINT Br.Name NEXT

What CSV file is assigned to the precipitation? PRINT "Show the CSV file assigned as the precipitation" FOR EACH br IN WEAP.Branch("\Demand Sites").Children PRINT br.Name & " " & br.Variables("precipitation").Expression Next

Connecting to Database Const adOpenStatic = 3 Const adLockOptimistic = 3 Set objConnection = CreateObject("ADODB.Connection") Set objRecordSet = CreateObject("ADODB.Recordset") objConnection.Open "DSN=your data source name;UID=root;PWD=YOUR PASSWORD;Database=weap" Set WshShell = CreateObject("WScript.Shell") Set fso = CreateObject("Scripting.FileSystemObject")

Query from Database SQL_Command_String1 = " Select f_airport.`Date`, rcp26 from f_airport WHERE" & _ " ' ' <=f_airport.`Date` and f_airport.`Date`<=' ' INTO OUTFILE 'C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/airport_rcp26.csv'" & _ "FIELDS TERMINATED BY ','" & _ "ENCLOSED BY ' '" & _ "LINES TERMINATED BY '\n';" Set Rs2 = objConnection.Execute(SQL_Command_String1)

Assign scenarios the precipitation 'Define the scenarios' Dim ScenInfo(1,3) 'WEAP Scenario name in column 1 (index 0)' ScenInfo(0,0) = "Current Accounts" 'Represents first base year. Data is defined' ScenInfo(0,1) = "Reference" 'Historical conditions provided in previous class' ScenInfo(0,2) = "rcp26" 'rcp26' ScenInfo(0,3) = "rcp85" 'rcp85' 'CSV file name affix in column 2 (index 1)' ScenInfo(1,0) = "" ScenInfo(1,1) = "" ScenInfo(1,2) = "" ScenInfo(1,3) = ""

Assign watersheds the precipitation 'Define watersheds' Dim WatershedInfo(1,3) 'WEAP watershed name in Column 1 (index 0)' WatershedInfo(0,0) = "City Creek Watershed" WatershedInfo(0,1) = "Dell Creek Watershed" WatershedInfo(0,2) = "Lamb Creek Watershed" WatershedInfo(0,3) = "Big Cottonwood Watershed" 'CSV data file name in Column 2 that goes with watershed name' 'in Column 1 (index 1)' WatershedInfo(1,0) = "airport" ' CSV file name ' WatershedInfo(1,1) = "parleys" WatershedInfo(1,2) = "parleys" WatershedInfo(1,3) = "parleys"

Assign precipitation from database Dim i 'watershed index' Dim s 'Scenario index' 'Loop over the scenarios' FOR s = 2 to ubound(ScenInfo,2) 'we already defined' 'the historical CSV files for Current and Reference scenarios' Set Sc = WEAP.Scenarios("" & ScenInfo(0,s)) 'The first double quotes forces the parameter to a text string' PRINT "" PRINT SC.Name & " is now active" Sc.Activate 'Activate the scenario so data inputs are for that scenario only' 'Work on the watersheds' FOR i=0 to ubound( WatershedInfo,2) Set CurrWts = WEAP.Branch("\Demand Sites\" & WatershedInfo(0,i)) CurrWts.Variables("Precipitation").Expression = "ReadFromFile(C:\ProgramData\MySQL\MySQL Server 5.7\Uploads\" & WatershedInfo(1,i) & "_" & SC.Name & ".csv,,2010, SUM)" PRINT "Updated " & CurrWts.Name & " with Precipitation " & CurrWts.Variables("Precipitation").Expression Next NEXT

Assignment #9 Change factor charts (from 6 tables: 2 stations and 3 time slices) Reliability of historical period (from WEAP) Comparison between streamflow and reliability of system between reference period and RCP26 and RCP 85 (for ) Optional: Compare historical period with all RCPs and over next 100years