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
Publications
History and Credits

Using WEAP
Download
Licensing
User Guide
Tutorial
Videos (YouTube)

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
Not acting like themselves: Antidepressants in environment alter crayf...
Expose crayfish to antidepressants, and they become more outgoing -- but that might not be such a positive thing for the...

Use of PFAS in cosmetics 'widespread,' new study finds
Many cosmetics sold in the United States and Canada likely contain high levels of per- and polyfluoroalkyl substances (P...

Baltic herring larvae appear earlier and grow faster due to climate ch...
Conditions during Baltic herring spawning may have cascading effects on the whole Baltic ecosystem.
Source: Science Daily
LEAP
Interested in Energy?
Read about LEAP: SEI's software for energy planning.

Link WEAP and LEAP for combined Water-Energy planning.
Watch a video demo!
   

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
Mr. Vignesh Sridharan

Subject: Importing New Branches into WEAP from Excel   
Posted: 4/28/2016 Viewed: 10059 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
Mr. Jack Sieber

Subject: Re: Importing New Branches into WEAP from Excel   
Posted: 4/28/2016 Viewed: 10057 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

Mr. Vignesh Sridharan

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

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

Best
vignesh
Eng. iman Ebrahim Bakhshipour

Subject: Re: Importing New Branches into WEAP from Excel   
Posted: 6/10/2019 Viewed: 3210 times
hello
i want to know how can set a content for key assumptions by vba? for example we can do that by such command for other variables: WEAP.BranchVariable("\Demand Sites\South City:Consumption").Expression = "30"

but how can we address a key assumption?

Mr. Jack Sieber

Subject: Re: Importing New Branches into WEAP from Excel   
Posted: 6/10/2019 Viewed: 3204 times
Because Key Assumption and Other Assumption branches do not have variable tabs, you do not need to give a variable name when referencing them.

For example, to change the population growth rate assumption in Weaping River Basin, here is the VB code:

WEAP.BranchVariable("\Key Assumptions\Drivers\Population Growth Rate").Expression = 1.5
Eng. iman Ebrahim Bakhshipour

Subject: Re: Importing New Branches into WEAP from Excel   
Posted: 6/16/2019 Viewed: 3138 times
thanks mr.sieber
but i have one more question
are there any way to set different content for each months as what we do in 'monthly time-series wizard' ,from excel?
same what we do for resualt value: 'WEAP.ResultValue("\Supply and Resources\River\Weaping River\Reservoirs\Central Reservoir:Storage Volume[Million]", 2017, 7, "Reference").

i do not want to do it by 'readfromfile wizard' ,because it's very time-consuming in optimization model that i want to develop it.
Topic "Importing New Branches into WEAP from Excel"