Dear colleagues,
I want to establish a 2 ways link between a Fortran porgram and a Vensim program in the following way :
at every time step Vensim receives inputs from Fortran, computes new values for variables, and send some outputs to Fortran ...
1-do you think it is possible ?
2-if possible, how to do that ?...
Thanks for your help
linking Vensim and Fortran, possible ? How ?
-
- Junior Member
- Posts: 7
- Joined: Wed May 04, 2011 11:52 am
-
- Super Administrator
- Posts: 4608
- Joined: Wed Mar 05, 2003 3:10 am
Re: linking Vensim and Fortran, possible ? How ?
There are three ways you might do this. None of them are trivial and will involve some programming. It can be done though (I've linked Excel/Vensim and MapInfo/Vensim in the past).
1. External functions.The function would be executed each time step, and you could read from an output file or write to one. If your Fortran program is DDE enabled (or can use memory files), you can use that method to swap information.
2. DDE. If the Fortran program has a way of connecting to another application via DDE, you could control Vensim this way.
3. Visual Basic/other. If the Fortran program has an API (like the Vensim DLL), you could control both the model and the Fortran program this way).
1. External functions.The function would be executed each time step, and you could read from an output file or write to one. If your Fortran program is DDE enabled (or can use memory files), you can use that method to swap information.
2. DDE. If the Fortran program has a way of connecting to another application via DDE, you could control Vensim this way.
3. Visual Basic/other. If the Fortran program has an API (like the Vensim DLL), you could control both the model and the Fortran program this way).
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: linking Vensim and Fortran, possible ? How ?
Fortan code can be run via the 'C' language.
Don't recall the details though.
Did it back in the early 1990s.
Don't recall the details though.
Did it back in the early 1990s.
Re: linking Vensim and Fortran, possible ? How ?
@mike - Right. This is probably the way to go, because Vensim external functions are normally native C, and the DLL is easy to call from C. I haven't used Fortran since the mid-80s, on computers with tape drives, so unfortunately I don't have any further insights on this.
/*
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
*/