Created
October 6, 2022 06:22
-
-
Save drheinheimer/47ce63791132189c7502c93a80e612d4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import win32com.client as client # get win32com from Python package pywin32 | |
# See WEAP API at https://www.weap21.org/WebHelp/WEAPApplication.htm | |
WEAP = client.Dispatch('WEAP.WEAPApplication') # create WEAP object | |
# Open the area | |
WEAP.Areas("my area").Open() | |
# Set the expression | |
WEAP.Branch("\Demand Sites\my demand site").Variables("Demand").Expression = '5' | |
# Run the model | |
WEAP.Calculate() | |
# Load favorite and save results | |
WEAP.LoadFavorite("my favorite") | |
results_path = './my favorite results.csv' | |
WEAP.ExportResults(results_path, False, False, True) # See docs or experiment with WEAP to understand options | |
WEAP.Quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment