Page 3 of 3
Posted: Tue Sep 28, 2010 9:33 am
by bob@vensim.com
It sounds like there is an inconsistency between vendll.h and the actually dll. The version you are using is too old for me to remember any such issues unfortunately.
Posted: Tue Sep 28, 2010 1:04 pm
by ahmadi2010
Thank you bob,:(,:o
if I install Vensim Dss(Vensim 5.9b) on Win Xp, does it work with matlab correctly?
[Edited on 9-28-2010 by ahmadi2010]
Posted: Tue Sep 28, 2010 1:47 pm
by Administrator
Best thing to do is try it and see.
Posted: Fri Oct 22, 2010 8:03 pm
by ahmadi2010
I used Micro & tried to run & simulate vensim from Excel. now I want for a mfile in matlab, call my excel program & run vensim model. How can I do?Can anyone help me?
Posted: Sat Oct 23, 2010 10:27 am
by bob@vensim.com
You might try a Matlab forum for this question. I doubt if anyone who reads this forum to help you with invoking Excel from Matlab. Excel can be controlled using OLE so there is almost certainly a way to do it, but OLE is pretty complicated so it may not be easy.
Posted: Wed Oct 27, 2010 9:41 am
by ahmadi2010
Thank you bob,
I could solve it.but now I have 2 questions.
when I link vensim and excel, I use another excel file for my variable in vensim and in vensim I used it's adress, now I want to close automatically the data excel window after run micro and run vensim.what can I do?
another question:when I use for loop in micro to run vensim several times,after each run vensim ask me a question and I have to answer it to go to the next step Otherwise it will not go to the next stage.I dont want to see this window.what Can I do?
it's question:dataset current already exist. do you want to overwrite it?
Posted: Wed Oct 27, 2010 10:09 am
by Administrator
>> when I link vensim and excel, I use another excel file for
>> my variable in vensim and in vensim I used it's adress, now I
>> want to close automatically the data excel window after run micro
>> and run vensim.what can I do?
This is all in Matlab code isn't it? You will need to ask on a Matlab forum for the answer.
>> another question:when I use for loop in micro to run vensim several
>> times,after each run vensim ask me a question and I have to answer
>> it to go to the next step Otherwise it will not go to the next stage.
>> I dont want to see this window.what Can I do?
There is a function you can call in the same way as vensim_command called vensim_be_quiet. Call this in your code and the box will not appear. But see the next answer as well before you do this.
>> it's question:dataset current already exist. do you want to overwrite it?
What is the command you are using to run the model? Is it "MENU>RUN|"? If it is, try "MENU>RUN|o" instead.
[Edited on 27-10-2010 by Administrator]
Posted: Wed Oct 27, 2010 3:40 pm
by ahmadi2010
I'm using :
Sub Simulate()
Application.DDEExecute DDE_channel, "[MENU>RUN1|O]"
Application.Visible = True
End Sub
....................
and this table appears: Question from vensim!!!!!!!!!!!!
[Edited on 10-27-2010 by ahmadi2010]
[Edited on 10-27-2010 by ahmadi2010]
Posted: Wed Oct 27, 2010 10:16 pm
by Administrator
Try MENU>RUN|o and see if that solves the problem.
Posted: Thu Oct 28, 2010 7:54 am
by ahmadi2010
T try these:
Try MENU>RUN|O
Try MENU>RUN|o
Try MENU>RUN|0
But whenevev I run micro that table appears and I have to say yes to it. Is there any way that I manage it from inside of vensim program to automatically replace each new run to previos?
Posted: Thu Oct 28, 2010 9:14 am
by ahmadi2010
Thank you Tony:)
I find it by myself
In option table\setting I should select (overwrite(no query)).
Posted: Thu Oct 28, 2010 9:36 am
by ahmadi2010
now I have another question:
when I run micro, when it reach to the step that should show the result in the place that I specified for it in excel,for some of them this apears:--
But only somtimes.Do you know what is the reason??
[Edited on 10-28-2010 by ahmadi2010]
[Edited on 10-28-2010 by ahmadi2010]
Posted: Thu Oct 28, 2010 10:16 am
by bob@vensim.com
In Vensim -- means :NA: - I don't know what micro is, but it sounds like something might not have been computed.
Posted: Thu Oct 28, 2010 10:26 am
by ahmadi2010
after run micro,vensim has calculated and I can see the results in vensim but in excel I can't see it????
Sub GetValue()
Dim returnList As Variant
For i = 1 To 10
varstr$ = Cells(5,

.Text + "@" + Str(i)
returnList = Application.DDERequest(DDE_channel, varstr$)
Cells(4 + i, 10).Value = returnList(LBound(returnList))
Cells(4 + i, 9).Value = i
Next
varstr$ = Cells(5, 12).Text
returnList = Application.DDERequest(DDE_channel, varstr$)
Cells(5, 13).Value = returnList(LBound(returnList))
varstr$ = Cells(5, 15).Text + "@" + Cells(5, 16).Text
returnList = Application.DDERequest(DDE_channel, varstr$)
Cells(5, 17).Value = returnList(LBound(returnList))
End Sub
....................................
for the first time after run I can see all the value that calculated by the vensim, but for the second and ....... that sign apears!!!!
[Edited on 10-28-2010 by ahmadi2010]
Posted: Thu Oct 28, 2010 11:11 am
by Administrator
You will need to upload the model and spreadsheet for us to take a proper look. If you would prefer to email them to me direct I can take a look (
tony@vensim.com).
Posted: Thu Oct 28, 2010 12:00 pm
by ahmadi2010
I'm faced with a new event. I'm using micro like these:
sub load model()
.
.
end sub
..............
sub setconstant()
.
.
endsub
..............
sub simulate()
.
.
end
...........
and so
....................
when I run these micro by click on eachone steb by step,it works correctly.But when I record these micros and use one micro for running the program, I see (--) for some variable!!!!!!!!!!!!But I need to record and use one micro:(
Posted: Thu Oct 28, 2010 1:42 pm
by Administrator
There seems to be a DDE problem here.
Give me a short while and I'll generate an example using the Vensim DLL.
Tony.
Posted: Thu Oct 28, 2010 2:13 pm
by Administrator
I've replied to you via email.
Tony.
Posted: Fri Oct 29, 2010 11:36 am
by ahmadi2010
Thank you Tony for your help
Posted: Fri Oct 29, 2010 4:50 pm
by ahmadi2010
Is there any way that vensim after its running automatically exports some calculated value to an excel environment. (with the settings before runnig program)?
Posted: Sat Oct 30, 2010 9:56 am
by bob@vensim.com
You know you can call Vensim DSS by providing it with a .cmd script as an argument and have it do whatever you want, including exporting results to a txt file that Excel can read or pushing them to a database using ODBC that excel can also read. At the end of that a MENU>EXIT will cause the Vensim DSS process to exist and then you can start it again fresh the next time it is needed.
Posted: Sun Oct 31, 2010 7:47 pm
by ahmadi2010
Thank you bob
1)I'm using this command (SPECIAL>LOADMODEL) for .mdl (DDE problem)
for .cmd script what kind of command should I use??
2)I'm using this command (MENU>EXIT ) to close vensim program. Is there any command to start vensim after closing it?
Posted: Mon Nov 01, 2010 10:37 am
by bob@vensim.com
The commands are the same - so it is still SPECIAL>LOADMODEL - to launch Vensim you will need to ask on the Excel or Matlab forums.
Re:
Posted: Fri Jun 24, 2016 5:37 am
by samira15928
ahmadi2010 wrote: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?
You mean by installing XP, you solved the problem?
Re: vensim link matlab
Posted: Fri Jun 24, 2016 1:30 pm
by tomfid
This thread is six years old, and all the software involved has changed - I think you're unlikely to get useful answers here. I'd suggest composing a new question.