Subject: Weap + R + WhatsApp Posted: 4/15/2022 Viewed: 886 times
I beggan to use Weap recently in a project that aims to access water availability at Paracatu Basin, Brazil. I'm using WEAP to create Scenarios of irrigation water Demand with diferent crop time and type, areas size at planning units. All of these with rainfall forecast. It is a hard work to do without programming. So i started to code in R (my birth language) based on "WEAP_Calibration_and_Ensamble_with_R_Tool" and VBA Examples at WEAP help. I achieve some progress which will be enough to achieve our goals. But im very interested in learn more about it since im doing a almost "try and fail" method without theorical knowledge of "COM Automation Server", VBA structure.... To do so i will created a Whats App group (https://chat.whatsapp.com/EeWWyeRzU3bHc6XS88oTAg) and i'm sharing the basic newbie R/WEAP code that i wrote. Maybe we can achieve some progress together.
For WEAP developers: If there is any problem with this post, please let me know and i delete this post.
Best Wishes. Arthur.
#Calculate Variable "2" of Branch "4" with fixed value #Just Examples. R returns an Erros but it works fine at WEAP
WEAPBranch[["Children"]][][["Variables"]][][["Expression"]] = 16 #Fixed HeadFlow
#Calculate Variable "2" of Branch "4" with ReadFromFile expression. R returns an Erros but it works fine at WEAP
WEAPBranch[["Children"]][][["Variables"]][][["Expression"]] = "ReadFromFile(C:\\Users\\arthur\\OneDrive\\projetoWeapDemanda\\resultados\\vazoes_est_select2.csv; 42250000_m3s; ; Minimum; ; Replace)"
WEAP$LoadFavorite("Flow Requirement Coverage") #load result frame at WEAP
WEAP$ExportResults("C:\\Users\\arthur\\Documents\\WEAP Areas\\demanda_weap\\results\\FRC.csv") #Export Table
Ms. Anne Hereford
Subject: Re: Weap + R + WhatsApp Posted: 4/28/2022 Viewed: 724 times
Very cool, Arthur! Thanks for sharing your work and creating the WhatsApp group. I hope it produces some fruitful collaboration and advances!
(Please note that WEAP developers have not tested or verified the code contained in this post.)