Presentation is loading. Please wait.

Presentation is loading. Please wait.

Automating Entering Data in WEAP and Scenario Analysis

Similar presentations


Presentation on theme: "Automating Entering Data in WEAP and Scenario Analysis"— Presentation transcript:

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

2 Learning Objectives Automate data entry to a water management model
Use WEAP application programming interface (API) to enter climate data Analyze climate scenarios effects on water using WEAP

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

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

5 Scripting in WEAP 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 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)

6 Accessing the WEAP API Script Editor: COM Automation Server
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! A script is a simple computer program which uses Microsoft's Windows Script technology. Scripts are text files written in one of the many different script languages that support Windows Script, such as VBScript, JScript (JavaScript), Perl, Python, Ruby and PHP. VBScript and JScript come with Windows and are always available, whereas other scripting languages must be installed by you on your computer before you can use them.

7 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

8 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

9 Assign watersheds the same precipitation
PRINT "Set precipitation for all watersheds to the same CSV file" Precipitation = "ReadFromFile" &_ "(C:\Users\Efran\Desktop\Hydroinformatic\U of U\2nd Session materials" &_ "\Hydrology needed files\Historical Precipitation\cc_pr_his.csv, , 1990)" Dim watersheds(3) watersheds(0) = "City Creek Watershed" watersheds(1) = "Dell Creek Watershed" watersheds(2) = "Lamb Creek Watershed" watersheds(3) = "Big Cottonwood Watershed" FOR EACH br IN watersheds Set CurrBr = WEAP.Branch("\Demand Sites\" & Br) PRINT "Updated" & CurrBr.Name CurrBr.Variables("Precipitation").Expression = Precipitation Next Consistently name the CSV files with precipitation values Use arrays to loop through the precipitation for different watersheds elements and csv files

10 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 What will happen if… [I change one or more inputs]?? Define and manage scenarios from the Data module Enter input data here too

11 WEAP Scenario Explorer
What will happen if… [I change one or more inputs]?? Define and manage scenarios from the Data module Enter input data here too


Download ppt "Automating Entering Data in WEAP and Scenario Analysis"

Similar presentations


Ads by Google