simulate vesim in matlab

Use this forum to post Vensim related questions.
Post Reply
hamoonwetland
Junior Member
Posts: 2
Joined: Fri Feb 04, 2011 8:38 am

simulate vesim in matlab

Post by hamoonwetland »

I want to simulate vensim in matlab, and add an optimization algorithm to it.
First I need to run vensim functions in matlab, but I have a problem doing this.
Please Help me.
I used the code below and was successfully load the library, because a window opened after the code had been run in matlab showing Vensim functions library.

if not(libisloaded('VenDLL32'))
hfile = ['C:\Users\Milad\Documents\MATLAB\vendll'];
loadlibrary('VenDLL32', 'vendll');
end
libfunctionsview VenDLL32

But I don't know how to use the functions to run a simulation for a specific model which was created already.
I use this code to load the model

vensim_command('SPECIAL>LOADMODEL|ET')

but an error occurs pointing " Undefined function or method 'vensim_command' for input arguments of type 'char' "

I read Vensim DSS reference supplemental.
and I saw the links below.

1. http://www.ventanasystems.co.uk/forum/v ... f=2&t=4193
2. http://www.ventanasystems.co.uk/forum/v ... php?t=4181

Any Further Help Please?
Milad.GHT
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: simulate vesim in matlab

Post by tomfid »

There aren't many matlab users here, so you may do better posting this question on a matlab forum. My guess is that you're not passing the command string to Vensim correctly - the problem could be as simple as the difference between single ' and double " - but that's just a guess. Judging by one of the forum comments that you linked, you may need to pass the command string via libpointer http://www.mathworks.com/help/techdoc/m ... 42650.html

A good test would be whether you can successfully call a function that takes a numeric argument, like vensim_be_quiet - there's less that can go wrong with that.
Post Reply