linking Vensim and Fortran, possible ? How ?

Use this forum to post Vensim related questions.
Post Reply
Christian.Chaboud
Junior Member
Posts: 7
Joined: Wed May 04, 2011 11:52 am

linking Vensim and Fortran, possible ? How ?

Post by Christian.Chaboud »

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
Administrator
Super Administrator
Posts: 4608
Joined: Wed Mar 05, 2003 3:10 am

Re: linking Vensim and Fortran, possible ? How ?

Post by Administrator »

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).
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
mike
Senior Member
Posts: 56
Joined: Fri May 21, 2004 12:53 am

Re: linking Vensim and Fortran, possible ? How ?

Post by mike »

Fortan code can be run via the 'C' language.
Don't recall the details though.
Did it back in the early 1990s.
tomfid
Administrator
Posts: 3815
Joined: Wed May 24, 2006 4:54 am

Re: linking Vensim and Fortran, possible ? How ?

Post by tomfid »

@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.
Post Reply