Page 2 of 3

Posted: Fri Aug 27, 2010 5:18 pm
by ahmadi2010
Thank you all dear friends

Yes ,you are right. Because I thought the modified hfile never works.Now I tried:

>> vendll=['C:\Windows\SysWOW64\venDLL32.dll']

vendll =

C:\Windows\SysWOW64\venDLL32.dll

>> hfile = ['C:\Users\mrj\Desktop\New folder (3)\vendll.h']

hfile =

C:\Users\mrj\Desktop\New folder (3)\vendll.h

>> loadlibrary(vendll,hfile);
??? Error using ==> loadlibrary at 480
There was an error loading the library "C:\Windows\SysWOW64\venDLL32.dll"
C:\Windows\SysWOW64\venDLL32.dll is not a valid Win32 application.



Caused by:
Error using ==> loaddefinedlibrary
C:\Windows\SysWOW64\venDLL32.dll is not a valid Win32 application.

Posted: Sat Aug 28, 2010 10:10 am
by bob@vensim.com
You should try one of the sample files that installs with Vensim to see if that works - probably the Excel example is the easiest to try. If you have files installed in Program Files(x86) that also means you must have an old version of Vensim - you should probably update that. The dll files should install to Users\Public\Vensim\DLL on Win 7.

Posted: Sat Aug 28, 2010 11:06 am
by ahmadi2010
Vensim Dss(Vensim 5.9b), I work with this version.Is it old version?A company installed it on my computer.

Posted: Sat Aug 28, 2010 2:20 pm
by ahmadi2010
Yes there is not any thing about vensim in this path(Users\Public)
I open these two addresses :

C:\Program Files (x86)\Vensim\dll\EXCEL7
C:\Program Files (x86)\Vensim\dll\EXCEL97

And run them. They don’t response. I mail their response for you.

[Edited on 8-28-2010 by ahmadi2010]

Posted: Sun Aug 29, 2010 11:02 am
by bob@vensim.com
You definitely can't open any excel files in the program directories on Windows 7. Try moving the DLL directory to a different location and seeing if any of the example (eg Java) will work.

Posted: Sun Aug 29, 2010 12:18 pm
by ahmadi2010
Excuse me bob ;

I can't understand what you mean exactly. before I never works with Java.
you mean I change the path of vendll32.dll, or try it on computer with win(xp), or write any program in Java or Excel program!!!!!!!!

and again Vensim Dss(Vensim 5.9b) is very old version of vensim that dosen't work with matlab?

Posted: Sun Aug 29, 2010 6:05 pm
by tomfid
5.9b is not particularly old, but evidently uses paths that don't work with Win7. I think what Bob is suggesting is that you should copy your C:\Program Files (x86)\Vensim\dll to another location, i.e. your user documents directory, because Win7 won't let them run where they are. No need to do any programming.

However, it may also be the case that your vendll32.dll is in the wrong place. I don't know where it belongs though as I don't use Win7. If you have an XP machine to try, that is much more likely to work with 5.9b.

Tom

Posted: Mon Aug 30, 2010 4:38 pm
by ahmadi2010
Thank you Tom .

Can I give a backup of vensim software in win7 & Restore this backup to win XP in another computer?

[Edited on 8-31-2010 by ahmadi2010]

Posted: Tue Aug 31, 2010 9:29 am
by bob@vensim.com
You can install to the XP machine using the same registration code you installed to the Win 7 machine.

Posted: Sun Sep 12, 2010 10:12 am
by ahmadi2010
I want install 2 windos on my laptop. win xp & win7. & then install vensim DSS on both of them.Do DSS work on both of them corectly?

Posted: Mon Sep 13, 2010 10:06 am
by bob@vensim.com
Yes, the current release of Vensim works on XP, Vista and 7.

Posted: Fri Sep 24, 2010 8:49 pm
by ahmadi2010
Finaly I could load vendll32.

Now I load this model:

str=['SPECIAL>LOADMODEL|',test,'.vpm'];
lp=libpointer('voidPtr',[int8(str) 0]);
calllib('vendll32','vensim_command',lp);

How can I see the result of my model in matlab or the amount of variable thet I defined in vensim?

Posted: Sat Sep 25, 2010 10:32 am
by bob@vensim.com
See the example in the excel97 folder - this retrieves results from the DLL.

Posted: Sat Sep 25, 2010 2:34 pm
by ahmadi2010
Thank you Bob,
I couldn’t work with Ecxel Ex.It gives me error for Example I see this:

result=vensim_command("SIMULATE>LOADMODEL|c:\............)

I don't know how should I change this in matlab.

I write very simple model in vensim.
G=A*X, A=5,8,10,16,X=5, initial for G=0,
After I run the matlab:
It's response is :
str =
SPECIAL>LOADMODEL| .vpm
lp =
libpointer
ans =
0

Dose it correct?
Could anyone please help me to resolve this issue?
And for simulating the model?
How can I see amount of G, A, and X in matlab?

[Edited on 9-25-2010 by ahmadi2010]

[Edited on 9-25-2010 by ahmadi2010]

[Edited on 9-25-2010 by ahmadi2010]

Posted: Sat Sep 25, 2010 10:58 pm
by tomfid
It looks like you have some stray single-quote marks in your code.

Posted: Sun Sep 26, 2010 10:36 am
by bob@vensim.com
In VB you will need to change the location of the sample model so that it matches the location that the file is actually in. Once you have done this that sample should work and the vensim_get_data calls will demonstrate how to get results out.

Posted: Sun Sep 26, 2010 2:38 pm
by ahmadi2010
I correct them but again give error!!! I

and thise time I use fullpath.

str=['SPECIAL>LOADMODEL|D:\Documents and Settings\m\Desktop\vensim practice\1.vpm']
lp=libpointer('voidPtr',[int8(str) 1])
calllib('vendll32','vensim_command',lp)
……………………………
It’s response is:

str =SPECIAL>LOADMODEL|D:\Documents and Settings\m\Desktop\vensim practice\1.vpm
lp =libpointer
ans = 0
…………………….
Again Can any one help me?
I want simulate very simple model in matlab:(vensime model is: G=A*X, A=5,8,10,16,X=5, initial for G(level)=0)

what I should write in matlab?

another question: I attached error file but I can't see it here!!!!!

[Edited on 9-26-2010 by ahmadi2010]

[Edited on 9-26-2010 by ahmadi2010]

Posted: Sun Sep 26, 2010 3:30 pm
by Administrator
What happens if you try the following (I copied it from http://www.ventanasystems.co.uk/forum/v ... php?t=4181)?

str=['SPECIAL>LOADMODEL|D:\Documents and Settings\m\Desktop\vensim practice\1.vpm'];
lp=libpointer('voidPtr',[int8(str) 0]);
calllib('vendll32','vensim_command',lp);

Posted: Sun Sep 26, 2010 6:01 pm
by ahmadi2010
Thank you dear Administrator for your quick response.
I try this:(I save m file as gg)

if not(libisloaded('vendll32'))
hfile = ['D:\Program Files\Vensim\dll\vendll.h'];
loadlibrary('vendll32', hfile);
end
libfunctionsview vendll32
..................................................
str=['SPECIAL>LOADMODEL|D:\Documents and Settings\m\Desktop\vensim practice\1.vpm'];
lp=libpointer('voidPtr',[int8(str) 0]);
calllib('vendll32','vensim_command',lp);
………………………
For first time it opens the functions in library vendll32 table & I see the vensim open & close rapidly
& in matlab it’s response is,

Warning: Warnings messages were produced while parsing. Check the functions you
intend to use for correctness. Warning text can be viewed using:
[notfound,warnings]=loadlibrary(...)
> In loadlibrary at 374
In gg at 7
Warning: The function 'VensimCGetSubstring' was not found in the library
> In loadlibrary at 435
In gg at 7
Warning: The function 'vensim_shutdown' was not found in the library
> In loadlibrary at 435
In gg at 7
>>
…………………….
And for second & third times it only open that table without any warning.

Posted: Sun Sep 26, 2010 6:59 pm
by Administrator
Maybe it's best to try contacting someone who has successfully managed to get Matlab and Vensim communicating (try arraywanted or mrj.hoseini).

http://www.ventanasystems.co.uk/forum/m ... ile&u=1847
http://www.ventanasystems.co.uk/forum/m ... ile&u=1861

Most of us do not use Matlab so are only guessing about how to get it working.

Tony.

Posted: Sun Sep 26, 2010 7:16 pm
by ahmadi2010
thank you Tony.

Posted: Mon Sep 27, 2010 7:59 am
by arraywanted
I've never had these warning messages before. Have you checked which functions are contained in the library you loaded? You can do so with "libfunctionsview('vendll32')".
My vendll32 does contain 'VensimCGetSubstring', but not vensim_shutdown. That one isn't even mentioned in the manual, so I have no idea what this warning means.
Neither do I know why these functions should be needed for loading a model. Do these warnings appear when you load the library without loading a model for starters?

Do you know if your model has been loaded correctly? The callib(...) command has to return 1 for that.

Posted: Mon Sep 27, 2010 8:53 am
by ahmadi2010
Yes, these warnings appear when I load the library without loading a model for starters. But for second time these warning don’t appear.
My vendll32 does contain 'Vensim_get_substring' not 'VensimCGetSubstring',and not vensim_shutdown, too.:(

Posted: Mon Sep 27, 2010 9:40 am
by bob@vensim.com
What version of Vensim are you using? You need to make sure that the vendll.h file you have is consistent with that for the Vensim DLL in use. The easiest way to do this is to reinsatall selecting the DLL option and use those files.

Posted: Mon Sep 27, 2010 1:08 pm
by ahmadi2010
I am using vensim Dss version 5.3- yes before I selest the DLL option. I don't know why this warnning apears!!!!!

[Edited on 9-27-2010 by ahmadi2010]

[Edited on 9-27-2010 by ahmadi2010]