All Topics |
Topic: “Scripting Example”
Author | Message |
---|
Subject: Scripting Example
Posted: 2/21/2018 Viewed: 12650 times
Dear WEAP users,
I would like to share with you a script that automates WEAP to run number of times (each with a different value of hydropower demand) and then write the results out in one excel sheet.Hope you find it useful set xla=CreateObject("Excel.Application") xla.Visible=true xla.ScreenUpdating=false set xlw=xla.workbooks.Add set xls=xlw.sheets.Add set WEAP=CreateObject("WEAP.WEAPApplication") WEAP.Verbose=1 WEAP.ActiveArea="Tutorial" WEAP.Versions("HDresult").Revert WEAP.ActiveScenario="Reference" e=0 m=2 xls.Cells(1,1)="Year" For i=0 To 10 z=2 e=e+0.10 WEAP.Branch("Supply and Resources\River\Main River\Reservoirs\Big City Reservior").Variables("Energy Demand").Expression=e Call WEAP.LoadFavorite("Hydropower Generation") For j=WEAP.BaseYear To WEAP.EndYear xls.Cells(z,1)=j xls.Cells(1,m)=e xls.Cells(z,m)=WEAP.ResultValue("\Supply and Resources\River\Main River\Reservoirs\Big City Reservior:Hydropower Generation", j, 1, "Reference", j, 12) z=z+1 Next m=m+1 Next |
Subject: Re: Scripting Example
Posted: 2/6/2025 Viewed: 3225 times
Mohammed,
Thank you for your contribution! I wanted to bump this example in case it is useful for others. Apologies for not originally sending thanks. |
Topic: “Scripting Example”