Updated 2013-01-20 17:56:59 by pooryorick

EKB WEAP (http://www.weap21.org/) is the Water Evaluation and Planning system from the Stockholm Environment Institute (SEI, web site: http://www.sei.se). It's a commercial package, but is free for people in developing country institutions. I've been working with it (because I work at SEI!) and have been thinking about how to run WEAP from Tcl/Tk for various purposes. WEAP can act as a COM server, so tcom seemed like a good choice.

For anyone else who might want to play with this, here's the example from the WEAP API help translated from VBScript into Tcl:
package require tcom

set weapobj [::tcom::ref createobject "WEAP.WEAPApplication"]

$weapobj Verbose 1
$weapobj Logfile [file join [$weapobj Directory] "WeapErrors.txt"]
$weapobj ActiveArea "Weaping River Basin"
$weapobj ActiveScenario "Supply Measures"

for {set GrowthRate 0} {$GrowthRate < 6} {incr GrowthRate} {
    set varobj [$weapobj BranchVariable {\Demand Sites\South City:Annual Activity Level}]
    $varobj Expression FALSE "Growth($GrowthRate%)"

    $weapobj LoadFavorite "Groundwater Storage"

    # Did user cancel?
    if {[$weapobj Status] eq "FALSE"} {
        break
    }
      
    $weapobj ExportResults "C:\\GWresults$GrowthRate.csv" FALSE TRUE
}