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

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 "script to set up reach linkage to grounwater node"
Log in to post new messages or reply to existing messages.
 
Author Message
Mr. Miroslav Kandera

Subject: script to set up reach linkage to grounwater node   
Posted: 2/15/2023 Viewed: 3553 times
hello,

because i am currently working on linking few hundreds of reaches to different groundwater nodes, i tried but wasnt able to find script to set link of reach at river to groundwater. In "inflows and outflows" section, the "groundwater inflow/outflow volume and outflow fraction" need to have selected groundwater node to which they are connected to, in field called "from Groundwater".

just for example, i thought it would look somewhat like one bellow, but none of those i tried work

WEAP.Branch("Supply and Resources\River\River X\Reaches\Below reach y").Variables("Groundwater Inflow Volume").ConnectedGroundwater = "Groundwater z"

yet i am not sure what or if there is command like "ConnectedGroundwater" for these variables to set it via script.

Thank you.

M.
Mr. Doug Chalmers

Subject: Re: script to set up reach linkage to grounwater node   
Posted: 2/5/2025 Viewed: 600 times
For those wondering, the latest versions of WEAP have a function for "ConnectedGroundwater". Please see the WEAP Help for "Branch API" and scroll down to ConnectedGroundwater. The help gives the following examples:

' List all nodes or reaches that have connections to groundwater
FOR EACH Br IN WEAP.Branches
SET GWNode = Br.ConnectedGroundwater
IF GWNode.ID > 0 THEN
PRINT Br.FullName & " IS CONNECTED TO " & GWNode.Fullname
END IF
NEXT

' Connect Central Reservoir to North Aquifer
WEAP.Branch("Central Reservoir").ConnectedGroundwater = "North Aquifer"

' Connect Central Reservoir to the first groundwater node
WEAP.Branch("Central Reservoir").ConnectedGroundwater = WEAP.GroundwaterNodes(1)

' Remove GW connection from Central Reservoir
WEAP.Branch("Central Reservoir").ConnectedGroundwater = ""
Topic "script to set up reach linkage to grounwater node"