Using: Vensim 7.1 DSS
I have a similar query to the two links below which both aimed to have a 'dynamic' link with Excel. Not sure how it was solved in the end, hence this post.
viewtopic.php?f=2&t=5009
viewtopic.php?f=2&t=5273
The second deals with using Vensim as a DDE Client. From the examples provided (DDE Client) I was able to link Excel and Vensim. Input from Excel is straightforward with GET XLS functions but to send values from Vensim to Excel is less basic.
What I am trying to achieve is:
1. Vensim to send values (Pressure and Temperature of Steam) to Excel
2. Excel via Water97.xla Add-Inn to calculate the steam properties, for instance specific enthalpy
3. Excel to send back the calculated values to Vensim
4. Vensim to simulate
So currently the above has been achieved but the link/process is 'static'. For instance, when SynTheSim is used the steam proprieties are not automatically updated. What I 'need' is to have the Water97 Excel Add-In to be a user defined function in Vensim or similar. How are UDF created in Vensim?
What makes the process more complicated is that after Step 4 the values (Pressure and Temperature) may be updated in the simulation, so an iterative approach is required. In Excel this is achieved with "Enable iterative calculations". I assume one could manage this with simultaneous equations in Vensim.
Attached is the Excel file and Vensim example model. Unforuntely, .xla files are not allowed but Excel Add-In (Water97_v13.xla) can be downloaded from http://files.engineering.com/getfile.as ... 97_v13.xla
To get the setup to work the directory needs to be changed. The Excel Add-In would also need to be saved and activated (similar to built-in Solver). For the example Excel could be doing basic calculations based and Vensim inputs and then send back (but then you would not need Excel / Excel Add-In
![Wink ;)](./images/smilies/icon_wink.gif)
Is the DDE Client route a good choice? I am not a programming wizard. What would you recommend?
Thank you in advance.