Call vensim
-
- Member
- Posts: 36
- Joined: Fri Aug 20, 2010 11:03 am
I am back with a new problem.
As you remeber, I managed to control Vensim via Matlab on a WinXP computer. Meanwhile, my intership came to an end, so I didn't work with Vensim for some time.
Now I tried again to call Vensim from Matlab on the same computer - and it does not work anymore. I simply cannot load any model, the LOADMODEL command just returns 0 without an window opening up or something like that.
It's quite similar to the situation on my Win7 computer (I explained before), only it did work on this one last time. I can't be completely sure that there hasn't been any modifiying on this computer; but what could anyone have done to cause this problem?
I tried reinstalling Vensim, but that does not help.
It is possible to load the DLL, I also can use the command 'vensim_check_status' (which returns 0), but I cannot load models - which means I can't work.
By the way, I searched for the vendll.err, but didn't find it. Where is it supposed to be on a WinXP computer?
Do you have any ideas? I virtually have no clue why this suddenly wouldn't work anymore.
As you remeber, I managed to control Vensim via Matlab on a WinXP computer. Meanwhile, my intership came to an end, so I didn't work with Vensim for some time.
Now I tried again to call Vensim from Matlab on the same computer - and it does not work anymore. I simply cannot load any model, the LOADMODEL command just returns 0 without an window opening up or something like that.
It's quite similar to the situation on my Win7 computer (I explained before), only it did work on this one last time. I can't be completely sure that there hasn't been any modifiying on this computer; but what could anyone have done to cause this problem?
I tried reinstalling Vensim, but that does not help.
It is possible to load the DLL, I also can use the command 'vensim_check_status' (which returns 0), but I cannot load models - which means I can't work.
By the way, I searched for the vendll.err, but didn't find it. Where is it supposed to be on a WinXP computer?
Do you have any ideas? I virtually have no clue why this suddenly wouldn't work anymore.
-
- Member
- Posts: 36
- Joined: Fri Aug 20, 2010 11:03 am
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
-
- Member
- Posts: 36
- Joined: Fri Aug 20, 2010 11:03 am
-
- Member
- Posts: 36
- Joined: Fri Aug 20, 2010 11:03 am
Thank you very much, Bob - your hint pointed in the right direction:
It made me check the function signatures of the library again, and - I have no idea why, maybe someone updated Vensim - they have changed. Previously, the function vensim_command e.g. needed the matlab type VoidPtr as input argument, and now it needs an simple string instead. After I changed all subroutines that used a VoidPtr it works again.
And the best thing is: After I found that out I suspected that this could be the problem with my Win7 computer as well - and I was right. It does now work there, too.
Funny story, though: Vensim was installed on both computers on the very same day - yet still the function signatures differed (well, until now - they're the same now). I cannot really make sense of that.
It made me check the function signatures of the library again, and - I have no idea why, maybe someone updated Vensim - they have changed. Previously, the function vensim_command e.g. needed the matlab type VoidPtr as input argument, and now it needs an simple string instead. After I changed all subroutines that used a VoidPtr it works again.
And the best thing is: After I found that out I suspected that this could be the problem with my Win7 computer as well - and I was right. It does now work there, too.
Funny story, though: Vensim was installed on both computers on the very same day - yet still the function signatures differed (well, until now - they're the same now). I cannot really make sense of that.
Re: Call vensim
Hi,
I have just seen your last post about loading a Vensim model into Matlab. I'm currently trying to achieve the same thing and noted your comment about the change in input arguments. I'm new to Vensim and have no experience using Matlab to interact with other applications. However, for my current project I need to be able to pass input values and run Vensim from Matlab, do some optimization based on the outputs (in Matlab) and run Vensim again with a different set of input values.
I think I was able to successfully load the Vensim dll but I have questions regarding loading a model. Here is the code I used:
When i run it I get ans = 1. Does this mean that the model has been successfully loaded? I'm wondering because i was expecting Vensim to open or something.
If this is not what I should get, could you please tell me where my mistake is?
Thank you very much for your time and consideration.
I have just seen your last post about loading a Vensim model into Matlab. I'm currently trying to achieve the same thing and noted your comment about the change in input arguments. I'm new to Vensim and have no experience using Matlab to interact with other applications. However, for my current project I need to be able to pass input values and run Vensim from Matlab, do some optimization based on the outputs (in Matlab) and run Vensim again with a different set of input values.
I think I was able to successfully load the Vensim dll but I have questions regarding loading a model. Here is the code I used:
Code: Select all
clear all
if not(libisloaded('VenDLL32'))
hfile = ['C:\Documents and Settings\All Users\Vensim\dll\vendll.h'];
dllfile = ['C:\Documents and Settings\All Users\Vensim\dll\vendll32.dll'];
loadlibrary(dllfile,hfile);
end
libfunctionsview VenDLL32
str=['SPECIAL>LOADMODEL|C:\Documents and Settings\opinon\My Documents\MatlabResearch\rabfox.vpm'];
calllib('VenDLL32','vensim_command',str);
If this is not what I should get, could you please tell me where my mistake is?
Thank you very much for your time and consideration.
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Call vensim
Yes. A 1 indicates success.When i run it I get ans = 1. Does this mean that the model has been successfully loaded?
You might just see the Vensim splash screen flash as the DLL loads, but you will not see Vensim itself.I'm wondering because i was expecting Vensim to open or something.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Call vensim
Great! Thank you very much!
Kind regards,
Olivia
Kind regards,
Olivia
Re: Call vensim
Hi,
I am trying to call Vensim from Matlab as well. However, I keep just getting 0 when using the loadmodel function (after having loaded the vensimdll32 library).
The .err file simply says 'Reinstall Vensim' and nothing else.
I reinstalled it but still it doesn't work.
Any suggestion?
Thank you all so much,
Stefano
I am trying to call Vensim from Matlab as well. However, I keep just getting 0 when using the loadmodel function (after having loaded the vensimdll32 library).
The .err file simply says 'Reinstall Vensim' and nothing else.
I reinstalled it but still it doesn't work.
Any suggestion?
Thank you all so much,
Stefano
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Call vensim
Can you post the code that you are using?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Call vensim
The "Reinstall Vensim" message can happen if the .dll can't find its language resource files, which can happen if you have path issues or have copied the .dll to a nonstandard location. Usually this is resolved by reinstalling Vensim. What Vensim version, operating system, and paths are you using?
Tom
Tom
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: Call vensim
Thank you Tom!tomfid wrote:The "Reinstall Vensim" message can happen if the .dll can't find its language resource files, which can happen if you have path issues or have copied the .dll to a nonstandard location. Usually this is resolved by reinstalling Vensim. What Vensim version, operating system, and paths are you using?
Tom
I am using Vensim 5.9e, Windows 7 and Matlab R2011b(32bit). Should I put the .dll file in a specific folder?
Re: Call vensim
I am using a combination of the successfull Matlab functions that some users posted here. basically what olive posted a few months ago.Administrator wrote:Can you post the code that you are using?
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Call vensim
No. Leave it where it is by default or it will not load properly.Yoller wrote:I am using Vensim 5.9e, Windows 7 and Matlab R2011b(32bit). Should I put the .dll file in a specific folder?
There is little we can suggest unless you can post the calls you are making. There may be something very obvious that is causing it to not work.Yoller wrote:I am using a combination of the successfull Matlab functions that some users posted here. basically what olive posted a few months ago.
And have you got the Vensim DLL demos working? We discussed this via email but still don't know if you have successfully got one of them working yet.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Call vensim
function loademo
if not(libisloaded('VenDLL32'))
hfile=[ 'C:\Users\Desktop\Vensim\Vensim\dll\vendll.h'];
loadlibrary('VenDLL32',hfile);
end
libfunctionsview VenDLL32
str=['SPECIAL>LOADMODEL|C:\Users\Desktop\Vensim\Vensim\dll\rabfox.vpm'];
calllib('VenDLL32','vensim_check_status')
calllib('VenDLL32','vensim_command',str)
Unfortunately I can't load any demos either.
if not(libisloaded('VenDLL32'))
hfile=[ 'C:\Users\Desktop\Vensim\Vensim\dll\vendll.h'];
loadlibrary('VenDLL32',hfile);
end
libfunctionsview VenDLL32
str=['SPECIAL>LOADMODEL|C:\Users\Desktop\Vensim\Vensim\dll\rabfox.vpm'];
calllib('VenDLL32','vensim_check_status')
calllib('VenDLL32','vensim_command',str)
Unfortunately I can't load any demos either.
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Call vensim
What happens when you try and run one of the demos? What error messages are you getting?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559