Welcome to WEAP's Website
WEAP is an initiative of the Stockholm Environment Institute.

About WEAP

What's New?
Sample Screens
History and Credits

Using WEAP
User Guide

User Forum
Members List
Edit Profile

Additional Support
University Courses

About Us
SEI-US Water Resources Program
Please Contact Us

Environmental News
Interested in Energy?
Read about LEAP: SEI's software for energy planning.

User Forum

All Topics | Topic "Weap automating with Matlab"
Log in to post new messages or reply to existing messages.
Author Message
Mostafa Khorsandi

Subject: Weap automating with Matlab   
Posted: 4/20/2012 Viewed: 24206 times
Does anyone know how can I automate weap with Matlab without problem?
It works very well with VB but have problems with matlab
Jack Sieber

Subject: Re: Weap automating with Matlab   
Posted: 4/20/2012 Viewed: 24205 times
I do not have any experience with Matlab and WEAP. Do you want to write a Matlab script to control WEAP, or write a script in WEAP to control Matlab?
Mostafa Khorsandi

Subject: Re: Weap automating with Matlab   
Posted: 4/20/2012 Viewed: 24202 times
I want to write a Matlab script to control WEAP
Mehdi Mirzaee

Subject: Re: Weap automating with Matlab   
Posted: 4/27/2012 Viewed: 24149 times
Hi Mostafa,

It is possible. when you can write VB and interact it with WEAP, means that you can connect MATLAB with WEAP, but there is a small problem! Are you trying to make an .exe file? So, are you sure that your MATLAB is not hacked one?
Honestly, some hacked MATLAB versions can not make execution files and sometimes shows a non sense error or message.

Alberto Vivas Narváez

Subject: Re: Weap automating with Matlab   
Posted: 5/31/2012 Viewed: 23852 times
Hi Mostafa:

In programming (VB) there are many things you can do but you should never forget the goal. What questions need to answer through link-WEAP MatLab?

You can use MATLAB in a wide range of Applications, Including signal and image processing, communications, control design, test and measurement, financial modeling and analysis, and computational biology


Mostafa Khorsandi

Subject: Re: Weap automating with Matlab   
Posted: 5/31/2012 Viewed: 23845 times
I want to optimize some parameters in weap by genetic algorithm (GA) or NSGA that exist in MATLAB, ...
and I'm not trying to write an .exe file to do this

writing an .exe file for this is a new idea that I didn't think about it
but maybe it can work.
if possible say me what is your way to link by means of an .exe file?

best regards
Mehdi Mirzaee

Subject: Re: Weap automating with Matlab   
Posted: 5/31/2012 Viewed: 23841 times

Well... Honestly I am not a Pro. programmer!just have a little things about MATLAB.

Anyway, I think that you have two or three ways. The first one is writing a .dll file, then call them in WEAP by "Enter Expression". It is the easiest way.

The second way is that you prepare a platform for everything which it can be a VBA platform (like Excel). you can run and call everything that you want by VBA expressions, like .dll or .exe file.
in this manner, if you are a software pro or you have some one to have "HEADACHE" for writing software, you can check this website:


you can write and then run a plat form of different software and link them each other. This is in a part of Deltares (Former Delft Hydraulics) website. Unfortunately, as I told you, I am not a programmer and old for learning it! :)

Have fun!
Ioannis Tsoukalas

Subject: Re: Weap automating with Matlab   
Posted: 11/30/2012 Viewed: 22862 times
i try to couple weap and matlab via COM and i have a similar problem.. here is 2 lines of matlab scritping

W=actxserver('WEAP.WEAPApplication') %%to make the coupling

W.Branch('\Demand Sites\South City').Variable('Consumption').Expression=30 %%to define the consumption

but in weap i get the logical value "True" does anyone know how can i make it work?
Mostafa Khorsandi

Subject: Re: Weap automating with Matlab   
Posted: 11/30/2012 Viewed: 22855 times
Hi Ioannis:
Unfortunately we couldn't solve this problem and our plan has been changed
but, if there is no obligation to do by Matlab, it is better to do by visual basic

behzad jamali

Subject: Re: Weap automating with Matlab   
Posted: 6/12/2013 Viewed: 20612 times
Hi Ioannis
did you solve the logical value "True" problem in data expression? I have te same problem, too.
i wonder if you can tell me about your experiences in weap automating With Matlab and its optimization algorithms.
Jack Sieber

Subject: Re: Weap automating with Matlab   
Posted: 9/9/2015 Viewed: 11667 times

Congratulations on your recent conference paper, "Hydrosystem Optimization on a Budget: Investigating the Potential of Surrogate Based Optimization Techniques", http://cest.gnest.org/cest15proceedings/public_html/papers/cest2015_00162_oral_paper.pdf . It appears that you were able to couple WEAP and MATLAB. Could you please explain briefly how you did it, so that others could benefit?

Topic "Weap automating with Matlab"