Using DLL functions in Vensim

Use this forum to post Vensim related questions.
Post Reply
ajclarke
Junior Member
Posts: 13
Joined: Thu Apr 08, 2010 7:37 am

Using DLL functions in Vensim

Post by ajclarke »

I want to do some things that I plan to write in a set of DLL files.
It appears that Vensim can be told about my DLL files, and that when defining an auxiliary or level I can then pick them as I would when using a built in function. Some questions about the practicality of this.
1) Will the DL be faster/slower than doing the same job via a small area of the model in a diagramatic way?
2) Does the DLL neet to be written in a special way to be usable by Vensim?
3) If I use an auxiliary that has subscripts then the equation that defines it will also use those subscripts. Would a DLL that replaces that equation return one value ( e.g. be called by Vensim for every member of that auxiliary, or would it be called once by vensim and expect to be passed back all the subscripts in a block.
4) Are there any examples in the tool that could help me?
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

>> 1) Will the DL be faster/slower than doing the same job via a small area of the model in a diagramatic way?
Depends on how complicated the code is. The DLL interface is typically used for doing things that cannot be done in Vensim, so if you can do it on a sketch, do it there, it will be easier to debug your model.

>> 2) Does the DLL neet to be written in a special way to be usable by Vensim?
>> 3) If I use an auxiliary that has subscripts then the equation that defines it will also use those subscripts.
>> Would a DLL that replaces that equation return one value ( e.g. be called by Vensim for every member
>> of that auxiliary, or would it be called once by vensim and expect to be passed back all the subscripts in
>> a block.
>> 4) Are there any examples in the tool that could help me?
Have a look at the example that ships with Vensim (venext.c). It is well commented and includes examples on how to do item 3 (loop management).

Tony.
Post Reply