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 "Expression Builder help"
Log in to post new messages or reply to existing messages.
 
Author Message
Mr. Rezar Lleshi

Subject: Expression Builder help   
Posted: 8/2/2024 Viewed: 1478 times
Hei,

I am a Master student and I am currently using WEAP to develop a hydrological model. I am using it to develop a hydrological model for my Master thesis. The problem I have with it is the amount of parameters I have to calibrate. For each catchment, you need to specify the parameters for each elevation band and for each land class in said elevation bands.

I have prepared some Key Assumptions to ease the process, assuming that, for example for Kc (cropping coefficient) it will remain the same for its specific land class and for each catchment. I had previously calibrated for 3 elevation bands: 0-1000, 1000-2000. 2000-3000 m. But now I decided to expand to 100 m intervals, starting from 500 m up to 2400 m.

I was trying to use the expression builder to try and "automate" the process. This expression would be inserted at each land class at each elevation band.

IF(Catchment = "Demand Sites and Catchments\NAME",

IF(ElevationBand >= 0 AND ElevationBand < 1000,

IF(LandClass = "Demand Sites and Catchments\NAME\Agriculture", Key\NAME\Kc\Agriculture,

IF(LandClass = "Demand Sites and Catchments\NAME\Forest", Key\NAME\Kc\Forest,

IF(LandClass = "Demand Sites and Catchments\NAME\Grassland", Key\NAME\Kc\Grassland,

IF(LandClass = "Demand Sites and Catchments\NAME\Shrubland", Key\NAME\Kc\Shrubland,

IF(LandClass = "Demand Sites and Catchments\NAME\Barren or Sparse Vegetation", Key\NAME\Kc\Barren or Sparse Vegetation,

IF(LandClass = "Demand Sites and Catchments\NAME\Open Water", Key\NAME\Kc\Open Water, 0))))))),

IF(ElevationBand >= 1000 AND ElevationBand < 2000, ........

However, I keep getting either an circular reference error or the following:

Expression refers to an invalid branch/variable combination. Referred branch: Demand Sites and Catchments\NAME. Referred variable: Kc

I have made sure to check the data for typos or wrong pathing but I dont see any problem. Im guessing the problem is on the first term where trying to link the catchment with the name of the catchment. I now know that using terms such as "Catchment", "Landclass" and "Elevation band" don't work.

I have already looked through the user forum and the WEAP tutorial, but this matter wasnt mentioned.
Mr. Doug Chalmers

Subject: Re: Expression Builder help   
Posted: 8/5/2024 Viewed: 1381 times
Rezar,

I can think of a few solutions which may help.

One option is to go to Data --> Edit --> Export Expressions to Excel. Here, you can build your expression based on the names of various data cells and you may consider using Excel functions such as concatenate or Vlookup.

Another, related solution is to store variables used for hydrologic parameters of multiple catchment objects under Key Assumptions or Other Assumptions. For example, you could have an other assumption for Other\Kc\Grassland, and then refer to that variable for all of your Grassland land use branches in your catchment objects. It sounds like you are already trying to do this, but may just need help in applying the expressions- see the export expressions to Excel in the first solution to apply this easily. You could also create a custom variable called "Land class name" or something and then try to use that in Expression Builder. Under the expression builder under branches, drag in the object to the expression builder text window and you can see all the parameters you can refer to. Also, see all the functions available in the Functions tab of the expression builder.

A final option is to use the API (Automatic Programming Interface) accessible under Advanced --> Scripting. Alternatively, you may use an external VB program such as Excel macros. See the WEAP help on API for more information.

Hope this helps. Please let us know if you are unable to resolve this issue.

-Doug

Topic "Expression Builder help"