Welcome to WEAP's Website
WEAP
WEAP is an initiative of the Stockholm Environment Institute.


About WEAP

Home
Why WEAP?
Features
What's New?
Sample Screens
Demonstration
Applications
Publications
History and Credits

Using WEAP
Download
Licensing
User Guide
Tutorial
Videos
Resources

User Forum
Discussions
Members List
Edit Profile

Additional Support
Training
University Courses
Collaboration

About Us
SEI-US Water Resources Program
Please Contact Us


Environmental News
LEAP
Interested in Energy?
Read about LEAP: SEI's software for energy planning.

User Forum

All Topics | Topic "Importing New Branches into WEAP from Excel"
Log in to post new messages or reply to existing messages.
 
Author Message
vignesh sridharan

Subject: Importing New Branches into WEAP from Excel   
Posted: 4/28/2016 Viewed: 2584 times
Hello,

I am developing a water management model of certain African countries in WEAP. I had to make a 'Key Assumption' to represent 1000 small districts and their population. I was wondering if I could have it in Excel and directly import them into WEAP. But i did some digging on the user Manuals and it had the following words
"WEAP can only import data that corresponds to an existing branch/variable/scenario"

So i believe that I need to create these 1000 branches in WEAP and then I can use the import/export function to deal with the EXPRESSIONS.

Can someone guide me if my understanding is right and if wrong, how do i take numerous amount of branches into WEAP without clicking and adding them one by one.

Best
vignesh
Jack Sieber

Subject: Re: Importing New Branches into WEAP from Excel   
Posted: 4/28/2016 Viewed: 2583 times
You can use the WEAP Application Programming Interface (API) to automate the adding of branches. See the WEAP help topic for more information: Advanced Topics \ Automating WEAP (API).

Here's the Visual Basic Script (VBS) code you use to create 1000 branches, named with sequential numbers:

Set WEAP=CreateObject("WEAP.WEAPApplication")
Set ParentBranch=WEAP.Branch("\Key Assumptions")
For i = 1 to 1000
Set NewBranch = ParentBranch.AddChild("Branch " & i)
Next

If you have the names of the new branches in an Excel spreadsheet, you could use Excel's Visual Basic for Applications (VBA) language to write a simple macro that would create branches using names from Excel cells. For more information on controlling WEAP from Excel, see the Help topic: Advanced Topics \ Automating WEAP (API) \ Exploring the API.

Jack

vignesh sridharan

Subject: Re: Importing New Branches into WEAP from Excel   
Posted: 5/9/2016 Viewed: 2530 times
Dear Jack,

Thanks for the help. It definitely reduces a lot of downtime.

Best
vignesh
Topic "Importing New Branches into WEAP from Excel"